Tuesday 21 August 2007

Player and bots .. cont..


To give more exciting feeling to the game play, more bots are rendered. For this purpose, the track matrix data is taken from replay.cs which contains the position and rotation of the bot at the specific time. The following code (Source code 3‑2) shows how to extract the data.

Matrix bestReplayCarMatrix =

RacingGameManager.Landscape.BestReplay.GetCarMatrixAtTime(

RacingGameManager.Player.GameTimeMilliseconds / 1300.0f);

Source code 32: Matrix data used from best replay

Before rendering the car, the rotation of the car is created to make sure the car stay correctly on the road. (Refer Source code 3‑3):

bestReplayCarMatrix =

Matrix.CreateRotationX(MathHelper.Pi / 2.0f) *

Matrix.CreateRotationZ(MathHelper.Pi) *

bestReplayCarMatrix;

Source code 33: Rotate the car to stay correctly on the road.

Finally, the car is rendered with a specific texture, colour and matrix to the world. (Refer Source code 3‑4). Please noted that false in the code indicate the car is not a ghost car, therefore, it can be rendered with a texture and colours.

RacingGameManager.CarModel.RenderCar(

1, RacingGameManager.CarColors[5],

false, bestReplayCarMatrix);

Source code 34: Rendering the bot

To have more bots, the process is repeated but with unique matrix. This can be done by dividing each matrix with different variable, so that the bots is rendered at a point at different time.

each bot is given unique matrix:

Matrix bestReplayCarMatrix =

RacingGameManager.Landscape.BestReplay.GetCarMatrixAtTime(

RacingGameManager.Player.GameTimeMilliseconds / 1300.0f);

Matrix bestReplayCarMatrix2 =

RacingGameManager.Landscape.BestReplay.GetCarMatrixAtTime(

RacingGameManager.Player.GameTimeMilliseconds / 1200.0f);

Matrix bestReplayCarMatrix3 =

RacingGameManager.Landscape.BestReplay.GetCarMatrixAtTime(

RacingGameManager.Player.GameTimeMilliseconds / 1500.0f);

Sunday 19 August 2007

Player and bots


The initial prototype has one player and one ghost car. Since the ghost car is hard to see and not suitable in implementing the concept of this game, it has been replaced with other visible car model. The model taken from the player’s car model itself, but this time, the bots are rendered with unique skins to represent itself and different from player and other bots.

Thursday 16 August 2007

More Shader's Effect


Shader is useful to change the game to have darker or brighter screens. It also helps the developer to control the colour mixtures and intensity. It means that the game can be developed to a variety of weather and environment such as cyber world or cloudy weather.

This shader effect is very useful and available to be applied in the future game development. The shader file is a file with an extension .fx so that not only programmers can edit it; artist or designers also can be assigned to change and edit the code. In fact, Nvidia Corp. provides a tool named FX Composer to easily create or edit shader files. They even provides with some shaders template that can freely used or manipulated and it support many formats such as DirectX and OpenGL, HLSL, COLLADA FX, and CgFX, as well as .fbx, .x, .3ds, .obj, and .dae

Wednesday 15 August 2007

Game Play Screens & Shaders


Some tuning in game play screen also has been made. These include the changes on dashboard, the figures indicator and shaders as well. PostScreenGlow shader is eliminated to get a better view but less realism. This shader is used previously to give some glow and motion blur effect to the environment to give a furious mood to the player, so that the player feels that he is driving fast. However, this shader is not well implemented because the shader’s effect not suppose to start as soon the game is rendered but it should start when the car is moving. Moreover, many users who participate in this game testing including myself don’t like the effect because it is like showing an old fashion graphic is being used in the game.

Monday 13 August 2007

Game Physics & Collision Detection


There are many racing game physics that can be implemented such as gravity, friction, engine physics, car dynamics and springs physics. These physics are important to achieve realism in game play. For this project, the basic law of motion and collision detection will be implemented as shown in Figure 39. These include:

  1. Car moves towards as the accelerate key is pushed or moves backwards if the reverse key is pushed.
  2. Some elements may pull the car back or slow it down such as friction or braking.
  3. Gravity pulls the car down and keeps the car on the road.

