BlueGit

blue-star tribegen

Files

tribegen / web
README.md

TribeGen - Kobold Tribe Management Game

A browser-based strategy game where you manage a tribe of Kobolds through their lives, facing challenges, making decisions, and watching your tribe evolve over generations.

Project Structure

tribegen/
├── public/                 # Web-accessible files
│   ├── index.php          # Main entry point
│   ├── index.html         # SPA template
│   ├── css/
│   │   └── style.css      # Main stylesheet
│   └── js/
│       └── app.js         # Frontend application
├── src/
│   ├── Classes/           # Core game classes
│   │   ├── User.php       # User authentication
│   │   ├── Kobold.php     # Kobold character class
│   │   ├── Tribe.php      # Tribe management
│   │   ├── Item.php       # Item class
│   │   ├── Injury.php     # Injury class
│   │   └── NPC.php        # NPC class
│   ├── Database/          # Database management
│   │   └── Database.php   # SQLite database
│   ├── Events/            # Event system
│   │   ├── Event.php      # Base event class
│   │   ├── EventManager.php
│   │   ├── HuntingEvent.php
│   │   ├── ExplorationEvent.php
│   │   └── FarmingEvent.php
│   └── api/               # API endpoints
│       ├── auth.php       # Authentication endpoints
│       └── game.php       # Game endpoints
├── assets/
│   ├── sprites/           # Sprite morphs
│   └── environments/      # Environmental images
├── data/                  # User data storage
│   └── users/             # Per-user save data
├── composer.json          # Project configuration
└── README.md             # This file

Features

User System

  • Email/password authentication
  • SQLite database storage with bcrypt password hashing
  • Per-user save files

Kobold System

  • Random stat generation (7 stats: Vitality, Intelligence, Fighting, Medicine, Crafting, Personality, Will)
  • Age-based stat scaling and sprite progression
  • Genetic inheritance (up to 3 levels: kobold, parents, grandparents)
  • Injuries with severity system
  • Items and stat modifications

Gameplay

  • Month-based turn system
  • Seasonal progression (spring, summer, autumn, winter)
  • Event system for player actions (hunting, exploration, farming, etc.)
  • Procedural story generation
  • NPC interactions (tribes and individuals)

Game Configuration

  • Enable/disable events per savefile
  • Enable/disable injury types per savefile

Requirements

  • PHP 7.4+
  • SQLite3
  • Modern web browser with ES6 support

Installation

1. Extract the project to your web server 2. Ensure data/ directory is writable 3. Access the game through your web server (e.g., http://localhost/tribegen)

The database will be automatically initialized on first access.

Development Notes

Adding New Events

1. Create a new event class in src/Events/:

namespace TribeGen\Events;

class MyEvent extends Event {
    public function execute() {
        $this->story = "Event story...";
        
        // Access tribe data
        $kobolds = $this->tribe->getAliveKobolds();
        
        // Modify tribe state
        foreach ($kobolds as $kobold) {
            // Event logic
        }
        
        return $this->story;
    }
}

2. Register the event in EventManager::registerEventClasses()

Adding New Stats

1. Add the stat name to Kobold::$statNames array 2. Update database schema if modifying existing saves 3. The stat system will automatically include the new stat in checks

Adding New Injuries

1. Create injury types with categories in your events 2. Register them in the database 3. Users can enable/disable them in config screen

Sprite System

Each sprite morph is a folder containing:

  • egg.png - Egg sprite
  • baby.png - Baby sprite
  • young.png - Young sprite
  • adult.png - Adult sprite
  • old.png - Old sprite
  • metadata.json - Morph information

The transformSprite() method should be implemented to apply pixel-level modifications for individual kobolds.

Game Loop

1. User creates new save or loads existing save 2. Initial tribe setup (select leader, choose 5 members) 3. Game begins showing the current month 4. Player can initiate events or pass 5. On month end, random events occur based on season 6. Kobolds age, potentially gaining old-age injuries 7. Game continues until all kobolds die

License

TBD