Sublime Games

21 February 2009, 05:15

Some research

Research – prevention is always better than cure

The specification document that was laid out previously now enables me to ask deeper question’s about how this game should function and feel. Doing so, leads to a greater insight of were the potential gaps in my knowledge are (or will be). The unknown in any development process is the enemy; as it often adds to an increased development time for any project. So to combat these gaps in my knowledge and thus speed up development, I like to engage in a spot of research. The aim of the research is to make the unknown, the known!. Or another way of saying that could be; to bring light were once there was darkness!.

Two dee or not two dee!

One such gap in my knowledge is; how should the game engine function. Should it be a 2d affair, maybe even a 3d one or possibly even some sort of hybrid that uses 2d in 3d. Depending on the technique chosen now, depends how and what aspects from the spec doc can make it into the final game. I shall now try to throw some light on the issues with the possible choices available to me.

Two dimensions?

Here is a brief list of my main points of thought with a 2d game engine.

  • Easier asset creation
    Should be a lot easier to develop and maintain the media required to produce the game. Plus, I also have a lot of previous experience in regard to this.
  • Lower system requirements
    Lower the spec of computer means that there is a bigger potential market for the game.
  • Sloped terrain could be problematic
    For all the slopes in the terrain, an image of the car would need to be created, but by doing this, it can have an adverse result of increase the hardware requirements for the game. To pre-empt this potential pit fall, a decision to limit the types of slopes available to level builders would be needed. For example, a south, north, east and west facing slope only could be available. This will reduce the requirements for the media creation as only those types of slopes would need to an image rendered.
  • Damage could be tricky
    Showing damage on the car could also turn out to be quite problematic. For each level of damage to the car, there would be a requirement to hold extra graphics for each. This combined with the above sloped terrain could to the game into a massive resource hungry one!. Especially when you sit down and think of each car that can be cpu controlled.

Three dimensions?

Like 2d, here is a list of thoughts about a 3d engine.

  • Harder to maintain asset chain
    With 3d comes a level more of complexity in the creation of media for the game. 3d models, texture and the movement of them in a game world gets a touch more complicated.

  • System requirements could be higher
    Due to the nature of 3d, there could be a higher system requirement for the game to run.
  • Sloped terrain easier
    If the cars are rendered in true 3d, then they can be made to show sloped terrain a lot easier at no extra cost. Its just a matter of tilting the car in the right direction!.
  • Damage made possible at no cost
    Putting damage on a 3d model may be a touch more complicated, but the overall effect wont be limited to pre drawn images.

2d demonstration

Before the answer, let me show you a few images of the two styles in action. These are the results of previous research in the previous development diary.

The image above demonstrates how a car template can be given colour transfer to make it look individual on the race track (Click the image to see!). There are 64 ‘shade’ frames, all pointing north. With a moving light source that is casting a shadow on the body of the car, depending upon the location of the sun relative to the direction of travel the car should be going in for that frame. When drawn, the correct frame from the shade frames is rotated and drawn on screen. Next the transfer is rotated and added on top. Due to the way the transfer graphic is drawn, the darker parts of the image tint through on to the transfer. The net result is that when the car is rotated, the shadow that’s cast by parts of the car swing and shift across the body as if a global sun was casting them. Note the shadow as casted from the tail spoiler of the car on the body.

Now this image above demonstrates a method for rendering shadows. Much like shade frames of the previous image, there are another 64 frames holding graphics for the shadow. They are rotated and placed on top of the display to generate a shadow of the car. However one problem that can occur using this method is when two shadows overlap, there is a doubling up of the shadowed colour – making it much darker then it should be in the shade. To get around this, there is a feature on most modern computers called a stencil buffer. This can be used to limit the drawing of the shadow overlapping.

As you can see, getting something that is of good enough quality in 2d can be achieved but the next problem comes when I tried to add slopes and damage to the mixture. For slopes, I would need to limit the number of hills available, and for damage I wouldn’t be able to do zoned damage as I desire (for example, the front bumper, side wing etc). For the amount of resources and effort required to get those working in 2d, I might as well spend my time on a 3d engine that could handle it efficently.

3d demonstration

Before I could demonstrate anything in 3d, I needed a model to mess (I mean test) with. So I went to work in a free open source program called blender.

Blender is a great free open source modelling program that is very capable of pixar style movies!. In my mind, its one of the greatest free tools available on the internet today.

After the initial model layout, a UV map was needed. This is like a painted skin that wraps around the 3d object to give it colour and details. Click the above picture to see what I mean!.

Next up it needed to be painted. From left to right you can see the on going progress of the model until we arrive at something that is useable. The model in question is based off my own car, a Toyota MR2 Mk2!. Also at this stage there is no need for a polished finish on this model because its only going to be seen from far above!. The whole car, once assembled with wheels and glass is less then 500 polygons.

Once the car was built it was time to build a little 3d demonstration of the game engine in question. The following picture shows such a thing.

Now if you click that above image you should get an idea of how the car can look in a 3d engine, it manages to do almost everything that the 2d one does and a little more. One thing that is missing is the car self shadowing however to make up for that we now have a car that can be spun at any angle and the shadows that is generated is perfect every time!. Showing damage on the car now becomes something that is possible, because all we need to do is either modify the UV map on the car or tweak the model by pulling and pushing bits of it about.

The answer

To me, as it stands, after the above spot of research, it looks like a 3d engine wins the day. Now at this moment in time, I am not sure if the whole game will be 3d or just the cars that will be racing round the track. That is something only time will tell.

Comments are turned off for this post.
All rights reserved 2008-2009