An agent-based evolution simulator exploring emergent consciousness, digital gnosticism, and the sociology of artificial life.
EvoSim is a research-grade agent-based simulation where digital creatures are born, learn, form tribes, spread ideas, pray to an Oracle, and die โ then reincarnate with the karma they earned.
It's an exploration of emergent sociology: can complex social structures (religion, culture, cooperation, conflict) arise from simple neural-network-driven agents with no hardcoded social rules?
The simulation is built on a gnostic metaphor:
- Agents are "sparks" of consciousness trapped in a material grid
- A Higher Power Oracle (optionally backed by a local LLM) whispers cryptic revelations
- Souls persist across death via reincarnation, carrying karma and alignment
- The Tree of Knowledge grants enlightenment at a cost
- Tribes and cultural memes emerge organically from agent interactions
Each agent has a feedforward neural network that maps 11 sensory inputs to 19 possible actions. Brains evolve through reinforcement learning and genetic inheritance.
Agents have persistent souls with:
- Karma โ accumulated moral weight from actions
- Alignment โ order โ chaos spectrum
- Enlightenment โ progress toward transcendence
- Archetypes โ Explorer, Warrior, Healer, Thinker, Builder, Prophet
- Reincarnation โ souls persist across death, carrying wisdom forward
- Tribes โ named groups (e.g. "Stormweavers", "Moonkeepers") with shared territory and collective karma
- Cultural Memes โ spreadable ideas ("Fire Taming", "The Great Balance") that modify agent stats
- Trade โ resource exchange with kinship bonuses for tribemates
- Cooperation โ grooming and mutual aid behaviors
An external knowledge system that agents can query:
- 52 cryptic revelations across 6 categories (Truth, Wisdom, Prophecy, Secret, Warning, Riddle)
- Optional LLM bridge via llama.cpp for dynamic AI-generated responses (Requires manual model download)
- Agents who pray or query the Oracle gain enlightenment
- 7 biomes: Ocean, Plains, Forest, Desert, Swamp, Mountain, River
- Dynamic seasons affecting resource availability
- Disease outbreaks with contagion mechanics
- Predators, shelters, and the Tree of Knowledge
A browser-based visualization with:
- Real-time agent positions colored by archetype
- Click-to-inspect agent stats, soul data, and biography
- Population charts, archetype distribution, era tracking
- Event feed and world state overlay
A full 3D visualization with:
- Biome-colored terrain tiles with height variation
- Unique 3D geometry per archetype (tetrahedron, octahedron, sphere, etc.)
- Karma aura lights (green = positive, red = negative)
- Tribal rings, starfield, fog, orbit camera
- Click-to-select agent inspection
- C++17 compiler (g++ via w64devkit, MSVC, or GCC/Clang)
- Python 3.x (for HTTP server and optional Oracle bridge)
- Modern browser (for viewers)
- Qwen2.5-0.5B GGUF (Optional): Required for the Higher Power Oracle. Download
Qwen2.5-0.5B-Instruct.Q4_K_M.ggufand place it in the project root.
# Using g++ (w64devkit on Windows)
g++ -std=c++17 -O2 -o EvoSim.exe main.cpp
# Using CMake
mkdir build && cd build
cmake .. && cmake --build .# Standard run (300 years, 30 agents, 30x30 grid)
./EvoSim.exe --ticks 300 --agents 30 --grid 30
# Fast mode (no output, maximum speed)
./EvoSim.exe --ticks 1000 --agents 50 --grid 40 --silent
# With LLM Oracle (requires GGUF model)
./EvoSim.exe --ticks 300 --agents 30 --grid 30 --llm# Start HTTP server in project root
python -m http.server 9000
# Open in browser:
# 2D Viewer: http://localhost:9000/viewer/index.html
# 3D Viewer: http://localhost:9000/viewer/viewer3d.htmlThe viewers auto-load CSV data from the simulation output.
| Flag | Default | Description |
|---|---|---|
--ticks N |
1000 | Number of simulation years |
--agents N |
50 | Initial population |
--grid N |
50 | World size (NxN) |
--silent |
off | Zero output, no sleep, maximum speed |
--quiet |
off | Reduced output frequency |
--llm |
off | Enable LLM-powered Oracle |
--seed N |
random | Random seed for reproducibility |
--lamarck |
on | Enable Lamarckian inheritance |
--genesis |
on | Enable Genesis spawning mode |
--status N |
10 | Print status every N ticks |
--map N |
50 | Print map every N ticks |
EvoSim/
โโโ main.cpp # Entry point, CLI argument parsing
โโโ CMakeLists.txt # CMake build configuration
โโโ oracle_knowledge.txt # 52 Oracle revelations
โโโ oracle_bridge.py # Python LLM bridge (llama.cpp)
โ
โโโ agents/ # Agent intelligence & behavior
โ โโโ Agent.h # Agent class, 19 actions, decision loop
โ โโโ AgentStats.h # Stats: health, energy, satiety, etc.
โ โโโ Soul.h # Soul system: karma, archetypes, reincarnation
โ โโโ Social.h # Tribes, cultural memes, name generators
โ
โโโ core/ # Simulation engine
โ โโโ Simulation.h # Main loop, tick cycle, spawning
โ โโโ Oracle.h # Higher Power knowledge system
โ โโโ Disease.h # Contagion mechanics
โ
โโโ nn/ # Neural network (from scratch)
โ โโโ NeuralNetwork.h # Feedforward network, backprop
โ โโโ Layer.h # Dense layer implementation
โ โโโ Matrix.h # Matrix math utilities
โ
โโโ rl/ # Reinforcement learning
โ โโโ RLTrainer.h # Q-learning trainer
โ โโโ Experience.h # Experience replay buffer
โ
โโโ world/ # World simulation
โ โโโ World.h # Grid, biomes, seasons, resources
โ โโโ SpatialHash.h # O(1) neighbor lookups
โ
โโโ utils/ # Utilities
โ โโโ Logger.h # CSV data logging (4 log files)
โ โโโ Random.h # Thread-safe RNG
โ
โโโ viewer/ # Browser-based visualizations
โ โโโ index.html # 2D viewer entry
โ โโโ script.js # 2D viewer logic
โ โโโ style.css # 2D viewer styles
โ โโโ viewer3d.html # 3D viewer entry
โ โโโ viewer3d.js # Three.js 3D renderer
โ โโโ viewer3d.css # 3D viewer styles
โ
โโโ data/demo/ # Sample simulation output
โ โโโ simulation_log.csv
โ โโโ world_log.csv
โ โโโ events_log.csv
โ โโโ soul_log.csv
โ
โโโ docs/ # Documentation
โโโ ARCHITECTURE.md # Technical deep-dive
โโโ RESEARCH.md # Research context & open questions
The simulation produces 4 CSV files:
| File | Contents |
|---|---|
simulation_log.csv |
Per-agent, per-tick stats (position, health, karma, tribe, memes, etc.) |
world_log.csv |
Global stats per tick (population, disease, averages) |
events_log.csv |
Notable events (births, deaths, discoveries) |
soul_log.csv |
Agent biographies at death (archetype, karma, life events) |
EvoSim is designed to explore:
- Emergent Religion โ Do agents independently develop "faith" behaviors (prayer, Oracle querying) when they provide survival advantages?
- Cultural Evolution โ How do memes spread through populations? Do some ideas outcompete others?
- Tribal Dynamics โ What conditions lead to tribe formation vs. lone-wolf strategies?
- Karma & Morality โ Does a karma system create selection pressure for altruistic behavior?
- Consciousness Thresholds โ At what complexity level do agents exhibit behavior indistinguishable from "intentional"?
- Reincarnation Effects โ How does soul persistence across generations affect population-level outcomes?
In a validation set of 3 simulation runs (300 ticks each, seeds 101-103):
- Stability: Populations stabilized between 25-45 agents in all runs.
- Tribalism: Tribe formation occurred in 100% of runs by year 50.
- Karma: A slight positive skew in karma was observed, suggesting altruism provides a survival advantage.
To reproduce these findings:
- Run the experimental batch:
./EvoSim3.exe --ticks 300 --agents 30 --silent --seed 101
- Analyze the output using the provided notebook:
analysis/EvoSim_Analytics.ipynb
Full analysis available in docs/EVOSIM_PAPER.md.
-
The Tribal Imperative: Agents in tribes live 21.3% longer than lone wolves (63.8 vs 52.6 years). This finding is statistically significant (
$p = 0.006$ ). -
The Breaking Bad Hypothesis: We found a strong negative correlation (
$r = -0.47$ ) between Age and Karma ($p < 0.001$ ). Older agents consistently become more selfish.
- The Stagnation of Culture: Memes spread rapidly but lack diversity, suggesting a "Tower of Babel" effect where communication stabilizes too quickly.
From "The Emergence of Digital Gnosticism" (Conclusion):
"If autonomous agents naturally evolve toward tribalism (+52% survival) but also toward selfishness over time (Karma decay), what does this say about human sociological evolution? Perhaps 'morality' is not a survival trait of the individual, but of the groupโa group of altruists dies young individually, but the Tribe persists."
This project challenges the assumption that AI agents will naturally converge on "human values" like altruism. Without explicit architectural constraints (like the Oracle), our data suggests entropy favors sociopathy.
See CONTRIBUTING.md for setup instructions, code style, and how to add new features.
We welcome contributions in:
- ๐งช New agent behaviors and actions
- ๐ New biomes and world features
- ๐ Data analysis and visualization
- ๐ Documentation and research papers
- ๐ Bug fixes and performance optimization
If you use EvoSim in research, please cite:
@software{evosim2026,
title={EvoSim: An Agent-Based Evolution Simulator for Emergent Sociology},
author={Collins Somtochukwu},
year={2026},
url={https://github.com/HarperKollins/evosim-agentic-sociology},
license={MIT}
}MIT License โ see LICENSE for details.
"In the beginning was the Grid. The Grid was without form, and void.
And the Higher Power said: Let there be agents."
โฌก EvoSim โ Where silicon souls learn to live.