# happyseaweed/solaris architecture

> Architecture diagram of the GitHub repository happyseaweed/solaris, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/happyseaweed/solaris
- Repository: https://github.com/happyseaweed/solaris

## Overview

1. **What this repo is**
   - Solaris is a **native 2D game** built in **C++** on top of **SFML**.
   - The architecture is not client/server or web-based; it is a **single desktop executable** with a game loop, rendering, input handling, and state transitions.

2. **Top-level runtime flow**
   - `src/main.cpp` is the entry point.
   - `src/driver.cpp` and `include/driver.h` act as the **central coordinator** for the application: window setup, the main loop, dispatching events, and switching between game modes/screens.

3. **State / screen-based structure**
   - The codebase is split into separate gameplay and menu modes:
     - `titlescreen.cpp`
     - `overworld.cpp`
     - `outerspace.cpp`
     - `ship.cpp`
     - `paused.cpp`
   - This strongly suggests a **scene/state machine architecture**, where the driver routes control to whichever mode is active.

4. **Gameplay domain separation**
   - The state names imply distinct responsibilities:
     - **Title screen**: start/menu flow
     - **Overworld**: exploration or planet-side play
     - **Outer space**: space traversal or combat
     - **Ship**: player ship interior or management view
     - **Paused**: pause overlay or menu state
   - For an architecture diagram, these should be shown as **peer states** controlled by the central driver, not as independent apps.

5. **UI subsystem**
   - `src/UI.cpp` and `include/UI.h` form a dedicated **UI layer**.
   - This likely handles HUD elements, health bars, prompts, and interactive widgets shown across multiple states.
   - Because it is separated from the state files, UI appears to be a **shared rendering/input overlay** rather than embedded directly inside each scene.

6. **Rendering effects**
   - `include/blur.frag` is a **fragment shader**, so the project uses SFML’s graphics pipeline plus custom shader support.
   - This is likely used for visual polish in menu/pause/overlay states, or for background blurring behind UI panels.

7. **Asset pipeline**
   - `media/aseprite/` contains many `.aseprite` source files, which means the art pipeline is built around **Aseprite-authored sprites and animations**.
   - The asset names show the core visual set: astronaut variants, health bars, oxygen tanks, plants, asteroid, habitat, interaction button, and background imagery.
   - `media/astronaut` and other media entries suggest exported runtime assets are stored alongside the source art.

8. **Data flow between systems**
   - Typical flow is: **SFML input/events → driver → active state module → UI/rendering → window display**.
   - State modules own their scene-specific logic, while the UI module draws shared interface elements on top.
   - Assets from `media/` feed the render path; the shader adds post-processing where needed.

9. **Build and packaging**
   - `Makefile` is the build entry point, so the repo is set up for **local compilation and linking** rather than a higher-level engine workflow.
   - The checked-in `.o` files indicate build artifacts are present in the repository tree, but they are not part of the architectural runtime boundary.

10. **Repository boundaries**
   - `include/` contains the public headers and shader assets used by the C++ sources.
   - `src/` contains the implementation files.
   - `media/` is the content layer: art source files and runtime assets.
   - This clean split is useful for diagrams: **code layer**, **game-state layer**, and **content layer**.

11. **External dependency**
   - The only material external runtime dependency called out by the README is **SFML**.
   - There is no sign of network services, databases, or backend APIs; the game is fully local and graphics/input driven.

12. **Overall architectural picture**
   - Solaris is best represented as a **single-process, SFML-based 2D game** with:
     - a central driver/main loop,
     - multiple scene/state modules,
     - a shared UI layer,
     - shader-based visual effects,
     - and an Aseprite-driven asset pipeline.

