Skip to content

Repository files navigation

Le Monde 🌍

Le Monde is an evolutionary simulation game built with C++20 that explores artificial life through genetic algorithms and physics-based interactions. Watch as creatures evolve, adapt, and compete for survival in a dynamically generated world.

🎮 Features

Core Simulation

  • Physics-Based World: Powered by Box2D for realistic creature movement and collisions
  • Genetic Algorithm Evolution: Creatures evolve over generations using NEAT (NeuroEvolution of Augmenting Topologies)
  • Dynamic Terrain: Procedurally generated world with different tile types (dirt, water)
  • Real-time Visualization: Built with Raylib for smooth 60fps graphics

Creature Types

  • Piki: Smaller, agile creatures with 180° vision and moderate energy consumption
  • Aiko: Larger, more powerful creatures with focused 120° vision and higher energy capacity

Ecosystem Features

  • Energy System: Creatures must manage energy for survival and reproduction
  • Vision System: Creatures can see and react to their environment within their vision range
  • Plant Life: Plants grow and produce fruits that creatures can consume for energy
  • Population Limits: Balanced ecosystem with limits on creatures and resources

Technical Features

  • Modern C++20: Clean, efficient codebase using latest C++ standards
  • ImGui Interface: Interactive GUI for monitoring and controlling the simulation
  • Chunk-Based World: Efficient world management for large-scale simulations
  • Configurable Parameters: Easy-to-modify constants for tweaking simulation behavior

🛠️ Requirements

  • C++20 compatible compiler (GCC 10+, Clang 12+, MSVC 2019+)
  • CMake 3.15 or higher
  • vcpkg package manager

📦 Dependencies

The project uses the following libraries (managed via vcpkg):

  • Raylib (≥5.5) - Graphics and input handling
  • RayGUI (≥4.0) - GUI components
  • Box2D (≥3.1.0) - Physics simulation
  • ImGui (≥1.91.9) - Advanced GUI interface
  • fmt - String formatting
  • libnoise - Procedural noise generation
  • Google Test (≥1.17.0) - Unit testing

🚀 Building

1. Install vcpkg

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh  # Linux/macOS
# or
./bootstrap-vcpkg.bat  # Windows

2. Install Dependencies

./vcpkg install --triplet=x64-linux  # Linux
# or
./vcpkg install --triplet=x64-osx    # macOS
# or
./vcpkg install --triplet=x64-windows # Windows

3. Configure and Build

# Configure with CMake preset
cmake --preset=default

# Build the project
cmake --build build --config Release

# Run the simulation
./build/le_monde

🎯 Usage

Basic Controls

  • Mouse: Pan around the world by dragging
  • Scroll: Zoom in/out to observe creatures up close or get a world overview
  • GUI Panel: Monitor population statistics, energy levels, and generation progress

Simulation Parameters

Key parameters can be modified in src/constants.hpp:

// World configuration
WORLD_SIZE{4000.0, 4000.0}     // World dimensions
TILE_SIZE{16.0, 16.0}          // Terrain tile size

// Creature limits
MAX_CREATURES = 200            // Maximum creature population
MAX_FRUITS = 2000             // Maximum fruit count

// Piki creature stats
PIKI_MAX_ENERGY = 40.0        // Maximum energy capacity
PIKI_VISION_RANGE = 1000.0    // How far they can see
PIKI_VISION_ANGLE = 180.0     // Field of view in degrees

🧬 How Evolution Works

  1. Initial Population: Creatures spawn with random neural networks
  2. Survival: Creatures must find food and avoid dangers to survive
  3. Reproduction: Successful creatures reproduce, passing on their neural networks
  4. Mutation: Offspring have slight variations in their neural networks
  5. Selection: Better-adapted creatures are more likely to survive and reproduce
  6. Iteration: The cycle continues, leading to increasingly sophisticated behaviors

📁 Project Structure

