Nem-GDev / swarm-pathfinding-sim

Ongoing project, with the goal to create a simulation of the pheromone led movements of an ant colony .

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwarmSim Pathfinding

Live simulation of adaptable pathfinding, modelled loosely on the pheromone-based movements of ant colonies.

GitHub top language CodeFactor Grade GitHub

SwarmSim Demo Gif

Usage

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.

  1. Download & Extract SwarmSim_win64.rar (Windows 64bit)
  2. Run swarm-pathfinding-sim.exe
  3. Commandline UI will guide you through choosing a theme & preset.
  4. Simulation Will start automatically.

Controls

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

Compiling yourself

To compile the C++ project you need:

  • A C++ compiler installed (GCC recommended)
  • CMake installed & setup on your system
  • vcpkg installed & setup on your system
  • sfml:x64-windows AND nlohmann-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

Notes

  • 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.

Credits

Special thanks to my friends Sepehr & Milad for their great suggestions & technical help with some aspects of C++.

About

Ongoing project, with the goal to create a simulation of the pheromone led movements of an ant colony .

License:GNU General Public License v3.0


Languages

Language:C++ 98.3%Language:CMake 1.7%