# lilianzzz/pixelshipgenerator architecture

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

- Interactive diagram: https://gitdiagram.com/lilianzzz/pixelshipgenerator
- Repository: https://github.com/lilianzzz/pixelshipgenerator

## Overview

Pixel Ship Generator is a Pygame application for interactively generating, viewing, customizing, and saving pixel-art ships. The principal workflow starts at the title screen, enters the generator, and creates ships from seeded pixel maps, frames, and placed components; users can then select, mirror, recolor, and save them. The graph preserves the documented customization and major generation subsystems. Some relationships rely on SOURCE INDEX references rather than complete excerpts, so unsampled internals are not expanded beyond those references.

Main entry points: [`data/ship/ship.py`](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/ship.py) (Ship Assembly), [`data/generator.py`](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/generator.py) (Generator Controls), [`data/main.py`](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/main.py) (App Loop), [`data/ship/palette.py`](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/palette.py) (Component Palette)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_main["App Loop<br/>[main.py]"]
  node_title["Title and Instructions<br/>[title_screen.py]"]
  node_generator["Generator Controls<br/>[generator.py]"]
  node_state["UI State Base<br/>[state.py]"]
  node_button["Button<br/>[button.py]"]
end

subgraph group_generation["Ship Generation"]
  node_ship["Ship Assembly<br/>[ship.py]"]
end

subgraph group_geometry["Geometry and Components"]
  node_frame["Frame Layout<br/>[frame.py]"]
  node_spine["Ship Spine<br/>[spine.py]"]
  node_placer["Component Placement"]
  node_connector["Ship Connections<br/>[ship_connector.py]"]
  node_component["Component Base<br/>[component.py]"]
  node_hull["Hull Shapes<br/>[basic_hull.py]"]
  node_angles["Angle Shapes<br/>[angles.py]"]
  node_curves["Curve Shapes<br/>[curves.py]"]
  node_compound["Compound Shapes"]
end

subgraph group_appearance["Color and Mapping"]
  node_pixelmap["Pixel Map<br/>[pixel_map.py]"]
  node_mirror["Ship Mirroring<br/>[mirror.py]"]
  node_palette["Component Palette<br/>[palette.py]"]
  node_colors["Ship Colors<br/>[color_gen.py]"]
  node_outline["Outline Scanning<br/>[scan_outline.py]"]
end

node_user(("Player"))

node_user -->|"uses"| node_main
node_main -->|"starts at"| node_title
node_main -->|"opens"| node_generator
node_main -->|"updates and draws"| node_state
node_title -->|"extends"| node_state
node_title -->|"starts or resumes"| node_main
node_generator -->|"extends"| node_state
node_generator -->|"creates and checks"| node_button
node_generator -->|"generates"| node_ship
node_generator -->|"applies"| node_mirror
node_generator -->|"opens instructions"| node_main
node_ship -->|"inherits"| node_pixelmap
node_ship -->|"creates"| node_frame
node_ship -->|"creates"| node_palette
node_ship -->|"selects mirror"| node_mirror
node_ship -->|"uses"| node_placer
node_ship -->|"uses"| node_connector
node_ship -->|"uses"| node_colors
node_frame -->|"creates"| node_spine
node_component -->|"inherits"| node_pixelmap
node_hull -->|"extends"| node_component
node_angles -->|"extends"| node_component
node_curves -->|"extends"| node_component
node_compound -->|"uses"| node_component
node_compound -->|"uses"| node_angles
node_palette -->|"selects shapes"| node_hull
node_palette -->|"selects shapes"| node_angles
node_palette -->|"selects shapes"| node_curves
node_palette -->|"selects shapes"| node_compound
node_mirror -->|"transforms"| node_pixelmap
node_outline -->|"scans"| node_pixelmap

