A genetic algorithm-based life simulation where organisms navigate a digital ecosystem, compete for resources, and evolve through genetic inheritance. Watch as digital entities develop behaviors through genome-driven decision-making.
MicroWorld is a real-time simulation of artificial organisms controlled by genetic algorithms. Each entity is a small creature with a 64-byte genome that encodes behaviors such as movement, energy consumption, reproduction, and predation. The simulation demonstrates how environmental pressures and genetic traits influence population dynamics.
Each organism is controlled by a 64-byte genome that dictates its behavioral decisions:
- Rotation & Movement - Navigate through the environment based on genetic instructions
- Sensing - Look ahead to detect obstacles, food, and other entities
- Photosynthesis - Passively generate energy from the environment
- Predation - Hunt and consume other organisms for energy
- Reproduction - Create offspring when sufficient energy is accumulated
- Grid-based World - entity cells in a 1280×720 pixel environment
- Energy Systems:
- Light Energy - Available through photosynthesis
- Organic Energy - Obtained by consuming other entities
- Division Energy - Required to reproduce
- Entity Relationships - Track friends (relatives), enemies, and empty spaces
- Collision Detection - Environmental boundaries and entity interactions
Organisms can:
- Look ahead at adjacent positions to sense their surroundings
- Identify empty cells, walls, relatives, and enemies
- React to detected entities based on genetic programming
- Multiple Phenotypes - Pre-configured genome patterns create different organism types (herbivores, hunters, standard)
- Random Mutations - Each organism starts with a randomized genome
- Heredity - Offspring inherit genetic traits from their parent
- Population Tracking - Monitor alive, dead, and total entity counts in real-time
- Natural Selection - Organisms that fail to adapt die, pruning unsuccessful strategies
The simulation includes several starter genotypes:
- Passive Organism - Relies on photosynthesis
- Hunter - Aggressive predatory behavior
- Left-turning, Top-turning, Right-turning, Bottom-turning - Directional movement patterns
- Initialization - The simulation starts with 3 randomly-generated organisms
- Genome Execution - Each step, active organisms execute genetic instructions (up to 10 steps per cycle)
- Energy Management - Actions consume energy; reproduction and death manage population
- Real-time Feedback - Console displays live counts: Alive, Dead, and Total entities
- Game Over Condition - Simulation ends when all organisms die or only one type remains
Each behavior in the genome can be triggered by instruction codes:
- Rotate - Change facing direction (up, down, left, right)
- Move - Advance in current direction
- Look - Sense adjacent cells for resources and entities
- Photosynthesis - Gain light energy passively
- Division - Reproduce when energy threshold is met
- Eat - Consume encountered organisms
- C++ compiler (Visual Studio recommended for .vcxproj)
- SFML graphics library
- Standard C++ library





