# sudivj/rainworld-clone-test architecture

> Architecture diagram of the GitHub repository sudivj/rainworld-clone-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sudivj/rainworld-clone-test
- Repository: https://github.com/sudivj/rainworld-clone-test

## Overview

This is a small SDL2 Rain World clone test. The visible workflow is SDL startup, then the game loop, where rooms and creatures can be updated and rendered. Creature setup reads YAML configuration, builds linked body parts, and derives smoothed polygon vertices for drawing. The graph includes the sampled runtime modules and their evidenced relationships; README and excerpts do not establish a fuller game loop, input flow, or room/creature orchestration, so those links are omitted.

Main entry points: [`src/creature.cpp`](https://github.com/sudivj/rainworld-clone-test/blob/main/src/creature.cpp) (Creature model), [`main.cpp`](https://github.com/sudivj/rainworld-clone-test/blob/main/main.cpp) (SDL startup), [`src/game.cpp`](https://github.com/sudivj/rainworld-clone-test/blob/main/src/game.cpp) (Game entry), [`src/node.cpp`](https://github.com/sudivj/rainworld-clone-test/blob/main/src/node.cpp) (Position nodes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_main["SDL startup<br/>[main.cpp]"]
end

subgraph group_simulation["Game simulation"]
  node_game["Game entry<br/>[game.cpp]"]
  node_room["Room tiles<br/>[room.cpp]"]
  node_tile["Tile rendering<br/>[tile.cpp]"]
end

subgraph group_creature["Creature model"]
  node_creature["Creature model<br/>[creature.cpp]"]
  node_config["Creature YAML<br/>[data.yml]"]
  node_bodypart["Body parts<br/>[bodypart.cpp]"]
end

subgraph group_geometry["Geometry and rendering"]
  node_node["Position nodes<br/>[node.cpp]"]
  node_math["Math functions<br/>[math_functions.cpp]"]
  node_curves["Curve smoothing<br/>[curves.cpp]"]
  node_utils["Render utilities<br/>[utils.cpp]"]
  node_colors["Color constants<br/>[colors.hpp]"]
end

node_user(("Player"))
node_sdl["SDL window"]

node_user -->|"starts"| node_main
node_main -->|"creates window"| node_sdl
node_main -->|"calls"| node_game
node_game -.-> node_room
node_game -.-> node_creature
node_creature -->|"reads config"| node_config
node_creature -->|"creates parts"| node_bodypart
node_creature -->|"uses direction"| node_math
node_creature -->|"smooths vertices"| node_curves
node_creature -->|"fills polygon"| node_utils
node_bodypart -->|"inherits"| node_node
node_room -->|"draws tiles"| node_tile
node_tile -->|"uses colors"| node_colors
node_node -->|"uses colors"| node_colors
node_math -->|"reads positions"| node_node

click node_main "https://github.com/sudivj/rainworld-clone-test/blob/main/main.cpp"
click node_game "https://github.com/sudivj/rainworld-clone-test/blob/main/src/game.cpp"
click node_room "https://github.com/sudivj/rainworld-clone-test/blob/main/src/room/room.cpp"
click node_tile "https://github.com/sudivj/rainworld-clone-test/blob/main/src/room/tile.cpp"
click node_creature "https://github.com/sudivj/rainworld-clone-test/blob/main/src/creature.cpp"
click node_config "https://github.com/sudivj/rainworld-clone-test/blob/main/include/creatures/data.yml"
click node_bodypart "https://github.com/sudivj/rainworld-clone-test/blob/main/src/body/bodypart.cpp"
click node_node "https://github.com/sudivj/rainworld-clone-test/blob/main/src/node.cpp"
click node_math "https://github.com/sudivj/rainworld-clone-test/blob/main/src/math_functions.cpp"
click node_curves "https://github.com/sudivj/rainworld-clone-test/blob/main/src/curves/curves.cpp"
click node_utils "https://github.com/sudivj/rainworld-clone-test/blob/main/src/utils.cpp"
click node_colors "https://github.com/sudivj/rainworld-clone-test/blob/main/include/colors.hpp"

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 toneBlue
class node_game,node_room,node_tile toneAmber
class node_creature,node_config,node_bodypart toneMint
class node_node,node_math,node_curves,node_utils,node_colors toneRose
class node_user,node_sdl toneIndigo
```

## Components

### Application entry

- [SDL startup](https://github.com/sudivj/rainworld-clone-test/blob/main/main.cpp): `main.cpp`

### Game simulation

- [Game entry](https://github.com/sudivj/rainworld-clone-test/blob/main/src/game.cpp): `src/game.cpp`
- [Room tiles](https://github.com/sudivj/rainworld-clone-test/blob/main/src/room/room.cpp): `src/room/room.cpp`
- [Tile rendering](https://github.com/sudivj/rainworld-clone-test/blob/main/src/room/tile.cpp): `src/room/tile.cpp`

### Creature model

- [Creature model](https://github.com/sudivj/rainworld-clone-test/blob/main/src/creature.cpp): `src/creature.cpp`
- [Creature YAML](https://github.com/sudivj/rainworld-clone-test/blob/main/include/creatures/data.yml): `include/creatures/data.yml`
- [Body parts](https://github.com/sudivj/rainworld-clone-test/blob/main/src/body/bodypart.cpp): `src/body/bodypart.cpp`

### Geometry and rendering

- [Position nodes](https://github.com/sudivj/rainworld-clone-test/blob/main/src/node.cpp): `src/node.cpp`
- [Math functions](https://github.com/sudivj/rainworld-clone-test/blob/main/src/math_functions.cpp): `src/math_functions.cpp`
- [Curve smoothing](https://github.com/sudivj/rainworld-clone-test/blob/main/src/curves/curves.cpp): `src/curves/curves.cpp`
- [Render utilities](https://github.com/sudivj/rainworld-clone-test/blob/main/src/utils.cpp): `src/utils.cpp`
- [Color constants](https://github.com/sudivj/rainworld-clone-test/blob/main/include/colors.hpp): `include/colors.hpp`

### Other components

- **Player**
- **SDL window**

## Connections

- Player → SDL startup: starts (evidence: `main.cpp`)
- SDL startup → SDL window: creates window (evidence: `main.cpp`)
- SDL startup → Game entry: calls (evidence: `main.cpp`)
- Game entry → Room tiles
- Game entry → Creature model
- Creature model → Creature YAML: reads config (evidence: `src/creature.cpp`)
- Creature model → Body parts: creates parts (evidence: `src/creature.cpp`)
- Creature model → Math functions: uses direction (evidence: `src/creature.cpp`)
- Creature model → Curve smoothing: smooths vertices (evidence: `src/creature.cpp`)
- Creature model → Render utilities: fills polygon (evidence: `src/creature.cpp`)
- Body parts → Position nodes: inherits
- Room tiles → Tile rendering: draws tiles (evidence: `src/room/room.cpp`)
- Tile rendering → Color constants: uses colors
- Position nodes → Color constants: uses colors
- Math functions → Position nodes: reads positions (evidence: `src/math_functions.cpp`)