Objects that are moving through the world need to be checked against the geometry and all other objects in the world to see that it does not pass through or get too close to any of them. For instance, I would check if any of the four wheels collide with the guard rail by checking the four wheel positions (or at least the most outer parts of the car) still allow you to do the basic collision detection. If the car is crashing into the right guard rail, it means collision happens at the front right side of the car and vice-versa. Collision response is to rotate the car to opposite direction and slow it down due to the crash. Collision between cars also must be calculated to reduce the car’s defence status bar so that the game will over when the car’s defence equal or less than zero. The following Source code shows the pseudo code for checking the collision with the guard rails.

Check all 4 corner points of the car.

For all 4 corners {

Determine the distance between the corner to the rail.

If it less than or equal 0 then

{

Collision happens.

Bring out the collision event

{

I. 2nd law of motion, force the car back on the road and reduce speed.

II. Determine the collision impulse and show collision effects.

III. Play collision sound

IV. Shake camera.

}

}

}

Saturday 11 August 2007

Content Creation for Racing Game

When talk about racing game, the idea of the racing game is simple which is stay on course and be the fastest to the finish line to be a winner. However, that concept can be twisted to get more exciting racing game. According to Nitschke, racing game can be categorised into multiple types which are realistic racers, street racers and fun racers (Nitschke, 2007). Realistic racers focusing on realism aspects like Gran Tourismo and Colin McRae. Realism aspects is not important in street racers but it’s more like watching cool movies that broad to other aspects like able to tuning cars or listening to cool music while racing on the tracks like Need for Speed Underground. Fun racers like Trackmania and Carmageddon are more to fantasy racing with crazy tracks and able to jump high. Furthermore, the mission is more on achieving goal in limited of time.

In developing content for racing game, there are 3 approaches that can be applied to computational intelligence in the game. There are optimisation approach, innovation approach and imitation approach (Togelius, Nardi, & Lucas, 2007). In optimisation approach, the optimisation algorithm is used to change values of some particular aspects to get good and realistic game strategies. To implement a racing game, developers have to make an experiment to gather racing data especially the car physics and “make sense” tracks that can be built. The data gathered then can be applied to build the realistic game. Therefore, the fun racers category is exclusive in this approach.

To achieve realism in racing game, several physics concepts can be applied to the game such as gravitation, speed and inertia, friction and car’s engine torque. For instance, to enhance a game visual realism and realistic vehicle performance, multi-body vehicle suspension theory can be applied which is composed of springs, dampers and linkage through the wheels stay connected. “The suspension is what allows the wheels to have some range of freedom to move in the vertical direction without instantly lifting the corners of the vehicle. This enables the wheels to move in relative to the surface bumps and transfer less force to the vehicle body absorbing most of the shock” (Sharif & Brindle, 2007). This concept is matter much in game simulation because it has direct effect to the acceleration, handling and breaking performance of a vehicle due to the torque generated at its centre of gravity, the body tends to roll and pitch while accelerating or cornering at high speed (Sharif & Brindle, 2007). Unfortunately, very few of racing games implement this kind of physic concept.

Innovation approach is focusing on generating interests. The street racers and fun racers are examples that inclusive in this approach. In other words, this approach sees games as environments for the development of complex intelligence rather than computational intelligence techniques as means of achieving particular results as games.

The imitation approach is based on numerous of supervised learning. Symbolically, what is imitated is a human player, but a game agent can possibly imitate another agent. A good example of this approach to computational intelligence in racing games is the Microsoft Game Studio Xbox game Forza Motorsport. In this game, the player can train his avatar to play just like himself, and then virtual copy of him is used to get ranked on tracks, or test his skill against other players’ avatar (Togelius et al., 2007). In fact, this approach is used in my project to generate a “virtual bot” to the game. This implementation will be discussed in the next post.

Friday 10 August 2007

Project Methodology