le-monde-c/
├── src/
│   ├── main.cpp              # Application entry point
│   ├── world.cpp/hpp         # World management and generation
│   ├── ga_manager.cpp/hpp    # Genetic algorithm coordination
│   ├── entities/             # Game entities
│   │   ├── creatures/        # Creature implementations
│   │   │   ├── piki.cpp/hpp
│   │   │   └── creature.cpp/hpp
│   │   ├── tiles/            # Terrain tile types
│   │   └── spawner.cpp/hpp   # Creature spawning system
│   ├── gui/                  # User interface
│   └── constants.hpp         # Simulation parameters
├── libs/                     # Independent libraries (MIT Licensed)
│   ├── libgame/             # Game engine utilities
│   │   ├── LICENSE          # MIT License
│   │   ├── README.md        # Library documentation
│   │   └── src/             # Game utilities and Raylib integration
│   └── libneatga/           # NEAT genetic algorithm implementation
│       ├── LICENSE          # MIT License
│       ├── README.md        # Algorithm documentation
│       └── src/             # NEAT algorithm code
├── CMakeLists.txt           # Build configuration
├── vcpkg.json              # Dependency specification
└── LICENSE.md              # Le Monde Research License

📄 Licensing

Le Monde uses a multi-license approach to balance community contribution with project protection:

🏗️ Component Licenses

Component License Use Cases
libgame MIT License ✅ Any project (including commercial)
libneatga MIT License ✅ Any project (including commercial)
Le Monde Application Le Monde Research License 🎓 Educational & Research use

🎓 Le Monde Application License

The complete Le Monde simulation is available under the Le Monde Research License v1.0:

✅ Permitted Uses:

  • Educational institutions and students
  • Academic research and publications
  • Personal learning and experimentation
  • Non-commercial research projects

❌ Restrictions:

  • Commercial distribution or sale
  • Use in commercial products/services
  • Revenue-generating applications

🔓 MIT Licensed Libraries

The core libraries can be used freely in any project:

  • libgame: Game development utilities, Raylib integration, camera systems
  • libneatga: Complete NEAT genetic algorithm implementation

These libraries are designed to be valuable standalone components for the broader development community.

💼 Commercial Use

For commercial applications:

  • Libraries: Use freely under MIT License
  • Complete Application: Contact us for commercial licensing terms

See LICENSE.md for complete terms and conditions.

🤝 Contributing

Contributions are welcome! Here are some areas where you can help:

  • New Creature Types: Implement new species with unique behaviors
  • Environmental Features: Add weather, seasons, or natural disasters
  • Performance Optimization: Improve simulation speed for larger populations
  • Visualization: Enhanced graphics, charts, or analysis tools
  • Documentation: Improve code documentation and examples

Contributing to Libraries

The MIT-licensed libraries especially welcome contributions:

  • libgame: Game utilities, graphics improvements, new features
  • libneatga: Algorithm optimizations, new mutation operators

Contributing Guidelines

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Submit a pull request
  5. Follow our coding standards and respect backward compatibility

All contributions will be licensed under the same terms as the component you're contributing to.

🔬 Research Applications

Le Monde can be used for:

  • Evolutionary Biology Research: Study emergence of complex behaviors
  • AI Development: Test neural network evolution strategies
  • Game Development: Learn about ecosystem simulation techniques
  • Educational Purposes: Demonstrate principles of artificial life and evolution

📚 References

Core Technologies

  • Raylib - A simple and easy-to-use library to enjoy videogames programming
  • Box2D - A 2D physics engine for games
  • Dear ImGui - Bloat-free graphical user interface library for C++
  • vcpkg - C/C++ dependency manager from Microsoft
  • CMake - Cross-platform build system generator

Libraries and Dependencies

  • fmt - A modern formatting library for C++
  • GoogleTest - Google's C++ testing and mocking framework
  • libnoise - A portable, open-source, coherent noise-generating library for C++

Algorithms and Concepts

Academic Papers

Inspiration and Related Work

  • The Bibites - Léo Caussan's artificial life simulation with evolving neural network creatures
  • Tierra - Thomas S. Ray's artificial life simulator
  • Avida - Digital evolution research platform
  • OpenAI Gym - Toolkit for developing and comparing reinforcement learning algorithms
  • NEAT-Python - Python implementation of NEAT algorithm

Happy Simulating! 🧬✨

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages