commit d6a2c37a5ffa96f1a8b0cb5db82b259d7aa795cb Author: Gabriel Kaszewski Date: Fri Aug 8 15:30:47 2025 +0200 initialize repo diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f86dc9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +civ_codebase.txt diff --git a/Civilization.sln b/Civilization.sln new file mode 100644 index 0000000..44c1579 --- /dev/null +++ b/Civilization.sln @@ -0,0 +1,50 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{F2AAD021-D793-4910-ADA2-9A655FAA3671}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Civilization.Core", "Lib\Civilization.Core\Civilization.Core.csproj", "{1947734F-D4AF-4B96-B576-1785A518CB06}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Civilization.Shared", "Lib\Civilization.Shared\Civilization.Shared.csproj", "{EC2DA10E-1661-4CD3-AF51-59F2A7E6D74C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Civilization.Server", "Lib\Civilization.Server\Civilization.Server.csproj", "{A210FD70-21DB-4D70-8E05-851C6BE9DF00}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "godot_game", "godot_game", "{00F50C86-6B92-4850-9DD3-B183DAB900BA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Civilization.GodotIntegration", "godot_game\Civilization.GodotIntegration\Civilization.GodotIntegration.csproj", "{CD0D5AD9-EFF3-4DD8-A629-5CB8A898AE79}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1947734F-D4AF-4B96-B576-1785A518CB06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1947734F-D4AF-4B96-B576-1785A518CB06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1947734F-D4AF-4B96-B576-1785A518CB06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1947734F-D4AF-4B96-B576-1785A518CB06}.Release|Any CPU.Build.0 = Release|Any CPU + {EC2DA10E-1661-4CD3-AF51-59F2A7E6D74C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC2DA10E-1661-4CD3-AF51-59F2A7E6D74C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC2DA10E-1661-4CD3-AF51-59F2A7E6D74C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC2DA10E-1661-4CD3-AF51-59F2A7E6D74C}.Release|Any CPU.Build.0 = Release|Any CPU + {A210FD70-21DB-4D70-8E05-851C6BE9DF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A210FD70-21DB-4D70-8E05-851C6BE9DF00}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A210FD70-21DB-4D70-8E05-851C6BE9DF00}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A210FD70-21DB-4D70-8E05-851C6BE9DF00}.Release|Any CPU.Build.0 = Release|Any CPU + {CD0D5AD9-EFF3-4DD8-A629-5CB8A898AE79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD0D5AD9-EFF3-4DD8-A629-5CB8A898AE79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD0D5AD9-EFF3-4DD8-A629-5CB8A898AE79}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {CD0D5AD9-EFF3-4DD8-A629-5CB8A898AE79}.Release|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {1947734F-D4AF-4B96-B576-1785A518CB06} = {F2AAD021-D793-4910-ADA2-9A655FAA3671} + {EC2DA10E-1661-4CD3-AF51-59F2A7E6D74C} = {F2AAD021-D793-4910-ADA2-9A655FAA3671} + {A210FD70-21DB-4D70-8E05-851C6BE9DF00} = {F2AAD021-D793-4910-ADA2-9A655FAA3671} + {CD0D5AD9-EFF3-4DD8-A629-5CB8A898AE79} = {00F50C86-6B92-4850-9DD3-B183DAB900BA} + EndGlobalSection +EndGlobal diff --git a/Lib b/Lib new file mode 160000 index 0000000..67de04e --- /dev/null +++ b/Lib @@ -0,0 +1 @@ +Subproject commit 67de04e3dab051f5cba847a57dd3b23a5531a1be diff --git a/README.md b/README.md new file mode 100644 index 0000000..e409278 --- /dev/null +++ b/README.md @@ -0,0 +1,91 @@ +# Civilization Prototype + +A turn-based strategy game prototype inspired by *Sid Meier's Civilization*, built with **Godot 4.4** for rendering and input, and a **clean engine-agnostic core** in pure C#*. + +## Project Goals + +This prototype explores the following: + +* **Turn-based strategy fundamentals**: movement, unit actions, territory expansion, and city building. +* **Decoupled core logic**: all game rules are defined independently from the engine, making it portable and testable. +* **Flexible action system**: a command queue architecture that supports undo/redo, multiplayer (deterministic replays), and even quirky ideas like play-by-email. +* **Godot integration layer**: visualizes units, tiles, and cities with clean input and selection systems. +* **Modular design**: expanding to support multiple unit types, city production, combat, AI, diplomacy, and more. + +## Current Features + +### Core Engine (`Civilization.Core`) + +* **Tile-based Map**: built using a generic `ITileGrid` interface; currently uses a square grid. +* **Turn Manager**: supports multi-player turn cycling. +* **Units**: + + * Unit types and metadata stored in a `UnitDataRegistry`. + * Settlers can move and settle cities. +* **Cities**: + + * Own territory and expand it autonomously. + * Consume action points per turn. +* **Actions**: + + * All gameplay effects are modeled as actions implementing `IGameAction`. + * Supports queuing and undo (future). +* **Game Loop**: + + * Units and cities respond to turn start/end via `IOnTurnListener`. + +### Godot Integration (`GodotIntegration/`) + +* **GameController**: bootstraps the game and connects UI systems. +* **InputSystem**: handles tile clicks, movement, and context-sensitive commands. +* **SelectionSystem**: tracks and displays the selected unit. +* **Renderers**: + + * `MapRenderer`: renders static map using `TileMapLayer`. + * `UnitRenderer`, `CityRenderer`: instantiates scenes for units/cities. +* **UI**: + + * Simple HUD showing current turn and selected unit. + * "Settle City" button tied to core action system. + +## Planned Features + +* 🔜 **Production system** in cities (queue-based, producing units/buildings). +* 🔜 **Multiple unit types** with different behaviors and tags. +* 🔜 **Combat mechanics** between units and cities. +* 🔜 **Fog of War**, vision, and terrain effects. +* 🔜 **AI opponents** with strategic goals. +* 🔜 **Undo/redo system** based on `ExecutedAction` snapshots. +* 🔜 **Multiplayer** with deterministic replay and synced action queues. + +## Design Philosophy + +* **Engine-agnostic**: Core game logic is 100% independent of Godot. +* **Composable and modular**: Systems like actions, selection, and input can evolve independently. +* **Testability and clarity**: Logic is simple and declarative; action results are reproducible. +* **Extensible**: New unit types, actions, and tile types can be added without rewriting logic. + +## Getting Started + +1. Open the project in Godot 4.4. +2. Hit **Play** – a 10x10 map will be generated with a starting settler. +3. Right-click to move settler or use the "Settle City" button to create a city. +4. End turn to see city auto-expand its territory. + +## Tech Stack + +* **C# 12**, **.NET 8** +* **Godot 4.4 (C# integration)** +* **Clean Architecture** principles + +## Future Vision + +The end goal is a modular, data-driven Civ-like engine that supports: + +* Headless simulation (useful for AI, remote games) +* Rich modding support (unit/city definitions via JSON) +* Platform-agnostic UI (e.g., Godot, web, terminal) +* Potential AI research experiments and procedural world generation + +-- +* For now Core is not completely engine-agnostic because it uses Godot's `Vector2` and `Color` but this will be changed in the future. diff --git a/codebase_cmd.txt b/codebase_cmd.txt new file mode 100644 index 0000000..c9a6635 --- /dev/null +++ b/codebase_cmd.txt @@ -0,0 +1 @@ +uvx files-to-prompt . -o civ_codebase.txt -e cs diff --git a/godot_game b/godot_game new file mode 160000 index 0000000..3d8e0f2 --- /dev/null +++ b/godot_game @@ -0,0 +1 @@ +Subproject commit 3d8e0f2828972e3c690fc71b073f6b7178a20341