Since the game is derived from the starter kit, the project methodology being used is the “prototyping” because analysis, design and implementation phases can be performed concurrently and these three phases are performed repeatedly in a cycle until the system is completed (Dennis, Wixom, & Roth, 2006). Realise or not, the starter kit is also known as a prototype. Therefore, with this methodology, the prototype can be used and tested repeatedly to get the ideas and feedback. These ideas and feedback are analysed, redesigned and re-implemented, so that a better prototype with better features can be developed. This process may continue repeatedly until a good game is produced (refer Figure 3‑3). In other words, this methodology is used to ensure that the game can be developed quickly with some modification and customisation to the prototype due to dissertation period of time.


Tuesday 31 July 2007

Technical Design Document

1. Game Engine

I used the game engine provided by the Racing Game Starter Kit that can be downloaded at
http://creators.xna.com/Education/StarterKits.aspx. It is a free to use XNA Game Studio Express game that comes ready to compile and run, and it's easy to customize with some C# programming. It is a 3D auto racing game that features advanced graphics, audio, and input processing. It features:

1. XnaGraphicEngineContentProcessorsContentProcessors - XnaGraphicEngine model processor for x files. Loads models the same way as the ModelProcessor class, but generates tangents and some additional data.
2. XnaGraphicEngine.Graphics - Contains low-level application programming interface (API) methods that take advantage of hardware acceleration capabilities to display 3D objects.
3. Some basic on landscape rendering – landscape constructor can loads the map height data from the level file and build tangent vertices with it.
4. Built-in Unit Test – instance creation of the project to call draw method to test the unit data or block is valid.
5. Provide with a sample of physics engine that I believe will be useful in Bumper Game Development.

However, the game engine will be change slightly to suit with Bumper game needs.



2. Development schedule/plan




3. High-level diagrams of Bumper Game Design



4. Art tools used in our production pipeline

1. Photoshop
This art tool will be used in skinning models, focusing on details and textures used to create rough skins of the landscape and objects, Photoshop also is being used to create a background and glow texts for GUIs.
2. Milkshape
Milkshape is used in 3D modelling. Objects in the game are created in Milkshape by combining many shapes available in Milkshape. Some objects are ready made imported from several website, modified in Milkshape with different shapes and skins. Milkshape can import .x objects from the tools menu, which is slightly hidden from users’ eyes. This tool is also used to make a simple animation of the cars’ wheels spinning.
3. UVMapper
This tool is used to ensure the texture skins mapped correctly onto objects.


5. Collision detection, physics

Objects that are moving through the world need to be checked against the geometry and all other objects in the world to see that it does not pass through or get too close to any of them. For instance, I would check if any of the four wheels collide with the guard rail by checking the four wheel positions (or at least the most outer parts of the car) still allow you to do the basic collision detection. If the car is crashing into the right guard rail, it means collision happens at the front right side of the car and vice-versa. Collision response is to rotate the car to opposite direction and slow it down due to the crash. Collision between cars also must be calculated to reduce the car’s defense status bar so that the game will over when the car’s defense equal or less than 0.
For the physics of the game, collision effect should be considered and also forces like gravity, friction and engine boost.


6. 3D Object

Cars
Trees
Mountains
Buildings
Rocks
All models named by their object name.
File Format - .X
Max of 5 textures for small items like trees
Texture file format - .pcx, .bmp, .tga


7. Scene Management

One of the most important aspects of scene management is rendering the scene. We definitely will implement some scene management simply because the less we render, the less work our video card has to do, and the less work the video card has to do, the better.
Some tips should be implemented such as always sort rendering by shaders. GPU-heavy data should be rendered at the beginning of each frame so that we can prepare the landscape models and other rendering data while the GPU is still working with the many landscape and track polygons. Anything that is not visible should never be rendered. Well, the landscape and the track are always visible, so it can be skipped. Smaller 3d models can be skipped after 100 metres.
Additional layers, shaders and effects like water shaders and shadow mapping can be time consuming task, so that these things will be avoided in my project.


8. Artificial Intelligence

Overview
The AI that I can think of is the second car AI if you play single player. It should be able to auto cruise itself along the track, speeding when the first player approaching and able to avoid from collide either from the rail or with other car.


9. Target Platform and OS


Processor
Require: Intel Pentium III at 1GHz or equivalent AMD Athlon.
Recommend: Intel Pentium IV at 2GHz or equivalent AMD Athlon
System memory:
Require: 256MB system memory.
Recommend: 1GB system memory.

