BlueGit

blue-star tribegen

Files

tribegen / web / README.md

README.md

farming
timfa Tim · pushed by timfa · 9 months ago
569cc974 History
README.md 4.5 KiB Download Raw

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

Source
1# TribeGen - Kobold Tribe Management Game
2
3A 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.
4
5## Project Structure
6
7```
8tribegen/
9├── public/ # Web-accessible files
10│ ├── index.php # Main entry point
11│ ├── index.html # SPA template
12│ ├── css/
13│ │ └── style.css # Main stylesheet
14│ └── js/
15│ └── app.js # Frontend application
16├── src/
17│ ├── Classes/ # Core game classes
18│ │ ├── User.php # User authentication
19│ │ ├── Kobold.php # Kobold character class
20│ │ ├── Tribe.php # Tribe management
21│ │ ├── Item.php # Item class
22│ │ ├── Injury.php # Injury class
23│ │ └── NPC.php # NPC class
24│ ├── Database/ # Database management
25│ │ └── Database.php # SQLite database
26│ ├── Events/ # Event system
27│ │ ├── Event.php # Base event class
28│ │ ├── EventManager.php
29│ │ ├── HuntingEvent.php
30│ │ ├── ExplorationEvent.php
31│ │ └── FarmingEvent.php
32│ └── api/ # API endpoints
33│ ├── auth.php # Authentication endpoints
34│ └── game.php # Game endpoints
35├── assets/
36│ ├── sprites/ # Sprite morphs
37│ └── environments/ # Environmental images
38├── data/ # User data storage
39│ └── users/ # Per-user save data
40├── composer.json # Project configuration
41└── README.md # This file
42
43```
44
45## Features
46
47### User System
48- Email/password authentication
49- SQLite database storage with bcrypt password hashing
50- Per-user save files
51
52### Kobold System
53- Random stat generation (7 stats: Vitality, Intelligence, Fighting, Medicine, Crafting, Personality, Will)
54- Age-based stat scaling and sprite progression
55- Genetic inheritance (up to 3 levels: kobold, parents, grandparents)
56- Injuries with severity system
57- Items and stat modifications
58
59### Gameplay
60- Month-based turn system
61- Seasonal progression (spring, summer, autumn, winter)
62- Event system for player actions (hunting, exploration, farming, etc.)
63- Procedural story generation
64- NPC interactions (tribes and individuals)
65
66### Game Configuration
67- Enable/disable events per savefile
68- Enable/disable injury types per savefile
69
70## Requirements
71
72- PHP 7.4+
73- SQLite3
74- Modern web browser with ES6 support
75
76## Installation
77
781. Extract the project to your web server
792. Ensure `data/` directory is writable
803. Access the game through your web server (e.g., `http://localhost/tribegen`)
81
82The database will be automatically initialized on first access.
83
84## Development Notes
85
86### Adding New Events
87
881. Create a new event class in `src/Events/`:
89```php
90namespace TribeGen\Events;
91
92class MyEvent extends Event {
93 public function execute() {
94 $this->story = "Event story...";
95
96 // Access tribe data
97 $kobolds = $this->tribe->getAliveKobolds();
98
99 // Modify tribe state
100 foreach ($kobolds as $kobold) {
101 // Event logic
102 }
103
104 return $this->story;
105 }
106}
107```
108
1092. Register the event in `EventManager::registerEventClasses()`
110
111### Adding New Stats
112
1131. Add the stat name to `Kobold::$statNames` array
1142. Update database schema if modifying existing saves
1153. The stat system will automatically include the new stat in checks
116
117### Adding New Injuries
118
1191. Create injury types with categories in your events
1202. Register them in the database
1213. Users can enable/disable them in config screen
122
123### Sprite System
124
125Each sprite morph is a folder containing:
126- `egg.png` - Egg sprite
127- `baby.png` - Baby sprite
128- `young.png` - Young sprite
129- `adult.png` - Adult sprite
130- `old.png` - Old sprite
131- `metadata.json` - Morph information
132
133The `transformSprite()` method should be implemented to apply pixel-level modifications for individual kobolds.
134
135## Game Loop
136
1371. User creates new save or loads existing save
1382. Initial tribe setup (select leader, choose 5 members)
1393. Game begins showing the current month
1404. Player can initiate events or pass
1415. On month end, random events occur based on season
1426. Kobolds age, potentially gaining old-age injuries
1437. Game continues until all kobolds die
144
145## License
146
147TBD