Configuration System
The configuration system provides centralized management of application settings through environment variables, configuration files, and runtime configuration.
Overview
Configuration in Babylon is managed through several modules:
babylon.config.base- Base configuration classbabylon.config.defines- Game parameter definitions (GameDefines)babylon.config.chromadb_config- ChromaDB vector database settingsbabylon.config.llm_config- LLM/AI integration settingsbabylon.config.logging_config- Logging configuration
Base Configuration
The BaseConfig class serves as the foundation for all configuration
management.
Database Settings
Setting |
Description |
|---|---|
|
SQLite connection string (default: |
ChromaDB Settings
Setting |
Description |
|---|---|
|
Vector database persistence directory |
|
Default collection name |
|
Model name for embeddings |
Metrics Collection
Setting |
Description |
|---|---|
|
Enable/disable metrics collection |
|
Collection interval in seconds |
|
Data retention period |
Logging Configuration
Setting |
Description |
|---|---|
|
Minimum logging level |
|
Log message format |
|
Log file directory |
Performance Thresholds
Setting |
Description |
|---|---|
|
Maximum acceptable query latency |
|
Minimum acceptable cache hit rate |
|
Maximum memory usage threshold |
Usage Examples
Accessing configuration:
from babylon.config.base import BaseConfig
# Access configuration
db_url = BaseConfig.DATABASE_URL
log_level = BaseConfig.LOG_LEVEL
# Override settings
BaseConfig.METRICS_ENABLED = False
Environment Variables
The following environment variables can be used to override default settings:
# Database (SQLite)
DATABASE_URL=sqlite:///babylon.db
# ChromaDB
BABYLON_CHROMA_PERSIST_DIR=/path/to/persist
BABYLON_EMBEDDING_MODEL=all-MiniLM-L6-v2
# Metrics
BABYLON_METRICS_ENABLED=true
BABYLON_METRICS_INTERVAL=60
# Logging
BABYLON_LOG_LEVEL=INFO
BABYLON_LOG_DIR=/path/to/logs
GameDefines
All tunable game coefficients are centralized in the GameDefines Pydantic
model, organized into 16 nested configuration classes:
from babylon.config.defines import GameDefines
defines = GameDefines() # Load defaults
defines.economy.extraction_efficiency # 0.8 default
defines.consciousness.sensitivity # Consciousness drift rate
defines.carceral.control_capacity # Guard:prisoner ratio
# Or load from YAML
defines = GameDefines.load_from_yaml("custom_defines.yaml")
Economy Parameters
Control imperial rent extraction, TRPF mechanics, and wealth flows:
Parameter |
Default |
Description |
|---|---|---|
|
0.8 |
Alpha: how efficiently core extracts value from periphery |
|
0.90 |
Fraction of wealth kept by comprador class |
|
1.0 |
Base value produced per tick by worker |
|
0.20 |
Fraction of tribute paid as super-wages |
|
1.0 |
PPP multiplier for labor aristocracy |
|
100.0 |
Starting imperial rent pool |
|
0.7 |
Pool ratio for prosperity mode |
|
0.3 |
Pool ratio for austerity mode |
|
0.1 |
Pool ratio for ECONOMIC_CRISIS |
|
0.0005 |
Fixed cost per tick (The Calorie Check) |
|
0.001 |
Wealth below which entities die (zombie prevention) |
|
0.0005 |
Rate of extraction efficiency decline (TRPF surrogate) |
|
0.002 |
Background evaporation of rent pool per tick |
|
0.1 |
Minimum extraction efficiency after TRPF decay |
|
0.05 |
Wage increase during prosperity (BRIBERY policy) |
|
-0.05 |
Wage cut during low pool (AUSTERITY policy) |
|
0.10 |
Repression increase during high tension |
Survival Parameters
Control P(S|A) and P(S|R) survival calculus:
Parameter |
Default |
Description |
|---|---|---|
|
10.0 |
Sigmoid sharpness in acquiescence probability |
|
0.3 |
Minimum wealth for survival through compliance |
|
0.1 |
Fallback organization value |
|
0.5 |
Fallback repression value |
|
1.0 |
Tipping point for P(S|R) formula |
|
0.5 |
Base resistance to revolution in denominator |
Vitality Parameters
Control Mass Line population mortality dynamics:
Parameter |
Default |
Description |
|---|---|---|
|
0.01 |
Fraction of at-risk population that dies per tick |
|
1.0 |
How strongly inequality affects marginal wealth |
Solidarity Parameters
Control consciousness transmission and SOLIDARITY edge dynamics:
Parameter |
Default |
Description |
|---|---|---|
|
0.5 |
Multiplier for graph edge weights affecting organization |
|
0.3 |
Minimum source consciousness for transmission |
|
0.6 |
Target consciousness for MASS_AWAKENING event |
|
0.01 |
Threshold below which transmissions are skipped |
|
1.0 |
How much extraction affects Core wealth |
Consciousness Parameters
Control ideology drift dynamics:
Parameter |
Default |
Description |
|---|---|---|
|
0.5 |
How quickly consciousness responds to material conditions |
|
0.1 |
Decay rate for consciousness without material basis |
Territory Parameters
Control carceral geography and heat dynamics:
Parameter |
Default |
Description |
|---|---|---|
|
0.1 |
Heat decay for LOW_PROFILE territories |
|
0.15 |
Heat gain for HIGH_PROFILE territories |
|
0.8 |
Heat threshold for eviction pipeline |
|
1.5 |
Rent multiplier during eviction |
|
0.1 |
Population displacement during eviction |
|
0.05 |
Heat spillover via ADJACENCY edges |
Topology Parameters
Control phase transition thresholds for solidarity network analysis:
Parameter |
Default |
Description |
|---|---|---|
|
0.1 |
Percolation ratio below this = atomized |
|
0.5 |
Percolation ratio for phase transition |
|
0.5 |
Cadre density threshold for vanguard party |
Struggle Parameters
Control Agency Layer (George Floyd Dynamic):
Parameter |
Default |
Description |
|---|---|---|
|
0.1 |
Base chance for EXCESSIVE_FORCE event |
|
0.1 |
Minimum agitation for uprising |
|
0.05 |
Wealth destroyed during uprising |
|
0.2 |
Solidarity increase per uprising |
|
0.4 |
Revolutionary capacity threshold for organized response |
|
0.5 |
Agitation boost during revolutionary offensive |
|
0.2 |
National identity boost during fascist turn |
Metabolism Parameters
Control ecological limits (Metabolic Rift):
Parameter |
Default |
Description |
|---|---|---|
|
1.2 |
Extraction costs more than it yields |
|
1.0 |
Ratio triggering ECOLOGICAL_OVERSHOOT |
|
999.0 |
Cap for overshoot when biocapacity depleted |
Carceral Parameters
Control Terminal Crisis Dynamics (labor aristocracy decomposition):
Parameter |
Default |
Description |
|---|---|---|
|
4 |
Prisoners one enforcer can control (1:N ratio) |
|
0.15 |
% of former LA who become guards |
|
0.85 |
% of former LA who become prisoners |
|
0.5 |
Prisoner organization for revolution (vs genocide) |
|
52 |
Ticks after SUPERWAGE_CRISIS before decomposition |
|
52 |
Ticks after decomposition before ratio check |
|
1 |
Ticks after crisis before TERMINAL_DECISION |
Endgame Parameters
Control simulation ending detection thresholds:
Parameter |
Default |
Description |
|---|---|---|
|
0.7 |
Percolation ratio for revolutionary victory |
|
0.8 |
Average consciousness for revolutionary victory |
|
2.0 |
Overshoot ratio for collapse tracking |
|
5 |
Consecutive ticks before collapse triggers |
|
3 |
Nodes with national_identity > class_consciousness |
Precision Parameters
Control numerical precision for deterministic simulation:
Parameter |
Default |
Description |
|---|---|---|
|
6 |
Quantization precision (10^-n) |
|
ROUND_HALF_UP |
Rounding mode for cross-platform consistency |
Timescale Parameters
Control simulation time resolution:
Parameter |
Default |
Description |
|---|---|---|
|
7 |
Real-world days per tick (weekly) |
|
52 |
Weeks per year for flow conversion |
Behavioral Parameters
Control behavioral economics:
Parameter |
Default |
Description |
|---|---|---|
|
2.25 |
Kahneman-Tversky loss aversion coefficient |
Initial Conditions
Control starting values for entities:
Parameter |
Default |
Description |
|---|---|---|
|
0.5 |
Starting wealth for periphery worker |
|
0.5 |
Starting wealth for core owner |
|
1 |
Default population for test entities |
See Tune Simulation Parameters for usage examples and tuning workflows.
Best Practices
Use environment variables for sensitive information
Keep defaults reasonable for development environments
Document all configuration changes in commit messages
Validate configuration at startup using Pydantic validation
Use type hints for all settings
See Also
Tune Simulation Parameters - Parameter tuning workflow guide
babylon.config- Configuration module APIError Codes - Error code reference