The subway game
Märt Bakhoff, Anne Mirjam Kraav
Our goal was to create a single player 3D game, where the player can explore and interact with the environment. We chose a subway station as our location. At first, we wanted to create an actual explore-the-world style of game where the player unfolds a story while playing and items serve as clues for something certain. That turned out to be more work than expected so the final version takes place in a very small subway station with objects like boxes, barrels and everyday items. The player can move around and interact with some of the objects around him.
The purpose of the project this time was not to create something for the benefit of others, but instead to test and reinforce the things we learned in the lectures and practical lessons, such as light, shadows and physics and hopefully create a somewhat believable 3D environment. We used Blender to model the world and jMonkeyEngine as the game engine.
We chose jMonkeyEngine (http://hub.jmonkeyengine.org/), because it seemed to suit our needs. It is a java based game engine that includes graphics, JBullet physics, sound, input management and can also import assets from blender.
The most time-consuming part of the project was the modelling of our world in Blender. We played with various techniques and material properties covered in the lectures. Our models use textures, specular maps and have ambient light properties. Some of the objects are transparent. We had to use different UV mapping techniques such as cylinder projection, unwrapping objects using seams and tweaking uv coordinates by hand.
Another challenge was importing our assets into the game. Our game engine supported importing some basic data directly from blender's blend files, but it wasn't perfect. We had to apply all mesh modifiers before exporting and materials created in cycles render didn't work at all. Finally we had to compose a decent scene graph from all the different models imported from blender, add the lights and make the world come alive.
JMonkeyEngine supports all the basic lights such as directional, point and spotlights out of the box. We mainly used pointlights in our game because it seems to fit into the underground darkness. We could also add shadows without much trouble. jME has built in shadow algorithms that could be added with a single line of code (similar to OGRE). We use an implementation of shadow mapping which uses extra geometry pass to calculate the shadows. This gives mostly good results, but some jaggedness may occur when an object is casting long shadows.
We were pleasantly surprised how easy it was to add physics to our models in jME. The built in jBullet physics engine creates a world representation parallel to the scene graph and attaches "controllers" to the objects in the scene graph that are used to apply physics movements to the scene. It's mostly intuitive and helps a lot in creating a believable world.
One of the cool things we hoped to use in our project but never finished is the use of animations. Since our project basically followed the course in reverse order - starting with the high level game engines and blender, then moving on to materials and effects - we couldn't learn the rigid body animations soon enough and there were also technical limitations with jME and importing animations.
- Code can be found at: https://bitbucket.org/mbakhoff/cg2013gamey/
- Screenshot http://i.imgur.com/zDYAXOo.jpg (updated 12.12.2013)