Skip to content

flame4530-maker/quack-hack-gorod

Repository files navigation

City Investments - Cozy Tile-Based City Builder

A strategic city-building game where council members (player + AI agents) compete by investing in buildings and managing city development.

Overview

City Investments is a turn-based strategy game where players take on the role of council members with different traits. Each member invests in buildings, harvests demand from adjacent tiles, and competes to reach 100 rating points.

Features

  • 6 Unique Traits: Doctor, Activist, Entrepreneur, Political, Volunteer, Academic - each with building and demand bonuses
  • 3 Building Types: Hospital, Park, Factory - each harvesting different demand types
  • 3 Demand Generators: Residential, Commercial, Industrial tiles
  • AI Opponents: Powered by LLM (Ollama/llama.cpp) with fallback AI
  • Dynamic Grid: Sparse grid system that expands as tiles are placed
  • Multiple Win Conditions: First to 100 rating, highest after turn 10, last 2 standing
  • Save/Load System: Binary save files with metadata

Requirements

Minimum:

  • Godot Engine: 4.2.1 or later
  • OS: macOS 11.0+ (Big Sur)
  • RAM: 4GB
  • Disk Space: 500MB

For LLM AI (Optional):

  • Ollama: Latest version OR
  • llama.cpp: Latest build
  • RAM: 8GB recommended (16GB for Apple Silicon)
  • Model: llama3 or qwen2.5-3b-instruct

Installation

1. Clone/Download Project

cd /Users/eaksenov/Projects/Godot-Game

2. Open in Godot

  1. Launch Godot 4.2.1+
  2. Click "Import"
  3. Navigate to project directory
  4. Select project.godot
  5. Click "Import & Edit"

3. (Optional) Set up LLM

Option A: Ollama (Easier)

# Install Ollama
brew install ollama

# Start Ollama service
ollama serve

# Pull model (in another terminal)
ollama pull llama3

# Verify
curl http://localhost:11434/api/generate -d '{"model":"llama3","prompt":"test","stream":false}'

Option B: llama.cpp (More Control)

# Install dependencies
xcode-select --install

# Clone and build
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp

# For Apple Silicon (M1/M2/M3)
make LLAMA_METAL=1

# For Intel Macs
make

# Download model
curl -L -O https://huggingface.co/Qwen/Qwen2.5-3B-Instruct-GGUF/resolve/main/qwen2.5-3b-instruct-q4_k_m.gguf

# Start server
./llama-server \
  --model qwen2.5-3b-instruct-q4_k_m.gguf \
  --ctx-size 8192 \
  --n-gpu-layers 35 \
  --port 8081

Note: If LLM is not available, the game will use fallback AI automatically.

How to Play

Game Start

  1. Run the game (F5 in Godot)
  2. Select your trait (each has unique bonuses)
  3. Choose number of AI agents (2-4)
  4. Click "Start Game"

Gameplay

Each turn:

  1. View the grid with tiles and buildings
  2. Choose one action:
    • Start New Building: Place a building from the queue
    • Invest in Building: Add investment to an under-construction building
    • Discredit Member: Reduce another member's rating

Winning

  • Primary: First to reach 100 rating
  • Secondary: Highest rating when 2 or fewer remain
  • Tertiary: Highest rating after turn 10
  • Final: After turn 15, members below 100 are disqualified

Strategies

  • Match your trait: Build types matching your trait get 3x points
  • Harvest demands: Buildings harvest adjacent demand for points
  • Timing: Complete buildings when they have high adjacent demand
  • Position: Place tiles to maximize future demand harvesting
  • Discredit wisely: -20 to target, -5 to you - use strategically

Game Mechanics

Point Calculation

When a building completes:

base_points = total_adjacent_demand × your_investment_count
if building_type matches trait: points = base_points × 3
else: points = base_points × 1

for each demand_type in harvest:
  if demand_type matches trait bonus:
    points += demand_amount × 2

