Tag Archives: tw9

The Basics of Game Development – for programmers

(This is a live-blog of a talk Girish Dhakephalkar of http://ShoonyaGames.com gave at TechWeekend #9 on Game Development.)

This talk is an overview of what exactly is involved in game development – from the point of view of a programmer.

These are the major components of game development.

Game Platform

A game platform is the hardware-software combination on which a game runs. These are the major game platforms:

  • Console (e.g. Xbox 360, Wii, PS2/PS3).
  • Handheld
  • PC (Windows, Mac)
  • Mobile (iPhone, others)
  • Web Browser Based
  • Arcade Machines (i.e. the dedicated game play machines you see in video-games parlours in malls)

The platform makes a big difference to the kind of games you can build. For example, consider the consoles. Here the hardware is fixed. This is good because a game is a very optimized piece of software. So the more you know about the hardware, the more you can optimize, and the better will be your gameplay. (Compare with a PC game where it can be played on PCs with vastly different hardware capabilities. Then you end up programming to the minimum requirements, which is sub-optimal for the higher end PCs.)

Game Development Team

A game development team consists of the following roles:

  • Artists – 2D/3D artists and animators
  • Game Designers – Level designers, Gameplay designers, UI designers
  • Programmers – Graphics, Gameplay, AI engine, Physics, Networking, UI, Tools
  • Audio – Sound effects creators, music composers
  • Testers (Pune has a lot of game testing companies)
  • Special mention: The Crossovers – Technical Artists, Team Leads, Tester-Producer, etc.

Not all kinds of games require all these roles. A “big” game is a huge production, pretty much like a movie, and will hence need all these roles. Smaller games can do with fewer.

Interesting points: The Physics Engine in a game is a piece of software in a game which essentially enforces the laws of physics (as they exist in the game world). When you throw an object, how it flies through space is determined by the physics engine. When you fall, what happens to you, how much you get hurt; if you kick a door, will it break. Such things are determined by the physics engine.

Networking is needed in online games. Specially, an MMORPG (massively multiplayer online role-playing game) has hundreds of thousands of people playing simultaneously, and the various players are interacting with the game system, and with each other. All of this networking has to be managed at the game servers (which are in the cloud) and the game clients (which are installed on the users PC/console).

Game Development

There are two broad phases of game development.

First there is “content creation”. This includes things like creating the characters, animations, levels etc. This happens offline, before the game is “released”. The tools used are Maya/Max, Photoshop, Sound creation tools, and Game design tools. The other big chunk of program in a game software is the “runtime”. This is the server and the engine which interacts with the user and renders each frame of the game, and controls the game play.

The fundamental difference between animation and graphics in games and anywhere else is the “realtime” nature of the rendering. When doing animation/graphics for a movie, everything is computed beforehand, and it is simply displayed/rendered at runtime. However, with a game, this is not true. You need to keep gathering input from the user (for example, the current position of the user), and change the animation appropriately. So, the animation needs to be auto-created at runtime based on the inputs, and this needs to happen at 30+ frames per second.

Going below 30+ frames per second is just not permissible – the game will not feel smooth. Hence, the only thing you can compromise on is the quality/resolution of the graphics. Hence, in terms of pure graphical output, a pre-rendered video is always going to have better possibilities than what is possible in a game.

In any case, in most games, lots and lots of optimization happens to be able to render high quality graphics at 30+ FPS, using the best possible software and hardware combination. Thus, most games will try to use the graphics cards of the hardware to the fullest extent possible. All modern graphics cards are programmable in the sense that common graphics operations (like shaders) can be offloaded to the graphics card. The game engine will have sophisticated software that pushes as much work as possible to the graphics card.

The Game Runtime is broken up into two big parts. First there is the basic engine, which can be thought of as a framework for building games, and has building blocks like rendering, animation, physics, networking, sound. Another major feature of an engine is that it allows easy creation of different kinds of games, characters, levels, and general purpose scripting.

Thus, the idea is that there is a generic game engine which is not necessarily tied to any specific game, and on top of this, various different games can be built by the game designers. Typically, the same game engine will be re-used by a company to build and release many different games.

A game engine will typically come with “game creation tools” which are separate pieces of software which allow you to “author” games. Typical workflow: an artist uses tools like Maya/Photoshop to create the basic content, and the level designer of a game will use the game engine tools to import the basic content into the game. You might create a character in Maya,

Examples of game engines: CryEngine (Crysis, Far Cry, Aion: Tower of Eternity), Unreal Engine (Unreal Tournament, Unreal3, Gears of War. http://udk.com is available free for non-commercial use), Source Engine (Half Life, Counter Strike Source), Unity, Torque (Casual/web-based gaming).

Components of a Game Engine

  • Graphics renderer: all the computer graphics calculations (including ray tracing, lighting, refraction, reflection, etc). Crysis (the game) looks very good because the CryEngine graphics engine is very good.
  • Animation system: Define how your characters move. This includes defining the walk cycle (i.e. one full step of the character walking, which is looped to show a walking character).
  • Scene graph: A level in a game is a huge 3D (or 2D) space, with lots of things – characters, objects, lights. All of these need to be defined and instantiated. These need to be held in memory while the game is playing. Knowing what objects are where, and keeping track of them in memory is the job of a scene graph. The renderer shows you the view of what is currently visible to you, while the scene graph keeps track of everything that is “nearby”, and is the one who calculates what is and is not visible (and should hence be sent to the renderer).
  • Physics: As described earlier, the physics of the game world. When things are thrown, what is their trajectory. If something hits something else, how much doe it bounce. Compute the mass, the force, the acceleration, and apply the Newton’s laws (or another set of laws, if the game world has different physics than our own).
  • Networking: This most programmers should be familiar with.
  • AI: This is what actually defines how different characters (the computer controlled ones) behave and react. Note that you’re not always trying to create reality, or “human” behavior. All you want is a fun experience – not necessarily realistic.
  • Audio: Sound effects, and voice-overs.
  • UI: The interface for the game. Including inputs, options, etc.
  • Scripting: While the basic engine is programmed in C++, for defining what happens in a game, a low-level programming language like C++ or Java is not an ideal language to define the “gameplay.” For this, a scripting language like Lua, or Python is used. Or, like Unreal Engine, the engine might have its own scripting language. Compiling a game takes a long time (more than half an hour for a big game), so you definitely don’t want to write your game logic in a compiled language and require a full compilation every time you make a minor change.

Who would be interested in Game Development

If you want to make a career in game development, these are some things to think about:

  • You need to be interested in games, and should have some knowledge of games. That will make work more interesting
  • You should have played, and analyzed a variety of games – that way you know and understand what are the different possibilities out there
  • You should like working in a team. A game development team can be 100s of people, all working together to produce a single game. And if you’re not really a team player, you will not be able to function properly.
  • Good communication skills. A game development team has people from many different teams, with different backgrounds, and if you’re not good at communication, especially written communication, you might run into problems.

Once you’ve become a game programmer, you’ll find yourself using these skills a lot:

  • Mathematics!!
    • Linear Algebra: matrix operators, vectors, quaternions
    • Co-ordinate systems (remember your geometry?)
    • Trigonometry – basics, like 10th/12th std. level
    • Laws of physics (laws of motion, angular velocity/momentum etc).
  • Programming
    • C/C++. .NET, C# for tools. Scripting languages (python, lua).
    • Object-oriented programming.
    • Writing optimized code

But here is the biggest reason why you should get into game development:

  • Game development is at the cutting edge of technology. All the latest and best technology is used in games first, and only slowly and later does it trickle down into other fields of programming. Game development is the F1-racing of programming.

Links

Lookup these links for some further interesting reading for games.