Code architecture¶
This page is for programmers who want to change the template's code. If you only want to create content (levels, enemies, weapons), start with How the template works and the guides.
Assemblies¶
| Assembly | Contents |
|---|---|
AiasTech.Runtime |
All game code, in Assets/DungeonCrawler/Scripts |
AiasTech.Editor |
The template's inspectors, tools and editor menus |
AiasTech.Setup.Editor |
The Setup window. It compiles even when packages are missing, so it can install them |
The whole runtime is a single assembly, split by namespace (AiasTech.<System>), one per folder. Systems
reference each other freely; the diagram below shows the conceptual organization, not a rule enforced by the
compiler.
Layers¶
flowchart TB
subgraph Presentation
direction LR
Menu ~~~ Animation ~~~ Rendering
end
subgraph LevelCampaign["Level and campaign"]
direction LR
Level ~~~ Campaign
end
subgraph Gameplay
direction LR
Player ~~~ Enemy ~~~ Weapon ~~~ Combat ~~~ Equipment ~~~ PickUp
end
subgraph GridRules["Grid rules"]
GridSystem
end
subgraph Services
direction LR
Core ~~~ SaveSystem ~~~ GameSettings ~~~ Input ~~~ Localization ~~~ Audio
end
subgraph Base
direction LR
Shared ~~~ Utils
end
Presentation --> LevelCampaign
LevelCampaign --> Gameplay
Gameplay --> GridRules
GridRules --> Services
Services --> Base
- Base:
Shared(common data types) andUtils(helpers) depend on no other system. - Services: save, input, audio, language, settings and the global match state.
- Grid rules: cells, occupancy, movement, pathfinding and turns. Knows nothing about combat.
- Gameplay: the actors and what they do.
- Level and campaign: level objects (doors, triggers, checkpoint, minimap) and progression between levels.
- Presentation: menus, camera-angle sprites and procedural effect animation.
One turn, from input to control returning¶
sequenceDiagram
autonumber
participant P as Player<br/>(GridPlayerController)
participant T as TurnManager
participant E as Enemies<br/>(EnemyBrain)
participant G as GridMap
P->>G: GridMover.TryStep (reserves the target cell)
P->>T: CommitPlayerTurn(combatPacing)
T->>T: waits for the player to finish<br/>(or movementOverlap)
loop each active actor, in registration order
T->>E: BeginTurn()
E->>G: decides and reserves a cell
alt only walking
E-->>T: joins the walkers list<br/>(next actor starts the same frame)
else attacking
E-->>T: IsBusy until the attack ends
end
end
T->>T: waits for walkers to arrive
T-->>P: TurnStarted(turn number)<br/>and returns input
combatPacing is true for attacks and items (with the pacing pauses) and false for movement. Details are in
Assets/DungeonCrawler/Scripts/GridSystem/ARCHITECTURE.md.
Systems¶
Each system folder ships with an ARCHITECTURE.md file next to its code. These files are part of the package and
are the detailed reference for programmers: folder structure, classes, execution order, contracts and rules for
extending. The path is always Assets/DungeonCrawler/Scripts/<System>/ARCHITECTURE.md.
| System | Namespace | Purpose |
|---|---|---|
| Setup | AiasTech.Setup |
Window that checks and fixes project packages and settings |
| Core | AiasTech.Core |
Global match state, difficulty, scene transitions and level flow UI |
| GridSystem | AiasTech.GridSystem |
Map, cells, occupancy, movement, pathfinding and turns |
| Level | AiasTech.Level |
Level runtime: completion, counters, keys, interaction, NPCs, triggers, traps, exploration and checkpoint |
| Campaign | AiasTech.Campaign |
Chapter and level order, saved-progress scene and chapter selector |
| Player | AiasTech.Players |
Player facade, health and armor, commands and HUD |
| Enemy | AiasTech.Enemy |
Entity, state-machine AI, actions, boss phases and minions |
| Weapon | AiasTech.Weapon |
Weapons, attack profiles, inventory and ammo |
| Combat | AiasTech.Combat |
Attack resolution on the grid and damage distribution |
| Equipment | AiasTech.Equipment |
Equipment progression, usable items, gauntlets, inventory and shop |
| PickUp | AiasTech.PickUp |
Collectibles, loot tables and applying their effects |
| SaveSystem | AiasTech.SaveSystem |
Typed, versioned save document and its modules |
| GameSettings | AiasTech.GameSettings |
Global design configuration and player preferences |
| Input | AiasTech.Input |
Single Input System instance, binding display and rebinding |
| Localization | AiasTech.Localization |
Facade over Unity Localization (category + key) |
| Audio | AiasTech.Audio |
Music, one-shots and volumes applied to the mixer |
| Menu | AiasTech.Menu |
Menu navigation, preferences screen and UI components |
| Animation | AiasTech.Animation |
Procedural sprite animation for visual effects |
| Rendering | AiasTech.Rendering |
2D sprites by camera angle, four-direction Animator |
| Shared | AiasTech.Shared |
Small contracts: damage payload, damage types, key colors |
| Utils | AiasTech.Utils |
Pooling, small visual components and Inspector tools |
| Editor | AiasTech.Editor |
Authoring, migration and playtest tools (editor only) |