Live simulation of adaptable pathfinding, modelled loosely on the pheromone-based movements of ant colonies.
The swarm agents (ants) will attempt to find a path between the Home & the Food. You may place multiple of these, and block the path or make a maze with the walls.
A large set of variables define the characteristics of the colony and program settings. Currently there are multiple ready-made presets that can be picked to initialize the simulation.
Depending on your CPU you may get lower framerates on bigger presets, which will decrease the stability of the simulation.
You can either download and run the executable (Windows), or compile the project yourself (any platform) explained in the next section.
- Download & Extract
SwarmSim_win64.rar
(Windows 64bit) - Run
swarm-pathfinding-sim.exe
- Commandline UI will guide you through choosing a theme & preset.
- Simulation Will start automatically.
Controls are also mentioned in the commandline UI. For reference:
Key | Action |
---|---|
LMB |
Draw on map (Pick a brush first) |
H |
Home (brush) |
F |
Food (brush) |
W |
Wall (brush) |
C |
Remove (brush) |
S |
Show paths |
A |
Show ants |
To compile the C++ project you need:
- A C++ compiler installed (
GCC
recommended) - CMake installed & setup on your system
vcpkg
installed & setup on your systemsfml:x64-windows
ANDnlohmann-json:x64-windows
libraries (or corresponding 64bit to your platform) installed on vcpkg
Finally modify the CMakePresets.json
file in the root of the repository;
"toolchainFile": "%ADDRESS%"
Where %ADDRESS%
is the address to the vcpkg.cmake
in the root folder of your vcpkg installation.
And build the project with cmake: cmake -B build -S "%PATH_TO_PROJECT_ROOT%" --preset RelWithDebInfo
- The aim of this simulation was to keep a natural & organic feel. Thus sporadic, aggressive & highly adaptable/regenerative pathing was preferred over perfectly optimized routes.
- This project was completed in 1 week. However further improvement updates may be committed over time.
Special thanks to my friends Sepehr & Milad for their great suggestions & technical help with some aspects of C++.