Tuesday, June 30, 2009

Gods Of Game Worlds

A philosophy

One of the traditional concepts behind the world’s origin is that, GOD created the world. He created us, our thoughts, and influences our decisions that we make everyday. Whenever the world is compared with a video game, the game developers will become the Gods of their own game worlds.


The evolution

Game developers define their own worlds. They write software code’s that thinks, the code that learns the user experience, and the code that compete the player. The face of video gaming had vast transformation with the improvements in the technology. The industry has travelled a lot from the old PC MAN game to the new 3D Games with astonishing photo realistic appearance. The industry grew up and companies started producing specialized devices for gaming. Gaming consoles such as Microsoft Xbox as well as Sony’s PlayStation are the examples. Wolfenstein 3D is known as the industry’s first smooth scrolling action 3D game, which run on MS-DOS platform.




What is happening behind the scenes?


Gaming was an area that people rarely focused in times. This one requires a specialization of the following disciplines such as Math, Physics, Artificial Intelligence and programming languages such as C /C++ and sometimes Assembly. People used to play video games, including me. Developing games can be different. It might be a few people who actually took it as a serious business. From my experience, I can say, it is a serious game enough. We can say,
“Developing a game is not a game”, because sometimes it may seem tougher or strange for a conventional software programmer when he comes to video games. The approach developing a conventional software system is entirely different from the approach for creating video games. Where performance is a significant factor, say the number of frames rendered per second. For this, the developer had to think even about the memory alignment of variables he declared within the game source code. Unlike conventional software programs, There is a limitation for one to debug the whole code, such as tracing, stepping into the code while execution. One of the difficulties of doing so is during execution, when the game takes direct control over your PC’s input devices and display; the situation can be a bit sour. To overcome this, try to keep all your codes as precise as you can, so that you never had to look back.


Coding: Let’s keep things extremely modular

Keeping the development modular is a wonderful approach to make things easy. Not only in game programming but in generally it is a good practice for developers. It says; avoid dumping all the codes within a single module or method. Just split it, and solve. Like the philosophy says “Divide and conquer”. This approach might be having no significance when you develop a clock application or a calculator. But whenever you invest your time to do bigger and complex things such as a 3D video game or robotics, just stick on
the right approach before thinking about the ‘Tool’ you are going to use. In this case the ‘approach’ sounds more important than ‘Tool’, because this is something that let you reach the goal with a greater level of perfection.


Where to start?

To start, let’s reverse engineer a simple game. I remember one game I played in school times. ‘Paratrooper’, where a gun turret positioned on the ground which is can be rotated and is capable enough to aim at the paratroopers coming out of the helicopters roaming across the screen. The ultimate aim of the player is to destroy the paratroopers in the air before they can reach the earth to blast the player’s base. Also some Jet planes can shell bombs on the gun turret, if it happens, the player loses. Whenever the player hits those paratroopers, then he scores.












In the above game, there can be the following functionality that a developer has to implement. That is,
a) Draw/Update the screen entities (such as gun turret, helicopters and paratroopers)
b) Handle Inputs

c) Collision Checks
d) Calculate scores


Now, the game application will be executing the above steps in a loop.


BOOL bEndGame = FALSE;

while(!bEndGame)

{
DrawObjects();
bEndGame = HandleInputs(); // if bEndGame has value 'TRUE', the game ends.

CheckCollsion();
CalculateScores();
}

This is the basic approach of writing every game. The approach can be extended further to make more complex games, such as an AI procedure that make the player an illusion that the opponent makes intelligent moves.

Things will change a bit when it comes to 3D. Game developers first develop a Game Engine Software Modules, which is actually a Library or a Framework that makes its easier to develop games without drilling much into Physics and Math. The game engine provides a productive way of game development. Whereas, developing a game engine need a bit specialization in Math and Physics. The responsibilities of a Game Engine can be,


High Level Object Management

User can load a particular level and its associated entities from a file. The level data in the file can be arranged in a complex way. The game engine provides an easy, programmer friendly way to manipulate these objects through a set of classes. This object can be a game level, a character animation or an object that deals with the character’s decision making data.


I/O Management

I/O Management may be referred to the management of the hardware input devices as well as the file system that game use. Some games use a virtual file system which allows the manufacturers/developers to port the games on multiple platforms which has entirely different file systems. It also refers to the resource caching, pre-fetching the level items when the player approaches a particular zone in the game map.


Memory Management

Often most of the games use own memory allocation policies for the optimal usage of memory. Games often use specialized memory management pool to allocate memory from a huge block which is wholly allocated at the beginning of a game. For this purpose, programmers often override the ‘new’ and ‘delete’ operators of C++. Otherwise the operating system will use its generic behavior to allocate and de-allocate memory. If you don’t override this behavior, you can see the game crawling when the memory allocation takes place from the virtual memory.


Visibility Culling Module

Visibility culling means, not rendering the screen objects that the user is less likely to see from a particular position. There are various methods employed to make it possible. The type of culling is merely depending upon the type of game we develop. If it is an indoor game, portal culling method will be the best. This is one of the most commonly used approaches in the industry to develop indoor games such as First Person or 3rd person shooters. This approach is used in conjunction with either Binary Space Partitioning Trees Octrees. These are data structures used for partitioning and storing the game world. This is a vast area which is still under research for more possibilities.


The Game Level Editor

This is an application often shipped with the Game Engine, where people can use this application for creating game’s content, means creating the games level geometry, such as the rooms, chairs, fans, positioning the opponents, setting up triggers…etc. Level editor applications are specific to games. Most advanced game engines provide scripting where the developers can spend much time into scripting than programming. Also you can use an industry’s commonly used 3d modeling applications like 3dsMax or Maya to create your game content.


Final words

Professional game programmers claim that if you are into game development, then you are actually trying to shoot down a moving target, because the changes in the computing technology primarily affect games. This increase in enhancements continues until the developers create game worlds that are almost close to the real world we live. This is what actually the ultimate dream of every video game developer.

Friday, June 19, 2009

Let’s think out of the box

What does that mean exactly? Yes, all it says “Think broader, and think different”. World expands every time when someone think out of the box. If someone remains inside the box forever, his vision shrivels. Many people in this world who potentially changed this world are out of box thinkers.

Our society is built with some basic rules, the usual happening here was that, if someone intercepts these boundaries will be penalized, or the society is going to stare at them very strangely. This happens often, it continues as long as the people’s mind remains within the box. Now I’d like to emphasis on the quote,

"A reasonable man adapts himself to his environment. An unreasonable man persists in attempting to adapt his environment to suit himself. Therefore, all progress depends on the unreasonable man."

-- George Bernard Shaw

That was a wonderful quote from George Bernard Shaw. It holds the same thing. An unreasonable man makes all the progresses, so he belongs to the “Out of Box” thinker category. He is the one who less stick on the present rules. He is the one who pushes the borders and re-establish the new ones. There are some many public figures in this society for unreasonable men or out of box thinkers. The prime category includes scientists, technology inventors, or whoever trying to push the limits. A new invention means an outcome of an Out of Box thinker’s efforts.

In our educational system, people are trained to obey conventional rules. Many people hate to make mistakes. A few are trained to make experiments. Many of them not bothered to expand the borders of the society that they live in. Life is simply a routine for almost all the people.

Almost all of our scientists in our history had faced bitter experiences for out of box thinking. An out of box thinker often face criticisms and ridiculous responses if people can’t properly value what exactly he is trying to express. He remains as a fool until he establishes himself with the outcomes of his innovative thoughts.

The first motto of an innovator or inventor must be “Break the rules!” and “Think out of the box”, strongly holding the fact that it will not harm others.