Demand System

  • Generators (Residential/Commercial/Industrial): Emit 1 demand to each adjacent tile
  • Buildings (Hospital/Park/Factory): Harvest specific demands from adjacent tiles when completed
    • Hospital: Residential + Industrial
    • Park: Residential + Commercial
    • Factory: Commercial + Industrial

Building Lifecycle

  1. Placement: Selected from buildable queue (3 random types)
  2. Construction: Requires N investments (N = active member count)
  3. Completion: All investors receive points based on harvested demand
  4. Cooldown: That building type enters cooldown for N turns

Project Structure

Godot-Game/
├── assets/
│   └── sprites/tiles/
│       └── tiles.png          # 6 isometric tiles
├── scripts/
│   ├── autoload/
│   │   ├── enums.gd          # Global enums
│   │   └── game_manager.gd   # Singleton
│   ├── entities/
│   │   ├── tile.gd
│   │   ├── building.gd
│   │   ├── council_member.gd
│   │   ├── game_state.gd
│   │   └── trait_config.gd
│   ├── systems/
│   │   ├── grid_manager.gd
│   │   ├── tile_factory.gd
│   │   ├── demand_calculator.gd
│   │   ├── point_calculator.gd
│   │   ├── rating_manager.gd
│   │   ├── investment_processor.gd
│   │   ├── turn_manager.gd
│   │   ├── action_processor.gd
│   │   ├── llm_interface.gd
│   │   ├── save_load_manager.gd
│   │   └── fallback_ai.gd
│   ├── ui/
│   │   ├── game_board.gd
│   │   ├── game_hud.gd
│   │   ├── player_action_panel.gd
│   │   └── setup_screen.gd
│   └── game_controller.gd
├── scenes/
│   ├── main.tscn
│   └── ui/
│       └── setup_screen.tscn
├── resources/
│   ├── tile_data/
│   │   └── tileset.tres
│   └── traits/
│       ├── doctor.tres
│       ├── activist.tres
│       ├── entrepreneur.tres
│       ├── political.tres
│       ├── volunteer.tres
│       └── academic.tres
└── project.godot

Save Files

Saves are stored in:

~/Library/Application Support/Godot/app_userdata/City Investments/saves/
  • autosave.dat: Automatically saved each turn
  • autosave_meta.json: Metadata for save browser

Troubleshooting

"HTTP request failed" error

  • Check if Ollama/llama.cpp is running
  • Verify port 11434 (Ollama) or 8081 (llama.cpp)
  • Game will use fallback AI if LLM unavailable

Tiles not displaying

  • Open resources/tile_data/tileset.tres in Godot
  • Configure atlas with 6 tiles (64×32 each)
  • Set texture region size to 64×32

Player actions not working

  • Ensure PlayerActionPanel is visible
  • Check console for action validation errors
  • Verify position is adjacent to existing tiles

Save files not loading

  • Check save file exists in user data directory
  • Verify save file version matches current version
  • Delete corrupted saves and start new game

Development

Running Tests

(Tests not yet implemented - see implementation plan Phase 9)

Building for Distribution

# Export from Godot Editor
Project → Export → macOS

# Or via CLI
godot --export-release "macOS" ./builds/CityInvestments.app

Code Signing (for distribution)

codesign --deep --force --verify --verbose \
  --sign "Developer ID Application: Your Name" \
  ./builds/CityInvestments.app

Credits

  • Game Design: Based on "City Investments" spec
  • Engine: Godot 4.2.1
  • LLM Integration: Ollama / llama.cpp
  • Tile Art: Custom isometric pixel art

License

(License information to be added)

Future Enhancements

  • Multiplayer support
  • Additional building types
  • More traits
  • Campaign mode with story
  • Advanced AI personalities
  • Visual effects and animations
  • Sound effects and music
  • Tutorial mode
  • Achievement system

Contact

For bugs, suggestions, or contributions, please contact the development team.


Version: 1.0
Last Updated: 2025-11-15
Status: Playable (LLM integration complete, testing phase)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors