Saturday, September 29, 2007

On Game Development

Due to my recent lack of success in game development (a 3D FPS is quite a challenge at times - more on this later), I've decided to go back to the first game I wrote - a simple "Pong" clone with a couple more features and a nasty AI.

My 3D FPS works nicely, it loads levels and you can move around in them, but I never got collision detection setup in the engine, or any guns or any FPS-related stuff. I was mainly concentrating on getting a scripting engine setup for it, and after I got boost::python to work in the engine I realized most parts of the engine needed to be rewritten anyway because they were slow and causing massive code bloat.

My old Pong game works nicely as well. You can load it up, select the difficulty level from the (extremely) rudimentary menu, and the AI can get tough. Unfortunately it was plagued by my lack of knowledge of the DirectX APIs and hence code is scattered everywhere in an attempt to make a working game.

The new one will use a simple structure to do its work - not one massive procedure called every time the screen needs to be rendered. With a separate procedure for AI, physics, and drawing, the internal code base becomes much simpler and easier to work with. Monolithic functions (ie, those with > 100 lines of code) will be split into multiple (smaller) procedures.

And, possibly one of the most important things, the menu will be separated from the main game loop.

I don't know what I was thinking when I wrote the first revision of Pong, but for some weird reason I decided it'd be a good idea to put the menu code into a conditional block:
if( inMenu )
{
// do menu stuff
}
else
{
// do game stuff
}

The initialization for the menu was a bunch of hacks to get a bunch of strings into an array - now I know better methods for doing this. Often the menu strings would mingle with each other and end up becoming quite confusing.

The new game will hopefully fix all these bugs in the initial code base and utilize the full power of DirectX 8 (instead of DirectX 1 which I was using before). The final planned feature is something that all my friends suggested after playing the first version - "Add networking". It should be fun to write a basic protocol that updates paddle and ball position for a single client. Or even to have a fancy "spectator" view and a "tournament" mode for those who wish to have a LAN party with a bunch of mates.

It shouldn't take too long (hopefully no more than a month) and I'll post a link to the final binary when I'm done.

Friday, September 28, 2007

Gaming: Pick up and Play or The Epic?

Has anyone noticed a trend lately in game development?

We have near-realism in our graphics (see some screen shots of F.E.A.R or Half-Life - they look incredible), with advanced sound systems that allows us to hear something "behind" us, and artificial intelligence that makes your enemies seem that much more real. Games almost make us feel like we are playing a movie.

Who cares?

Why is it that a simple game, with terrible graphics yet a fun concept, can leave the player entertained for hours?

Yet, after viewing screenshots and attempting to play a game called "Ragdoll Smasher" (see here), I realized that this guy had figured it out. The graphics are simple (at best) and sometimes a bit jerky, and there's no story, but you can sit there for hours throwing bodies around trying to knock over the obstacles.

Another simple yet fun game is "Thermonuclear War" (see here) - basically, you have a bunch of nukes and blackness in which to nuke. Take out all your enemy's cities, you win. It's written using the Windows console, so it's not gorgeous, but interesting nonetheless.

Small and simple games like these can become quite addictive, because you don't need to spend a long time at the computer to be engaged in the gameplay. They're literally pick up and play games. For a casual gamer, such games as Ragdoll Smasher (for the violent types) and Thermonuclear War (for the control freaks) can often be a quick boredom buster.

I don't want to discount the success of Half-Life (or other similarly successful games). They are excellent games and a lot of hard work has been put into them. But if I just want to play for a half an hour, I won't be satisfied with my progress in Half-Life as compared to a win in Thermonuclear War.