- Core engine: simulator, game mechanics, triggers (138 tests) - Fog-of-war per-player state tracking - Meeting flow: interrupt, discussion, voting, consolidation - Prompt assembler with strategy injection tiers - LLM client with fallbacks for models without JSON/system support - Prompt templates: action, discussion, voting, reflection - Full integration in main.py orchestrator - Verified working with free OpenRouter models (Gemma)
1.6 KiB
1.6 KiB
Development Guide
Running Tests
# All tests
python3 -m unittest discover -v tests/
# Specific test file
python3 -m unittest tests/test_game.py -v
# Specific test
python3 -m unittest tests.test_game.TestKill.test_successful_kill
Adding New Triggers
- Add trigger type to
src/engine/triggers.py:
class TriggerType(Enum):
NEW_TRIGGER = auto()
- Add to appropriate category:
STANDARD_TRIGGERS = {..., TriggerType.NEW_TRIGGER}
- Fire trigger in game engine:
self._fire_trigger(TriggerType.NEW_TRIGGER, agent_id, {"data": "value"})
Adding New Actions
- Add action handler in
src/engine/game.py:
def _handle_new_action(self, player_id: str, params: dict) -> dict:
# Validate + execute
return {"success": True, "action": "NEW_ACTION"}
-
Add to
_execute_actionswitch. -
Add to priority order in
resolve_actions.
Adding New Maps
Create JSON in data/maps/:
{
"rooms": [
{
"id": "room_id",
"name": "Display Name",
"tasks": [{"id": "task_id", "name": "Task Name", "duration": 3.0}],
"vent": {"id": "vent_id", "connects_to": ["other_vent"]}
}
],
"edges": [
{"id": "edge_id", "room_a": "room1", "room_b": "room2", "distance": 5.0}
]
}
Environment Variables
| Variable | Purpose |
|---|---|
OPENROUTER_API_KEY |
LLM API authentication |
Code Style
- Python 3.10+ features (type hints, dataclasses)
- JSON for all config (YAML optional, falls back to JSON)
- Tests mirror source structure (
src/engine/game.py→tests/test_game.py)