a multi-agent ant simulator from the last millenium (!) – Github link
It was the first C++ project I developped in highschool (Michel Tran Ngoc, Manik Bhattacharjee for conception and code, graphics by Tristan Millner and some code refactoring by François Leiber) – between 1998 and 2002.
Its old website is still online, last updated 18 years ago !
We did read books about ants from the national library, observe ants in nature and take pictures.
The project was a learning opportunity for object-oriented programming in C++, graphics programming in Windows and Linux, using DirectX, GTK and finally SDL.
Ants explore their 2D world in search of food that they bring back to the anthill.
Each ant independently assesses its situation and environment, and according to its class (worker, queen, nurse, warrior) does the appropriate task. They leave pheromone trails (blue arrows for food tracks, red dots for danger), move on the map, get food (yellow patches) and breed new ants (from larva) underground in their anthill. They can kill other insects and ants from other anthills (small colored dots for dead insects).
The interface shows both a minimap with all ants (on the left), and a local view (right). An ant can be selected to see its characteristics (on the left) and the ant’s image changes when it is carrying food.
Worker ants retrieving food and leaving/following pheromone tracksWarrior ant next to a dead insect and danger pheromones Underground, nursing ants feed the larva next to the queen while workers bring food in
I recently (february 2020) tried to make it run again, and I was able to compile it using old librairies still distributed on linux.
The latest 2D version was compiled after some code tweaks (it turns out that 64 bits computing and badly coded C++ 98 don’t work together that well). It runs pretty well, even though there is no hardware acceleration for the 2D display.
Cleaning up the source code would be a lot of work, but it would be nice to see it running with newer libraries such as SDL2 with hardware acceleration, with a clean C++-20 code and taking advantage of parallel processes through multithreading (or even GPUs) !
The 3D version that Michel developped in the last year does compile but crashes and does not seem to work.
All source code was uploaded to Github, the new licence is GNU Affero GPL v3.
Le code 2D a été converti en SDL2 et tourne très bien, plus rapidement même, et plusieurs bugs ont été corrigés (cf github)
Wouhou, salut Manik, toujours vivant ?
Ça fait plaisir de voir que SFourmi n’a pas été complètement oublié… mais moi j’avais déjà une page pour ça depuis 20 ans (gloups j’avais oublié en fait) : http://leiber.free.fr/programmation/sfourmis… et en Comic Sans en plus 😀
Je me souviens surtout que passer derrière une équipe de devs pas forcément perfectionnistes, sans même avoir un vcs, c’était la souffrance totale, donc j’avais fini par aller faire mes propres projets. Mais retrospectivement, c’était une bonne intro au reste de ma carrière