Saturday, September 30, 2006

Game programming from scratch

In programming there are several different... I guess I could call them branches, each requiring very different skills, to name a few we have

  • Operating System's development
  • Device programming
  • Device drivers
  • Anti-virus
  • Virus writing
  • Large Frameworks (I'm talking about .NET for example)
  • Game programming

Event just in Windows you could talk about

  • Native win32
  • Managed
  • windows services
  • web services
  • web programming
  • etc...

Game programming is one of those branches that requires a lot more knowledge on quite a few different topics than (and usually in addition to) regular traditional programming.

Game programming is something that I have always been interested in, the most I've done however, are a couple text based games and a domino game that can be played over a LAN; as part of my interests I have studied OpenGL and DirectX, I even wrote a few beginner articles on Delphi and OpenGL.

I have read quite a bit about game programming in general, enough to know that your first game should be something simple, most people trying game programming for the first time attempt to create something big like a 3D first person shooter, most people however, fail.

The guys who have been there and know game programming recommend you create something like a Tetris for your first game, even though this is a really simple game, it's got all the elements of any game

  • input
  • logic
  • animation
  • levels
  • a game loop (every game has a game loop)

Other good choices for your first game could be an steroids, bricks, pac-man. If you need more ideas you could visit sites like miniclip, they have hundreds of flash games, you can even chose to write a simpler version of a game you chose, the whole point is that you should finish it, and once you finish it, maybe you extend it, but you would have already finished v1.0 of your first game and that is really important.

These days starting a game "from scratch" is really far from what it used to be just a few years ago, where you had to create everything, maybe even your own format and format loader, and every single pixel that was drawn you had to write code for that, years have gone and now we have standard formats for models, sounds, graphics, etc. and most importantly we have plenty of frameworks to build your game on top of them.

One of the latest and greatest frameworks to create games is XNA; you can think of XNA for game programming pretty much like Visual Studio for programming in C#, it allows you to focus on the actual game (theme, logic, etc), giving you all the functions ready to be used to do most of the drawing stuff, one of the cool things about XNA is that it will allow you to run your own games in your XBox 360, it doesn't get much better than that

A couple of friends and I have decided to start writing games just for fun, we will probably start with a simple pac-man, although we'll plan on making it extensible, we'll start with something really simple.

A rough idea of what we're shooting for if we go for the pac-man would be:

  • Single world
  • Single level
  • one type of ghost
  • we'll most likely create our own graphics in Paint and create our own sounds.

points of extensibility could be

  • plug-in model to create new ghosts
  • plug-in model to create new worlds and levels

as simple as that is, it allows you to extend as much as you can, however, we have to get there first.

I will blog about all my experiences (and source code) creating this first game, I'm really hoping not to fail as many have before. Just as many guys before me, I hope to, if not help, at least inspire other people to start in the wonderful art of game programming

If you want to join me, you could start by downloading XNA and Visual Studio 2005 Express Edition, you also need to download The Wizard, which is a simple animation that will teach you most of the basics of what you need to create your first game and will help you get familiar with XNA.

Until next time

No comments: