NEUROSIM
A C++ neural evolution simulator
This program simulates neural evolution over generations through the goal of survival.
Please Note: This was inspired by David R. Miller’s simulator, and is just a quick project i wanted to write; It does not have very optimised / clean code.
Features
- Generational Simulator
- Neural Map Viewer / Visualiser
- Survival Condition Language
- Simulation of custom Neural Maps
Dependencies
Note: These are all included in the repo, and all (apart from FFMPEG) are statically linked into the program
- Premake – VS Project Generation
- SFML – Window/Image Rendering
- FFMPEG – Video Rendering
- mINI – INI Config Reading
- nodesoup – Fruchterman-Reingold graph positioning
- spdlog – Output logging
Program Usage
A compiled version of the program can be found in bin/Release-windows-x86_64/
Simulation
- Edit
config/config.ini
in the program directory to change the simulation parameters - Run
BioSim.exe
, optionally with the argument-c [.INI FILE]
Neural Map Visualisation
- Run
BioSim.exe
with the argument-v [.NM FILE]
Command Line Arguments
Argument | Description |
---|---|
-h |
Outputs program usage |
-s |
Simulate mode [DEFAULT] |
-v [*.nm] |
Visualise mode |
-c [*.ini] |
Specify configuration file [DEFAULT: config/config.ini ] |
-k [int] |
Set the Fruchterman-Reingold constant [DEFAULT: 400] |
Source
Note: You must have VS2022 installed to build from source
Project Setup
- Run
GenerateScripts.bat
to use premake to generate the Visual Studio 2022 project files - Open NeuralSim.sln
Brief Documentation
This documentation will be expanded in the future, and I may make a youtube video explaining how the simulator and visualiser works (as in more technical / code orientated detail than David Miller’s video)
Survival Condition
The survival condition is currently determined using bool HasSurvived(Cell cell)
in src/Classes/Generation.cpp
. This function is also used to colour the cells in the mp4 generation render (Output.cpp
– RenderFrame()
).
In the future, this will be expanded to use a custom programming language that can be written/generated and specified by the program user.
Receptors
Receptors are defined in a Receptor
enum in src/Classes/NeuralMap/Types.h
Receptor behaviour is defined in Cell::GetReceptorVal(NeuralNet::Receptor receptor)
in src/Classes/NeuralMap/Receptors.cpp
Receptor name strings are defined in receptorName(Receptor receptor)
in src/Classes/NeuralMap/DebugTypes.cpp
Effectors
Effectors are defined in an Effector
enum in src/Classes/NeuralMap/Types.h
Effector behaviour is defined in ProcessEffectorQueue(int owner)
in src/Classes/NeuralMap/Effectors.cpp
Effector name strings are defined in effectorName(Effector effector)
in src/Classes/NeuralMap/DebugTypes.cpp
The Visualiser long name strings are defined in shrtNodeToLong(std::string shrt)
in src/Visualise/Visualise.cpp
Current State
The main simulator and visualiser is finished. What’s mostly needed is optimisation, and a couple other features that make the program more fun to play around with.
Contribution
Most help is needed with optimisation, as I only have ~1 years experience with C++, and there will be many slow operations and calls that I wrote without realising how slow they are. I also dont have much time to work on the program, so any expansion with new receptors, effectors, etc is greatly appreciated 😀