The medium post goes into quite a bit of detail, but basically the
box2d agents sense the environment in their sensors, they get
feelings, the feelings influence the emotional state they have, they
have hormones as a learning-over-time system, and the strongest
emotion determines how they interact with the world. If you would like
to try this yourself (its doesn't scale too well from my experience)
then I suggest you read the papers in the references :D.
The code is available on bitbucket https://bitbucket.org/daniel-shields/ae-testbed/ but
I have to warn you that as the time got closer to my deadline the
quality of code took a bit of a dip, so the code concerning the
emotional model is especially cryptic. The majority of my marks came
from the research paper so I had to focus my attention on that.
However I think some of the Box2D code might be useful as reference. I
have not seen too many large Box2D projects on here yet...
Some of the Box2D code features include:
Loading a Box2d world from an XML
file + custom world sizes
Saving and Loading Box2d xml maps
Handling multiple Box2d elements
Drawing simple Box2d shapes on
Collision and Category Bits
A camera that can pan and zoom in
2D around the world
camera can follow Box2D agents as
If you would like to run the code yourself you will have to update
a line of code in "BoundaryElement.cpp" which points to the
XML map location on file, the camera will start off zoomed in really
close to the map so you will have to zoom out (shift + scroll), you
should be able to figure out the other keys from the main c++ file, If
you have any questions I will try and answer them.
Unfortunately I did have a problem with git towards the end of the
project so the recents commits are a bit of damage control to try and
fix it. I also have not had a chance to test this on windows, I have
only tested it on Mavericks so far.
I would like to work on the project more when I get some time,
perhaps I can look at stripping it down a bit so it contains only the
The project included some video tutorials and and walkthrough,
about 40 mins worth, however my internet isn't so good in Africa
so I decided not to upload the videos.
I am so happy to hear you read the medium article... I didn't
actually think anyone would read it. I am not that good at maths so I
have tried to keep the entire post as simple as possible. I am sure if
you think about it for a while you will start to realise its not that
difficult to work with the algorithm.
I just wish I had more time to work on this project as I found it
really interesting, and I think with a bit of time to clean it up it
could be way better.
If you have any more questions I would be happy to answer them.
I think if you update the Pretzel GUI I should apply the changes to my
project, because I think there are three UI components at the moment,
including a custom one. I like the way Pretzel looks professional like
the photoshop UI :)
I tried playing around with Pretzel during the project to extend
it, however I found that too confusing and only understood a bit of
what was happening as well :P so thats why I ended up with the custom
floating text for the 'model info panel'.