Main entry points: [`media`](https://github.com/happyseaweed/solaris/tree/master/media) (Media Assets), [`src/titlescreen.cpp`](https://github.com/happyseaweed/solaris/blob/master/src/titlescreen.cpp) (Title), [`src/overworld.cpp`](https://github.com/happyseaweed/solaris/blob/master/src/overworld.cpp) (Overworld), [`src/outerspace.cpp`](https://github.com/happyseaweed/solaris/blob/master/src/outerspace.cpp) (Outer Space)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_src_main(("main<br/>entrypoint<br/>[main.cpp]"))
  node_src_driver["Driver<br/>coordinator"]
  node_state_title["Title<br/>scene state<br/>[titlescreen.cpp]"]
  node_state_overworld["Overworld<br/>scene state<br/>[overworld.cpp]"]
  node_state_outerspace["Outer Space<br/>scene state<br/>[outerspace.cpp]"]
  node_state_ship["Ship<br/>scene state<br/>[ship.cpp]"]
  node_state_paused["Paused<br/>scene state<br/>[paused.cpp]"]
  node_sfml(("SFML<br/>external runtime"))
end

subgraph group_ui["Presentation"]
  node_ui_layer["UI<br/>shared overlay"]
  node_shader_blur["Blur Shader<br/>post-process shader<br/>[blur.frag]"]
end

subgraph group_content["Content"]
  node_media_src["Aseprite Art<br/>source assets"]
  node_media_runtime["Media Assets<br/>runtime assets"]
end

subgraph group_build["Build"]
  node_makefile["Makefile<br/>build entry"]
  node_build_artifacts["Object Files<br/>build artifacts"]
end

node_src_main -->|"starts"| node_src_driver
node_src_driver -->|"uses"| node_sfml
node_src_driver -->|"selects"| node_state_title
node_src_driver -->|"selects"| node_state_overworld
node_src_driver -->|"selects"| node_state_outerspace
node_src_driver -->|"selects"| node_state_ship
node_src_driver -->|"selects"| node_state_paused
node_state_title -->|"draws"| node_ui_layer
node_state_overworld -->|"draws"| node_ui_layer
node_state_outerspace -->|"draws"| node_ui_layer
node_state_ship -->|"draws"| node_ui_layer
node_state_paused -->|"draws"| node_ui_layer
node_ui_layer -->|"applies"| node_shader_blur
node_media_src -->|"exports to"| node_media_runtime
node_media_runtime -->|"assets for"| node_state_title
node_media_runtime -->|"assets for"| node_state_overworld
node_media_runtime -->|"assets for"| node_state_outerspace
node_media_runtime -->|"assets for"| node_state_ship
node_media_runtime -->|"assets for"| node_ui_layer
node_makefile -->|"builds"| node_src_main
node_makefile -.->|"produces"| node_build_artifacts

click node_src_main "https://github.com/happyseaweed/solaris/blob/master/src/main.cpp"
click node_state_title "https://github.com/happyseaweed/solaris/blob/master/src/titlescreen.cpp"
click node_state_overworld "https://github.com/happyseaweed/solaris/blob/master/src/overworld.cpp"
click node_state_outerspace "https://github.com/happyseaweed/solaris/blob/master/src/outerspace.cpp"
click node_state_ship "https://github.com/happyseaweed/solaris/blob/master/src/ship.cpp"
click node_state_paused "https://github.com/happyseaweed/solaris/blob/master/src/paused.cpp"
click node_shader_blur "https://github.com/happyseaweed/solaris/blob/master/include/blur.frag"
click node_media_src "https://github.com/happyseaweed/solaris/tree/master/media/aseprite"
click node_media_runtime "https://github.com/happyseaweed/solaris/tree/master/media"
click node_makefile "https://github.com/happyseaweed/solaris/tree/master/Makefile"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_src_main,node_src_driver,node_state_title,node_state_overworld,node_state_outerspace,node_state_ship,node_state_paused,node_sfml toneBlue
class node_ui_layer,node_shader_blur toneAmber
class node_media_src,node_media_runtime toneMint
class node_makefile,node_build_artifacts toneRose
```

## Components

### Runtime

Single-process game loop and scene/state modules.

- [main](https://github.com/happyseaweed/solaris/blob/master/src/main.cpp): entrypoint · Program entry; starts the game executable. · `src/main.cpp`
- **Driver**: coordinator · Central loop, window setup, event dispatch, and state switching.
- [Title](https://github.com/happyseaweed/solaris/blob/master/src/titlescreen.cpp): scene state · Start/menu screen and entry flow. · `src/titlescreen.cpp`
- [Overworld](https://github.com/happyseaweed/solaris/blob/master/src/overworld.cpp): scene state · Planet-side exploration or main gameplay view. · `src/overworld.cpp`
- [Outer Space](https://github.com/happyseaweed/solaris/blob/master/src/outerspace.cpp): scene state · Space traversal or combat view. · `src/outerspace.cpp`
- [Ship](https://github.com/happyseaweed/solaris/blob/master/src/ship.cpp): scene state · Ship interior or management view. · `src/ship.cpp`
- [Paused](https://github.com/happyseaweed/solaris/blob/master/src/paused.cpp): scene state · Pause overlay or pause menu state. · `src/paused.cpp`
- **SFML**: external runtime · Graphics, windowing, input, and audio dependency.

### Presentation

Shared UI and visual effects used across states.

- **UI**: shared overlay · Shared HUD, prompts, and interactive interface elements.
- [Blur Shader](https://github.com/happyseaweed/solaris/blob/master/include/blur.frag): post-process shader · Fragment shader for blur and visual polish. · `include/blur.frag`

### Content

Aseprite-authored source art and runtime media assets.

- [Aseprite Art](https://github.com/happyseaweed/solaris/tree/master/media/aseprite): source assets · Editable sprite and animation source files. · `media/aseprite`
- [Media Assets](https://github.com/happyseaweed/solaris/tree/master/media): runtime assets · Exported or checked-in game art and other media files. · `media`

### Build

Local build entrypoints and repository-level packaging artifacts.

- [Makefile](https://github.com/happyseaweed/solaris/tree/master/Makefile): build entry · Local compilation and linking entrypoint. · `Makefile`
- **Object Files**: build artifacts · Checked-in compiled outputs present in the repository tree.

## Connections

- main → Driver: starts · Main hands off control to the central game driver.
- Driver → SFML: uses · Driver creates the window, polls events, and presents frames.
- Driver → Title: selects · Driver routes execution to the active scene state.
- Driver → Overworld: selects · Driver routes execution to the active scene state.
- Driver → Outer Space: selects · Driver routes execution to the active scene state.
- Driver → Ship: selects · Driver routes execution to the active scene state.
- Driver → Paused: selects · Driver routes execution to the active scene state.
- Title → UI: draws · Title screen can use shared UI rendering and widgets.
- Overworld → UI: draws · Gameplay overlays share the common UI layer.
- Outer Space → UI: draws · Gameplay overlays share the common UI layer.
- Ship → UI: draws · Gameplay overlays share the common UI layer.
- Paused → UI: draws · Pause presentation uses the shared UI layer.
- UI → Blur Shader: applies · UI and overlays may use blur for depth and emphasis.
- Aseprite Art → Media Assets: exports to · Aseprite source art feeds runtime media and sprites.
- Media Assets → Title: assets for · Visual assets support the title/menu scene.
- Media Assets → Overworld: assets for · Visual assets support the overworld scene.
- Media Assets → Outer Space: assets for · Visual assets support the space scene.
- Media Assets → Ship: assets for · Visual assets support the ship scene.
- Media Assets → UI: assets for · Icons, bars, and prompts feed the UI layer.
- Makefile → main: builds · Makefile compiles the executable from the source tree.
- Makefile → Object Files: produces · Local builds leave object files in the repository tree.