click node_main "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/main.py"
click node_title "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/title_screen.py"
click node_generator "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/generator.py"
click node_state "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/state.py"
click node_button "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/button.py"
click node_ship "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/ship.py"
click node_frame "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/frame.py"
click node_spine "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/spine.py"
click node_placer "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/component_placer.py"
click node_connector "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/ship_connector.py"
click node_component "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/component.py"
click node_hull "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/basic_hull.py"
click node_angles "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/angles.py"
click node_curves "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/curves.py"
click node_compound "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/compound_components.py"
click node_pixelmap "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/pixel_map.py"
click node_mirror "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/mirror.py"
click node_palette "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/palette.py"
click node_colors "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/color_gen.py"
click node_outline "https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/scan_outline.py"

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_title,node_generator,node_state,node_button toneBlue
class node_ship toneAmber
class node_frame,node_spine,node_placer,node_connector,node_component,node_hull,node_angles,node_curves,node_compound toneMint
class node_pixelmap,node_mirror,node_palette,node_colors,node_outline toneRose
class node_user toneIndigo
```

## Components

### Application UI

- [App Loop](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/main.py): `data/main.py`
- [Title and Instructions](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/title_screen.py): `data/title_screen.py`
- [Generator Controls](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/generator.py): `data/generator.py`
- [UI State Base](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/state.py): `data/state.py`
- [Button](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/button.py): `data/button.py`

### Ship Generation

- [Ship Assembly](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/ship.py): `data/ship/ship.py`

### Geometry and Components

- [Frame Layout](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/frame.py): `data/ship/frame.py`
- [Ship Spine](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/spine.py): `data/ship/spine.py`
- [Component Placement](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/component_placer.py): `data/ship/component_placer.py`
- [Ship Connections](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/ship_connector.py): `data/ship/ship_connector.py`
- [Component Base](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/component.py): `data/ship/components/component.py`
- [Hull Shapes](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/basic_hull.py): `data/ship/components/basic_hull.py`
- [Angle Shapes](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/angles.py): `data/ship/components/angles.py`
- [Curve Shapes](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/curves.py): `data/ship/components/curves.py`
- [Compound Shapes](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/components/compound_components.py): `data/ship/components/compound_components.py`

### Color and Mapping

- [Pixel Map](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/pixel_map.py): `data/ship/pixel_map.py`
- [Ship Mirroring](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/mirror.py): `data/ship/mirror.py`
- [Component Palette](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/palette.py): `data/ship/palette.py`
- [Ship Colors](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/color_gen.py): `data/ship/color_gen.py`
- [Outline Scanning](https://github.com/lilianzzz/pixelshipgenerator/blob/master/data/ship/scan_outline.py): `data/ship/scan_outline.py`

### Other components

- **Player**

## Connections

- Player → App Loop: uses (evidence: `data/main.py`)
- App Loop → Title and Instructions: starts at (evidence: `data/main.py`)
- App Loop → Generator Controls: opens (evidence: `data/main.py`)
- App Loop → UI State Base: updates and draws (evidence: `data/main.py`)
- Title and Instructions → UI State Base: extends (evidence: `data/title_screen.py`)
- Title and Instructions → App Loop: starts or resumes (evidence: `data/title_screen.py`)
- Generator Controls → UI State Base: extends (evidence: `data/generator.py`)
- Generator Controls → Button: creates and checks (evidence: `data/generator.py`)
- Generator Controls → Ship Assembly: generates (evidence: `data/generator.py`)
- Generator Controls → Ship Mirroring: applies (evidence: `data/generator.py`)
- Generator Controls → App Loop: opens instructions (evidence: `data/generator.py`)
- Ship Assembly → Pixel Map: inherits (evidence: `data/ship/ship.py`)
- Ship Assembly → Frame Layout: creates (evidence: `data/ship/ship.py`)
- Ship Assembly → Component Palette: creates (evidence: `data/ship/ship.py`)
- Ship Assembly → Ship Mirroring: selects mirror (evidence: `data/ship/ship.py`)
- Ship Assembly → Component Placement: uses (evidence: `data/ship/ship.py`)
- Ship Assembly → Ship Connections: uses (evidence: `data/ship/ship.py`)
- Ship Assembly → Ship Colors: uses (evidence: `data/ship/ship.py`)
- Frame Layout → Ship Spine: creates (evidence: `data/ship/frame.py`)
- Component Base → Pixel Map: inherits (evidence: `data/ship/components/component.py`)
- Hull Shapes → Component Base: extends (evidence: `data/ship/components/basic_hull.py`)
- Angle Shapes → Component Base: extends (evidence: `data/ship/components/angles.py`)
- Curve Shapes → Component Base: extends (evidence: `data/ship/components/curves.py`)
- Compound Shapes → Component Base: uses (evidence: `data/ship/components/compound_components.py`)
- Compound Shapes → Angle Shapes: uses (evidence: `data/ship/components/compound_components.py`)
- Component Palette → Hull Shapes: selects shapes (evidence: `data/ship/palette.py`)
- Component Palette → Angle Shapes: selects shapes (evidence: `data/ship/palette.py`)
- Component Palette → Curve Shapes: selects shapes (evidence: `data/ship/palette.py`)
- Component Palette → Compound Shapes: selects shapes (evidence: `data/ship/palette.py`)
- Ship Mirroring → Pixel Map: transforms (evidence: `data/ship/mirror.py`)
- Outline Scanning → Pixel Map: scans (evidence: `data/ship/scan_outline.py`)
