# small-fish-dev/my-summer-cottage-jam architecture

> Architecture diagram of the GitHub repository small-fish-dev/my-summer-cottage-jam, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/small-fish-dev/my-summer-cottage-jam
- Repository: https://github.com/small-fish-dev/my-summer-cottage-jam

## Overview

Based on our review of both the file tree and README, this project is a full game built for a game jam (namely the “My Summer Cottage” submission for Facepunch’s contest). It uses a modern C# codebase with many subsystems (gameplay, UI, events, player and NPC management, etc.) plus a huge set of assets (models, materials, prefabs, shaders, sounds, maps, etc.) that support the game’s worlds and experiences. The code is organized into many specialized directories (for example, code/CharacterCreator, code/Components, code/Event, code/Player, code/UI, etc.) and its UI leverages Razor (.razor) components. In short, the project is a full game engine project with clear separations between core gameplay systems, asset management, UI and even editor support tools.

##### Main Components
- Game Core/Engine:
– Includes core systems such as the main game loop, game time (code/Game/GameTimeManager.cs), network management, player spawning, and basic initialization.
- Gameplay Systems:
– Different game mechanics spread across directories like Characters (code/CharacterCreator), Components (physics, NPC behavior, interactions, events from code/Components and code/Event), Player, Fishing, Items, Tasks, etc.
– Notice the event system’s complexity; for example, code/Event contains definitions, nodes, triggers, and finders that likely drive gameplay events.
- User Interface:
– The UI subdirectories (code/UI/*) contain components for HUD (e.g., InGameHud, Inventory panels, notifications), main menus, and other interactive elements built with Razor (.razor) and styles (.razor.scss).
- Editor and Tools:
– The Editor folder (with IconEditor, SignalEditor, etc.) suggests there’s tooling integrated for asset or signal editing that might be used internally.
- Asset Pipeline / Resources:
– A substantial number of assets are present under models, materials, maps, prefabs, particles, sounds, shaders, etc. These are used by the game at runtime.
- Utilities & Shared Resources:
– The code/Util directory and other helper extensions (in code/Util/Extensions) handle cross-cutting concerns.
- External Resources and Tasks:
– The “resources” directory contains task definitions (story, random, wife-related tasks) that the game likely loads dynamically.
- Scenes and Level Data:
– The “scenes” folder contains scene configuration files (like scenes/menu.scene) to dictate when and how the game loads levels or menu environments.

##### Relationships and Interactions
- The Game Core acts as the central orchestrator managing the game loop and interfacing with both gameplay systems and the asset pipeline.
- Gameplay components (characters, NPCs, events, tasks, fishing, etc.) interact with each other and are often driven by events (events/triggers, nodes) that orchestrate state changes.
- The UI components are layered on top of gameplay, receiving data from gameplay systems (e.g., Player stats, HUD updates) and issuing commands (for example, via input actions or triggering events).
- Assets (models, materials, sounds, prefabs) support the visual, audio, and physical representation; they are loaded into the game core, tied to gameplay objects, and connected by utilities and resource managers.
- Utility libraries (extensions, global helpers) provide shared functions that are invoked by numerous systems (gameplay, UI, events, etc.).

##### Architectural Patterns and Principles
- Modularization – Each area of functionality (UI, Event System, Gameplay, Asset Management) is kept in its own folder and (likely) its own module or namespace, increasing separation of concerns.
- Event-Driven Design – With a dedicated events folder (nodes, triggers, finders), the design uses event-driven interactions to dynamically update gameplay.
- Data-Driven Asset Organization – Assets are categorized in directories that relate to their function (models, prefabs, sounds, maps, etc.), suggesting that at runtime these are loaded as needed.
- UI-as-Code – The UI is built using Razor components, which implies a reactive model where UI elements are directly tied to game state.
- Utility Abstraction – Shared behavior is abstracted into “Util” libraries, hinting at reuse and DRY (don’t-repeat-yourself) principles.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Game Core/Engine
    subgraph "Game Core/Engine"
        gc["Game Core/Engine"]
    end

    %% Gameplay Systems
    subgraph "Gameplay Systems"
        gc_cc["CharacterCreator"]
        gc_cs["Components"]
        gc_event["Event System"]
        gc_player["Player Logic"]
        gc_fishing["Fishing Mechanics"]
        gc_task["Task Management"]
    end

    %% User Interface Layer
    subgraph "User Interface"
        ui_layer["UI Layer"]
    end

    %% Editor and Tools
    subgraph "Editor Tools"
        editor_tools["Editor Tools"]
    end

    %% Asset Pipeline / Resources
    subgraph "Asset Pipeline"
        assets_models["Models"]
        assets_materials["Materials"]
        assets_pref["Prefabs"]
        assets_maps["Maps"]
        assets_scenes["Scenes"]
        assets_particles["Particles"]
        assets_shaders["Shaders"]
        assets_sounds["Sounds"]
    end

    %% Utilities & Shared Resources
    subgraph "Utilities & Shared Resources"
        utilities["Utilities"]
    end

    %% External Resources and Tasks
    subgraph "External Resources"
        external_resources["External Tasks"]
    end

    %% Connections: Game Core orchestrates Gameplay Systems
    gc -->|"orchestrates"| gc_cc
    gc -->|"orchestrates"| gc_cs
    gc -->|"orchestrates"| gc_event
    gc -->|"orchestrates"| gc_player
    gc -->|"orchestrates"| gc_fishing
    gc -->|"orchestrates"| gc_task

    %% Gameplay Systems update the UI Layer
    gc_cc -->|"updates"| ui_layer
    gc_cs -->|"updates"| ui_layer
    gc_event -->|"updates"| ui_layer
    gc_player -->|"updates"| ui_layer
    gc_fishing -->|"updates"| ui_layer
    gc_task -->|"updates"| ui_layer

    %% Asset Pipeline feeds into the Game Core/Engine
    assets_models -->|"feeds"| gc
    assets_materials -->|"feeds"| gc
    assets_pref -->|"feeds"| gc
    assets_maps -->|"feeds"| gc
    assets_scenes -->|"feeds"| gc
    assets_particles -->|"feeds"| gc
    assets_shaders -->|"feeds"| gc
    assets_sounds -->|"feeds"| gc

    %% Editor Tools interface with Assets and modify the Event System
    editor_tools -->|"interfaces"| assets_models
    editor_tools -->|"modifies"| gc_event

    %% External Resources load tasks into Gameplay Systems
    external_resources -->|"loads"| gc_task

    %% Utilities are used by multiple components (dotted relationships)
    gc -.->|"uses"| utilities
    ui_layer -.->|"uses"| utilities
    editor_tools -.->|"uses"| utilities
    assets_models -.->|"uses"| utilities

    %% Styles / Colors
    class gc core
    class gc_cc,gc_cs,gc_event,gc_player,gc_fishing,gc_task gameplay
    class ui_layer ui
    class editor_tools editor
    class assets_models,assets_materials,assets_pref,assets_maps,assets_scenes,assets_particles,assets_shaders,assets_sounds assets
    class utilities util
    class external_resources external

    classDef core fill:#3498DB,stroke:#2E86C1,color:#000
    classDef gameplay fill:#5DADE2,stroke:#2471A3,color:#000
    classDef ui fill:#58D68D,stroke:#28B463,color:#000
    classDef editor fill:#BDC3C7,stroke:#7F8C8D,color:#000
    classDef assets fill:#F5B041,stroke:#D68910,color:#000
    classDef util fill:#F4D03F,stroke:#D4AC0D,color:#000
    classDef external fill:#BB8FCE,stroke:#8E44AD,color:#000

    %% Click Events
    click gc "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Game"
    click gc_cc "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/CharacterCreator"
    click gc_cs "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Components"
    click gc_event "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Event"
    click gc_player "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Player"
    click gc_fishing "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Fishing"
    click gc_task "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Task"
    click ui_layer "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/UI"
    click editor_tools "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Editor"
    click assets_models "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/models"
    click assets_materials "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/materials"
    click assets_pref "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/prefabs"
    click assets_maps "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/maps"
    click assets_scenes "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/scenes"
    click assets_particles "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/particles"
    click assets_shaders "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/shaders"
    click assets_sounds "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/sounds"
    click utilities "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/code/Util"
    click external_resources "https://github.com/small-fish-dev/my-summer-cottage-jam/tree/main/resources/tasks"
```