Video
Require: DirectX 9 compatible 3D graphics accelerator card.
Require: 32MB video memory.
Require: Hardware transform and lighting.
Require: Hardware support for DirectX pixel shader version 1.1.
Recommend: Hardware support for DirectX indexed vertex blending.
Recommend: Hardware support for DirectX pixel shader version 2.0.
Recommend: 128MB video memory.

Sound
Recommend: DirectX 9 compatible sound card.
Recommend: Hardware 3D sound capabilities.

OS
Require: Windows 2000/XP

Input
Require: Keyboard.
Require: Mouse.

Development hardware
Intel Pentium 4 1.6GHz
256MB system memory
NVIDIA GeForce 3 Ti 200
Operating system
Microsoft Windows 2000

Development software
XNA Game Studio Express


Monday 23 July 2007

Menu Interface - page 1


This is the main page for my Bumper game. Basically, I just used the starter kit menu with some changes on the buttons, pictures, title and color. There are 5 buttons; start race, highscores, option, help and quit.

Friday 13 July 2007

Make the things clear..

Just in case you are asking these questions.
We know it's a framework like XNA about game making which support Xbox360 etc. but :

1) Is XNA GSE is a Game engine ?

2) Is there features like : collisions, physics, tilemaps, particles, scripts, network libraries ?

3) In what way concretly XNA GSE will help me to achieve games better than others middlewares like BlitzMax, Torque Game Builder, Haaf Game Engine, ... ?

Well, here are the simple answers:

1) Not a game engine. It's a framework.

2) These aren't features that are built into the framework, but developing these kinds of things are easier with XNA. Also, other people have started projects which implement these. For examples, this site http://www.xnaresources.com/ gives some tutorial of how to make tile engine with XNA GSE.

3) You have more control over how things work? I guess because it's a framework, YOU decide how the game will run.

Tuesday 3 July 2007

Game Design Document


1. Background and Objectives

Since the game will be like bumper car game, the game is named as “Bumper”. The game is a race game genre but with the objective of capturing the opponent’s car (can be the computer or the second player). In this game, Bumper is the name of the chaser car.

2. Storyline

The patrol radio reports that a lawbreaker has been escaped to the race track. It is now the job for the player which is the nearest patrol car to capture the lawbreaker. The player will drive the Bumper to do this task. However, the criminal’s car is made with a special armour make it hard to block its way or punctured its tyres. The only hope is on Bumper made with special material make it hard as steel. The player has to drive Bumper to bump the car to wreck its armour so it can be captured. But, it must be done quickly before the car cross the country’s border. Otherwise, the pursuit will end.

3. Game Play, Logic and Rules

In this game, player 1 will controls (drives) the Bumper to knock down the other car. The game is presented in third person view, which means that the player can see the model of the Bumper from the back and side view and has the wider view.

A special material made from steel is attached on the front of Bumper to make it immortal to the collision. Therefore, bumper can hit the car as many as it can as long the car not cross the border or in other word, the end of the track.

When bumper hit the car, the collision will be presented in sound and particle emission. The armour indicator will be reduced depends on how hard is the collision.

If the opponent car is controlled by the computer, it basically controlled with some AI features that enables the car to follow the track with several of speeds and controls.

4. Game Play I/O Controls and GUI Interfaces

Controls option will display the controls in this game. The picture explanation is easier for the player to study and understand about the controls. The controls GUI will be like in the figure 2 below:

Figure 2: Controls GUI

The I/O control is very simple. It just uses some keys on keyboard. The keyboard control is the movement control; accelerate, turn right, turn left and brake or reverse.

5. Game Elements

5.1 Characters
Bumper – the main car controlled by player 1 to pursuit the criminal car. The car is attached with special black steel in front of it.

Criminal’s car – the car that has been chased by Bumper. It will avoid itself from getting hit by Bumper until it cross the border to the end of the track.

5.2 Environment

The chase is taking place in mountainous region in hot sunny weather with the long race track that has been build for the hot pursuit.

6. Score

The score is based on the time Bumper destroy the criminal’s car armour. The quicker it destroy the armour, the higher Bumper’s points, the lower the criminal’s (second player) points.

