Animation and Planning in Games

Assignment Four : Crowd Simulation

For assignment four I wanted to implement Boids Since I have already implemented Helbing's Social Force Model, The Universal Power Law, and have utilized the ORCA library, RVO2. Plus animating butteflies is easier than humans.

DOWNLOAD MAC .APP FILE

DOWNLOAD SOURCE

Tools used

  • G3D (graphics engine) : https://g3d.sourceforge.net/
  • This basically serves as a wrapper around openGL calls, and provides utility classes such as Vectors and Cameras. I still wrote all the shaders for this project as well as all of the particle system code.

  • ArtRage (texture software) : https://www.artrage.com/
  • I used this software to create the buttefly wing texture.

  • GroundTexture : https://opengameart.org/node/11950/
  • I used this nice open souce tileable ground texture.

  • Normal Map Creation : https://www.crazybump.com/
  • This is a neat little program that creates normal maps from images. I used it on the ground texture to create a nice effect with phong shading.

Features

  • BOIDS, with basic planning requirements.
  • 2.5D Navigation
  • Nicely Rendered ground and butteflies. (The obstacles are from candycane hell, and thus not nice.)
  • 3D controlled camera (I used a G3D camera manipulator class)
  • Real-time user interaction with system, create obstacles, make new random goal.

Planning

It's worth making a few notes on how I do planning. Firstly I wanted to use the code from the last assignment that did 2D path planning, but I wanted 3D Boids, so I ended up doing a bit of a hack. The path is planned in two dimensions, with disc obstacles, and the agent then moves in 3 dimensions, with cylinder obstacles. The agent then is never obstructed in the up direction, and can move directly towards the goal in that dimension. Second for the path planning I run a search from the goal node to all other nodes. For the sake of time I just did breadth first search. Then for each agent in order to find a path from a node to a goal an agent finds a nearby node and then back traces towards the goal node. This is nice because every node in the graph has the shorest path (in terms of number of edges) towards the goal. Then if I pick a new goal, I only have to run one search on the graph, instead of once for each agent. The major downside here is that all of these agents must have the same goal, which for a flock of bird like objects is not a huge limitation.

Difficulties

The biggest difficulty I had is avoiding collisions with obstacles, and in fact they still can and do occur occasionally. They do have a path that navigates them around the columns, but the Boid forces have such an impact that they can even go right through the middle of columns. To help prevent this I added forces repelling the agents away from the wall. This does reduce collisions, but adds a couple artifacts. I'm generally opposed to modeling walls with forces, but this looks ok for this short project.

Butterflies!!

Below are a few screenshots taken from my pretty Boiderflies.

User Controls

    • "1" - Toggle roadmap visibility.
    • "o" - Add obstacles. (o as in obstacle)
    • "p" - Toggle butterfly motion.
    • "9" - Toggle Slow Motion mode.
    • "r" - Generate a new random goal.
    • "space" - Shoot some butteflies out of your face.

Contact: devinscottlange@gmail.com