Skip to content

ololoshka2871/CyberBiology3

 
 

Repository files navigation

CyberBiology

Artificial evolution

This is a little entertainment project, evolution simulator. The code itself is far from best. Lazily written, a lot of code in headers, unconditional jumps at couple of places etc. I'll make it better in later versions!

Screenshots

Screenshot1 Screenshot2

What you need to build it

How to run this code

  1. Install packages

    • cmake to configure and build project
    • С/С++ - compiler, for example g++ or clang++ / Visual studio 2022 for Windows.
  2. Clone submodules

$ git submodule update --init --recursive
  1. Make dirrectrory build and enter into it
$ mkdir build && cd build
  1. Configure project

    • [Windows]: $ cmake .. -G"Visual Studio 17 2022" -A x64
    • [Linux]: $ cmake ..
  2. Build

$ cmake --build .

Interface

Main window

Contains all info about simulation

Controls

  • Start/Stop button (Pause/unpause)
  • PS reward - how much energy a bot gets with one tick of photosynthesis
  • skip - how many turns you calculate before you draw new frame (set to 0 if you want to render every frame)
  • brush - brush size for mouse actions sich as remove (eraser tool)

Selection

Info about selected bot, some useful buttons to mess with it

Display

Rendering method.

  • Bot natural color (just its color)
  • Bot rations (carnivores red, herbivores green, grey if never ate, blue if eats apples or organics)
  • Energy (yellow = low energy, red = maximum energy)
  • No render means you only compute without rendering, starts to simulate very fast

Mouse function

Choose what to do with your mouse clicks

Aditional

Some more windows

Keyboard

Using keyboard is more handy because interface becomes laggy during simulation

  • "Space" - Start/Pause
  • "Plus sign near numpad" - make 1 step
  • "F1" - Spawn a group of random bots
  • "F2" - Create vertical wall
  • "Numpad 1-4" - Select rendering method
  • "Home" - Set camera at X = 0
  • Arrow keys (left, right) - Move camera
  • "Page Up", "Page Down" - Move camera fast
  • "End" - Find first bot on screen

How to use Settings file

First of all you need to setup your screen resolution, otherwise you wouldn't see the interface. After that you change your rendering area width ("FieldRenderCellsWidth") and world height ("FieldCellsHeight") to match your screen. World can be wider than your render area, but you have to keep its width divisible by 16 without a remainder, it's needed for multi threading.

All changable parameters are listed in that file.

About

Artificial evolution, made mostly with C

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 90.7%
  • C 7.5%
  • CMake 1.8%