# neilkakkar/solar-system architecture

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

- Interactive diagram: https://gitdiagram.com/neilkakkar/solar-system
- Repository: https://github.com/neilkakkar/solar-system

## Overview

Solar System is an SFML strategy arcade game: the player selects a planet and drags toward another to choose and send resources. The runtime starts in the main menu, then runs the active scene’s event, update, and render cycle. In the game, planets hold resources and dispatch ships; the sidebar exposes planet details and ship cargo controls. The README also describes random planet properties and inter-planet relations, though the sampled evidence does not establish all gameplay connections. Edges reflect shown calls, declared responsibilities, or README statements; unsampled behavior is not inferred.

Main entry points: [`game.cpp`](https://github.com/neilkakkar/solar-system/blob/master/game.cpp) (Game scene), [`planet.cpp`](https://github.com/neilkakkar/solar-system/blob/master/planet.cpp) (Planets), [`main.cpp`](https://github.com/neilkakkar/solar-system/blob/master/main.cpp) (Window loop), [`sidebar.cpp`](https://github.com/neilkakkar/solar-system/blob/master/sidebar.cpp) (Planet and ship panels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and scenes"]
  node_main["Window loop<br/>[main.cpp]"]
  node_scene["Scene contract<br/>[scene.h]"]
  node_menu["Main menu<br/>[mainmenu.cpp]"]
  node_game["Game scene<br/>[game.cpp]"]
end

subgraph group_simulation["Planet simulation"]
  node_planet["Planets<br/>[planet.cpp]"]
  node_ship["Spaceships<br/>[spaceship.cpp]"]
  node_relations["Planet relations"]
end

subgraph group_interface["Game interface"]
  node_sidebar["Planet and ship panels<br/>[sidebar.cpp]"]
  node_widgets["Widgets<br/>[widget.cpp]"]
  node_widgetlist["Widget layout<br/>[widget_list.cpp]"]
end

subgraph group_domain["Game data"]
  node_resources["Resource values<br/>[resource.cpp]"]
end

node_player(("Player"))

node_player -->|"starts game"| node_main
node_main -->|"initializes"| node_menu
node_main -->|"dispatches events"| node_scene
node_main -->|"updates and renders"| node_scene
node_menu -->|"implements"| node_scene
node_game -->|"implements"| node_scene
node_game -->|"manages planets"| node_planet
node_game -->|"tracks ships"| node_ship
node_game -->|"manages panel"| node_sidebar
node_game -->|"stores relations"| node_relations
node_planet -->|"holds resources"| node_resources
node_planet -->|"queues launches"| node_ship
node_ship -->|"targets planets"| node_planet
node_ship -->|"carries resources"| node_resources
node_relations -->|"keys relations"| node_planet
node_sidebar -->|"inspects and selects"| node_planet
node_sidebar -->|"uses controls"| node_widgets
node_sidebar -->|"lays out controls"| node_widgetlist
node_widgetlist -->|"updates and renders"| node_widgets
node_player -->|"drags resource route"| node_game
node_menu -.->|"enters play"| node_game

click node_main "https://github.com/neilkakkar/solar-system/blob/master/main.cpp"
click node_scene "https://github.com/neilkakkar/solar-system/blob/master/scene.h"
click node_menu "https://github.com/neilkakkar/solar-system/blob/master/mainmenu.cpp"
click node_game "https://github.com/neilkakkar/solar-system/blob/master/game.cpp"
click node_planet "https://github.com/neilkakkar/solar-system/blob/master/planet.cpp"
click node_ship "https://github.com/neilkakkar/solar-system/blob/master/spaceship.cpp"
click node_relations "https://github.com/neilkakkar/solar-system/blob/master/planet_relationships.cpp"
click node_sidebar "https://github.com/neilkakkar/solar-system/blob/master/sidebar.cpp"
click node_widgets "https://github.com/neilkakkar/solar-system/blob/master/widget.cpp"
click node_widgetlist "https://github.com/neilkakkar/solar-system/blob/master/widget_list.cpp"
click node_resources "https://github.com/neilkakkar/solar-system/blob/master/resource.cpp"

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_main,node_scene,node_menu,node_game toneBlue
class node_planet,node_ship,node_relations toneAmber
class node_sidebar,node_widgets,node_widgetlist toneMint
class node_resources toneRose
class node_player toneIndigo
```

## Components

### Runtime and scenes

- [Window loop](https://github.com/neilkakkar/solar-system/blob/master/main.cpp): `main.cpp`
- [Scene contract](https://github.com/neilkakkar/solar-system/blob/master/scene.h): `scene.h`
- [Main menu](https://github.com/neilkakkar/solar-system/blob/master/mainmenu.cpp): `mainmenu.cpp`
- [Game scene](https://github.com/neilkakkar/solar-system/blob/master/game.cpp): `game.cpp`

### Planet simulation

- [Planets](https://github.com/neilkakkar/solar-system/blob/master/planet.cpp): `planet.cpp`
- [Spaceships](https://github.com/neilkakkar/solar-system/blob/master/spaceship.cpp): `spaceship.cpp`
- [Planet relations](https://github.com/neilkakkar/solar-system/blob/master/planet_relationships.cpp): `planet_relationships.cpp`

### Game interface

- [Planet and ship panels](https://github.com/neilkakkar/solar-system/blob/master/sidebar.cpp): `sidebar.cpp`
- [Widgets](https://github.com/neilkakkar/solar-system/blob/master/widget.cpp): `widget.cpp`
- [Widget layout](https://github.com/neilkakkar/solar-system/blob/master/widget_list.cpp): `widget_list.cpp`

### Game data

- [Resource values](https://github.com/neilkakkar/solar-system/blob/master/resource.cpp): `resource.cpp`

### Other components

- **Player**

## Connections

- Player → Window loop: starts game (evidence: `README.md`)
- Window loop → Main menu: initializes (evidence: `main.cpp`)
- Window loop → Scene contract: dispatches events (evidence: `main.cpp`)
- Window loop → Scene contract: updates and renders (evidence: `main.cpp`)
- Main menu → Scene contract: implements
- Game scene → Scene contract: implements
- Game scene → Planets: manages planets
- Game scene → Spaceships: tracks ships
- Game scene → Planet and ship panels: manages panel
- Game scene → Planet relations: stores relations
- Planets → Resource values: holds resources
- Planets → Spaceships: queues launches
- Spaceships → Planets: targets planets
- Spaceships → Resource values: carries resources
- Planet relations → Planets: keys relations
- Planet and ship panels → Planets: inspects and selects
- Planet and ship panels → Widgets: uses controls
- Planet and ship panels → Widget layout: lays out controls
- Widget layout → Widgets: updates and renders
- Player → Game scene: drags resource route (evidence: `README.md`)
- Main menu → Game scene: enters play
