Month: October 2014

MSc Project: Crowd Simulation (Java)

I have completed an MSc  in Advanced Computer Science (awaiting results). I love throwing the “Advanced” bit in there all casual-like because I got “upgraded” and it made me feel special. I’m probably not quite worthy of the title, but I have learnt a lot and am enjoying myself so I’ll use it proudly 🙂

My dissertation topic was “AI- Based Crowd Simulation”, and it was an open ended project. The project(or corpus) was worked on by myself and three other students  over the course of roughly three months.

I was developed the agent behaviours and the behaviour system that used them. It was written in Java, using the libGDX framework.

Some features of the finished product:

  • Basic flocking rules (Reynolds)
  • More complex set of behaviours –  eg, Panic, Hunger.
  • Multi Species
  • Customisable behaviour for a species
  • Evolution of behaviour from an Evolutionary Algorithm
  • Initial simulation setup
  • Ability to place new animals and objects once simulation has begun.


highlighted are the animals in the same family group, all are the same species in this image.



zoomed in view of a herd of wildebeest changing course to avoid a hyena


You can download a zip of the project here


Project: Shop RL (Python)

This is my longest standing project – it’s a long term hobby!

The premise of this was to be a shopkeeper/adventurer, much along the likes of Recettear, however I wanted more of the permanent roguelike elements to make an appearance. So when you lose a fight, you die and that’s it! I also wanted this to cross over into other things, so if you were in debt for too long without making any payments, people would come and begin repossessing your things and even your take the shop. Ideally there would be a couple of routes out of a situation like that – sell up everything and be a full time adventurer?, sign a deal with the thieves and local thugs? Fight off all the guards who come to try and touch your stuff!

The current state of the game is not close to realising this yet, I got quite distracted with generating everything so never really made any progress on making the “game” part, plus it’s been on hiatus whilst working on my masters’ but I will come back around to it eventually.

Current features:

  • Controllable player character
  • Dungeons that are visit-able
  • Can pick up items
  • Player has skills
  • Can use some items
  • Procedurally (almost) generated a world
  • Traders go between cities
  • Cities trade with each other and have a supply and demand
  • Mini-map
  • Pathfinding – roads generated with it, and some dumb AI generate and follow paths between cities.
map generated with a few cities and dungeons, and some garish roads connecting some of the cities

map generated with a few cities and dungeons, and some garish roads connecting some of the cities

The very beginning of dungeon generation. Currently just places rectangles with a chance of touching. Along with a single “connection” (diagonal corridor in this case)

The view of the moisture in the land - this is used (eventually) for biome calculation

The view of the moisture in the land – this will be used (eventually) for biome calculation


Current (or next) goals:

  • Finish biome generation
  • Finish dungeon generation
  • City/Settlement generation


Pyglet and ecs Part 1: Small Beginnings

I am not going to go through the specifics of setting up Python/Pyglet/IDE’s and ecs, but here are the links to all the appropriate sources:

  • Python (I’m using 2.7)
  • ecs (I used pip to install it, here is an easy install for pip)
  • Pyglet I am using the development version (pyglet 1.2 alpha1), and used pip on the command line to install as per instructions on the bottom of their download page.

QuickStart Guide for Pyglet: If you’ve never used Pyglet I would advise looking through this, just to get a feel for how Pyglet works. They can probably explain the basics better than I can!

The IDE I am (experimentally) using is PyCharm, though I have used Aptana Studio standalone, and both do a very good job.

This tutorial is based heavily upon this tutorial, but I have tried to go about extracting the game into components and systems.


Combining Pyglet and ecs the Entity System

Entity Systems have fascinated me for a while, the idea of being able to effectively turn anything into anything else with a few removals and additions of components makes me happy. My knowledge on the Entity System and it’s pros and cons is somewhat limited. So if you want to find out more read these posts (from far more knowledgable others) :

This Guy Knows Lots
This Article

My intention is to experiment with the combination of ecs and pyglet to create a basic Asteroids type game, and I hope to document the process for others interested in following the same path.

PART 1: Small Beginnings – Introduces the Renderable and Transform components.
PART 2: Flying Around – Introduces the Physics and Player components.
PART 3: Crashing Into Things – Introduces the Bounds component.