Firefighter – The Mission

I just want to introduce a game called ‘Firefighter – The Mission‘ that can be played here. It’s somewhat a milestone for me because it’s the first game I coded as a freelancer. It was finished at the end of last year, but was just published now. The game is build upon an efficient isometric game (which you probably won’t notice that much because the animated fire and smoke effects are serious performance killer).

A unique game feature is the collision detection. All collisions are computed in 2d, so the game does not need coordinate space transformations (rotation about y and x axis). In fact, 90% of the code only uses additions, multiplications and bit shifting, so I think it should also run well on mobile devices.

Collision handling is divided into two parts, which are often referred to as broad phase and narrow phase. The broad phase step just checks if the 4 adjacent tiles on which the player stands are walkable and adjusts the player position accordingly. The narrow phase step uses a system I like to call ‘Micro Collision Cells’. Every tile has a fine grid of cells – much smaller than the player itself, and each cell can be turned on/off in the level editor. When the engine is fired up, all flagged cells are merged into the smallest possible amount of larger axially aligned bounding boxes (AABB). For example, if a tile has a resolution of 5×5 cells, and each cell is flagged, the engine would have to check 5×5 = 25 cells in total, but the simplification leads to one box covering the full tile.

MicroCollisionCells

“Micro Collision Cells”, 13 axially aligned boxed on the left side vs. 3 merged boxes on the right side

Another feature I worked on was exact line-of-sight computation. This is used to get a valid range of tiles in front of the player that can be extinguished (very important for z-sorting the water particles). Scrolling is tile based and follows the principle of tonypa’s well known tutorial about tile based games.
Because there wasn’t much time to develop the game, I left out some advanced features like ‘line of sight’ for visibility determination (similar to a fog of war in strategy games), but I will definitely port and extend the engine to AS3, since it is easily adapted to other graphics sets or tile sizes which should come in handy if a similar project comes along.

4 thoughts on “Firefighter – The Mission”

  1. Congratulations – really nice little game with a great brand focus and some very slick graphics.

    I’d be interested in reading an overview of the algorithm that you use to cluster the map cells – psuedocode?

    Also looking forward to your data structures book. Thanks!

  2. As I remember correctly, the ‘cell simplification’ algorithm which I developed is an recursive process – you first scan horizontally while marking adjacent cells and putting them into a group, then scan vertically and doing the same (but skip already marked cells) and then apply this again until all cells are marked. If I have some spare time I look into the code again and try to write something about it.

  3. Is the game still online. I can’t find it on the site you link to. Is it possible to put a copy up on this site?

    Thanks

Comments are closed.