Hey guys,
I created my CS honours project with Cinder and Box2D, It was 3
months of hard work and I finally got my results back so I think its
okay to share the project.
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
(factory method)
-
Drawing simple Box2d shapes on
the map
-
Collision and Category Bits
-
Sensors
-
A camera that can pan and zoom in
2D around the world
-
camera can follow Box2D agents as
they move
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
Box2D functions.
What do you guys think?