7. Audio and Visual Effect

7.1 Visual Effect

Particle emission will be produced shows the dust and impact of the collision whenever the Bumper hits the criminal’s car.

7.2 Audio Effects

Engine
Tyres stretching
Car collision
Armour destroyed.

7.3 Sound and Music

Main Menu
Time critical
Winner

8. Minimum System Requirement

§ Platform: PC
§ 1GHz Intel Pentium III or AMD Athlon
§ DirectX9 compatible 32MB 3D graphics card with hardware transform and lighting
§ 256MB RAM
§ Microsoft Windows 2000/XP
§ DirectX9 compatible sound card
§ Mouse, keyboard
§ 4x CD-ROM

9. Supporting Technology

§ The core engine of Insecticide will be based upon the Microsoft DirectX 9.0 suite of technologies.
§ Graphics Engine
§ Direct3D

Input
§ DirectInput

Audio
§ DirectShow
§ DirectMusic
§ DirectX Media

10. Game Mode

§ Single Player
§ Multiplayer


Click here for Bumper GDD in pdf

New Idea..

After a few weeks, I got a new idea of what game I want to develop. I decided to build a racing game. Since I found a racing starter kit, it will boosts my game development and make my life easier. The game basically will be a racing game as a default, but I decided to make it a bit different way, which is, a pursuit racing game. The player may be given a choice whether to be a chaser or lawbreaker. In order for the chaser to capture the lawbreaker is by hitting the lawbreaker’s car. Hmm.. simple enough. Let's put it on paper and code then.. (Analysis and development)

Thursday 14 June 2007

Getting started

When I first started the Visual Studio Express, it reminds me of Visual Basic because the interface looks like it. To create a game, it is very simple and easy. Just select new at the file menu, select game type and give a name. Once you click OK, the game will automatically construct itself.
    Hang on, don't congrats me just yet because it just one in a million steps to create a good game. But at least, the game can be run and it shows a window with a light blue screen. The codes pretty much like java (yup, I got a basic knowledge on Java). It inherits from Microsoft.Xna.Framework.Game, which is a skeleton code of a game application. This object itself free’s you from having to create a ton of boilerplate code to create the main window, set up the graphics card and a number of other mundane actions. Additionally, it links in all the various XNA assemblies, regardless to if you need them or not. Other then that, it implemented a default Constructor, the Update method and the Draw method.

Tuesday 12 June 2007

Installation

XNA Game Studio Express 1.0 Refresh can be download free of charge at XNA Developer Centre. However, there are certain requirements need to be fulfilled. A Direct3D 9.0 video card capable of supporting at least Shader Model 1.1 is a must on the machine. Recommendation is the graphics card that supports Shader Model 2.0 since many samples and starter kits require it.
Before XNA Game Studio Express 1.0 can be downloaded and installed, there are 3 more applications that needed to be downloaded and installed first. There are


1. the
latest DirectX runtime updates (the full DirectX SDK is not required)
2. Visual C# Express
3. Visual C# Express Edition SP1

When I installed Visual C# Express, I taught it was OK to proceed with the XNA Game Studio Express 1.0 installation. But, I got the error message saying that I need to install Visual C# Express Edition SP1. But I’ve tried to installed Visual C# Express Edition SP1 straight (skip file no.2), the installation won’t work. You have to install Visual C# Express Edition SP1 on top of Visual C# Express. Yup, that’s the tip if you having this kind of trouble.

XNA

I’ve decided to make a game for my MSc dissertation using Microsoft XNA. To be honours, I never heard about XNA before. For a couple of week, I’ve started finding about XNA. Basically, XNA is a set of tools, complete with a managed runtime environment, provided by Microsoft that facilitates computer game design, development and management. XNA does this by freeing game designers from writing "repetitive boilerplate code," and brings all aspects of game production into a single system. The XNA toolset was announced March 24, 2004, at the Game Developers Conference in San Jose, California; and a first Community Technology Preview of XNA Build was released March 14, 2006. The final version was released on December 11, 2006. I’ve also knew XNA not only can build PC games, but XBox games as well. Wow! This is quite interesting to further my exploration of XNA.