1. Programming‎ > ‎

[Game]Bomberman 3D

For the course of Computer Programming and OOP, we were instructed to develop a game for the final project. As our Instructor thinks that 'game developing makes programming fun to learn', I also think the same. We were instructed to use either Allegro or Irrlicht as the engine for the game. I wanted to stand out from the herd so I chose to work on a small but a fully 3D game.
Thankfully I had Saad Zaman(again) in my group, and things actually got really easy for me as (ahem) two 'cheetahs' had met. We also had Azka Qaiser in the group, she is pretty good at graphics so that part got simple for us too.
The game that we chose to clone was Bomberman. Now let me explain the logic on how I opted to solve the problem.
Basic World Creation
Irrlicht engine is really easy to use as the process of starting a 3d scene is to first initialize the video device and load all textures and models and then while in the Game Loop, you just have to receive the user interactions, make changes accordingly to any model that requires a change in the reaction of user input (eg. User press W and character position changes) and just call DrawAll(). This will draw all the changes to the screen along with the previously unchanged models/sprites.
I loaded the skybox and used the skybox creation call in the Irrlicht.
I also created a flat terrain, of fixed x,y dimension, which will house the crates, and be the ground to the players.

Map Loading and Rendering
Maps are loaded from text files, that contains a 2-dimensional matrix similar to this

   extract from original map file    

This file was later loaded by the game engine and boxes were placed accordingly on the flat terrain we had created above. By using this method, we could make multiple maps just by making changes to the map file.
The engine loaded the file through LoadMap(), created a matrix array and stored the entire map in it. After that, a function call AddCrate() was called each time a crate was detected in the array(5 for wood crate, 9 for concrete one,3 & 4 for crates + power ups inside them). The crate would be created at the appropriate X and Y on the terrain (according to the matrix array).

Other Basic Stuff
After this, the problems remaining were:
Player Walking: Detect keypresses and make changes to characters x,y accordingly. Also change player animations (walking/standing).

Collision Detection: Before making changes to player position, check if the new position will be at a place where crate exists. If so, do not make that move.

Bomb: Players could drop bomb on map which would then explode and check (within its range,taken from player properties) that if any crate/player exists in its vicinity. If so, destroy/kill it.

Effects: When player spawns, a portal effect is created and when the bomb explodes the fire effect is created through Irrlicht's Special FX features.

Sounds: IrrKlang sound library was used for sound effects in-game.



      player running from bomb       
      which is about to explode       
             explosion effect               

I am uploading the binaries as well as the source code for others to learn from.
Source: [uploaded below]
UPDATE: multiple map loading feature completely working now.
Source is in C++ and the project file is in Dev C++ format.
You must be able to compile it in other compilers(after loading Irrlicht/irrKlang libraries, google them) but I haven't personally tried doing that.
The source is not really much commented or easily readable. Don't blame us for that, we only had about 1 week to work on it.

Assad Ali,
Jun 9, 2010, 10:49 AM
Assad Ali,
Jun 9, 2010, 10:58 AM