Game development using FOSS
Nov/095
Zombie Driver from EXOR Studios uses OGRE – http://www.zombiedriver.com
Creating games are like creating movies. They take a whole lot of time, a whole lot of effort, a whole lot of people and a whole lot of money to make… or I thought so in the beginning. Then I bumped into independent developers who were making games on shoe string budgets and going head to head with bigger production houses with million dollar budgets. Game development doesn’t necessarily mean that you have to know programming, but this article has its focus on development rather than anything else. Graphics programming is different from your regular application development. Regular applications are event driven. Games are not.
Event driven applications are almost all applications that you use almost every day, like a calculator or a spreadsheet program. Applications that wait around for user input to move along.
When I started working visual Basic a long time ago, I didn’t really know anything about how games worked, but I was pretty much used to the idea of event driven applications.
Torchlight from Runic Games uses OGRE – http://www.torchlightgame.com/
Higher level languages like visual basic take care of a lot of low level work using intermediate runtimes leaving you with a bit of reduced flexibility unlike when dealing with the core platform itself
Even later after switching over to c++ graphics programming still remained an elusive dream that left me confused about making games because none of the applications I wrote up acted like games; they rarely acted for that matter and then came the game loop.
The Game Loop.
Zero gear from Nimble bit uses OGRE – http://myzerogear.com/
The game loop is the heart of the game. It is a regular loop that continuously executes commands that keep the whole game world and its occupants running. There were only ideas in the beginning. To move something on screen, I could use a loop or a keyboard input event, yes, that was all good too. But my program flow was stuck in the loop or that specific event. If a car was being moved by my arrow keys, nothing else worked while that happened. To make my whole game world live and make everyone happy, the Pros of the black art of Graphics Programming came up with something called the game loop.
Regular applications waited around for input, our game loop looks something like this..
bool bGameRunning; // variable to hold a boolean if the game is running or not.
int main() {
initWindow(); // we create and initialize a window
initGraphics(); // we initialize the graphics interface
initSound(); // inits sound interface with the sound hardware
initInput(); // initialize input
initPhysics // initialize physics
initNetwork(); // initialize network
bGameRunning = startGame(); // starts game returns try if all went well
while(bGameRunning) { // this is our loop, while the game is running keep looping
updateInput(); // updates the Input
checkCollision(); // check for collision player position + world + NPC
updateAI(); // update all AI/NPC in game
updatePlayer(); // update player according to input
updatePhysics(); // update Physics of the game world
updateServer(); // send messages to server + other players
updateGame(); // update game, see it has ended or not
updateDisplay(); // update screen according to all changes
}
return 0; // game ended, program flow exits the loop and we exit the program.
}
A constantly updating chain of commands keep the game world and its creatures alive even when there is no update from the user. As you can imagine, more functions and functionality would be added on to the list for handling things like networking, audio, sound, music, more input devices, physics etc… As this system grows, you should bring your object oriented programming skills to the table to classify the right objects where they belong. With that, you might have gotten an idea of what game development might be like. There is a heck of a lot more!
What tools and technology you use largely depends on how you would want to go on developing the game. Game development involves a whole lot of tools and technologies – from your content creation pipeline to developing tools for your game to the actual game itself. A great deal of assets for the game are created using software like Autodesk’s Maya and 3D Max. Development usually takes place using very expensive IDE’s and management software like Microsoft’s Visual Studio and the like. If you are not making middleware(software and technologies that facilitate the job of a middle man in game development; could range from file formats, or 3d, Physics, Network Engines to Whole Game Engines) then you would be using them and they don’t come cheap. Apart from indie licenses of some Game Engines(Torque to name one) most of all middleware is expensive and come with very restrictive licenses. Enter Free and Open Source Software.
Operation Barbarossa – The Struggle for Russia from Binary Evolution Studios uses OGRE – http://www.binary-evolution-studios.com
You can save a lot of time and money by carefully selecting a set of FOSS tools in your game development life-cycle. Apart from saving time and money, FOSS tools and technologies have been time tested and molded into what they are by strong communities of developers as well. There are a plethora of tools and technology our there to help you get started and get along . So let us look at some of them
Graphics Engines and General Purpose Libraries
Graphic engines are libraries that interface with your graphics hardware and draw everything you see in your game. You can start writing this component from scratch focusing on propriety DirectX or free OpenGL, both industry standard interfaces to Graphics hardware. Writing one would involve selecting an interface, what scene graph algorithms to use, how to load and manage 3d data and how to send it to the graphics hardware, creating means to setup light, working with textures, animation, IK and a whole lot more. You can save a lot of trouble and jump into developing your game rather than spending a lot of time deciding how you do translations to matrices by selecting a readymade Engine who does this all out of the box for you.
Victory: Age of Racing from Vae Victis uses OGRE – http://www.vaevictis.it/
There are many free and open Graphics Engines out there; OGRE, Irrlicht, Crystal Space, Panda3D and the Blender Game Engine are some that stand out from the rest. Blender is mainly a 3D modeling and animation software. It can also do Post production work like editing and compositing. Apart from serving your content creation pipeline, it has a powerful Game Engine as well. Some of these Graphics Engines go out of the way to provide you with not only graphics but other functionality like GUI, Input, Post Effects, File management, 3d functions, Math etc.. as well at times.
The list of libraries can go on and each has its pros and cons, testing and selecting the libraries that you require solely depends on the kind of game you are developing and the requirements you have.
MotorM4x from The Easy Company uses OGRE – http://www.theeasyco.com/
There are a lot of general purpose libraries like the infamous SDL, ClanLib, Allegro, SFML that does a lot more than talk with your graphics hardware, Providing file system functions, File management, Math, 3D functions, GUI, Input, Networking to name a few.
There are more libraries like the OpenSceneGraph, OpenGlut and FreeGlut that deliver smaller frameworks for your 3D application needs
2D development
There are some libraries that you might want to make use of like the HGE(sadly on DirectX and for Windows only) for your gamedev needs. Others like Allegro, ClanLib, SFML are also nice, but the learning curve might seem a bit more steeper.
Helper functionality – Image, Video, Sound, Networking
Image loading and Image functions are sometimes required, again depending on the nature of your game and application. There is the infamous DevIL (Dev Image Libary) or you can try your hand with FreeImage or libPNG. Most of the graphics engines have built in capabilities to load, create and manipulate images at a very basic level.
Jack Keane from Deck13 Interactive uses OGRE – http://deck13.com/com/index.html
Some graphics engines provide functionality to decode video and render them to textures out of the box; but for others you can always use libraries like FFmpeg, XviD or Theora.
For rocking your audience with the right amount of music, the best option for you would be to use a library like Audiere. OpenAL also provides you solid methods to access your sound hardware for your game or application with minimal hassle. libMikMod and Ogg Vorbis is also worth trying out. BASS and FMOD have to be mentioned since they are awesome too(free for non commercial use only). Then again, if you are lucky enough, your 3D Engine might already have a wrapper for for some audio library saving you the trouble of rolling out your own.
Networking is an option you might want if your are going for a multiplayer game. RakNet or OpenTNL are easy to use high level libraries especially developed with games in mind. You can try out the networking options present in SFML if you are game as well. There are low level alternatives which would be a bit harder to understand and implement like the Boost ASIO, HawkNL etc..
The Extra mile
There is always something more to add. If you are coding up an editor for a game, a great addition to it would be a scripting element. Lua being the most popular around with scripting languages like Python, Ruby, AngelScript and even Javascript following right behind. Squirrel, GameMonkey and even ChaiScript(http://www.chaiscript.com/) are popular options too.
Torchlight from Runic Games uses OGRE – http://www.torchlightgame.com/
For your games to react and work like the real world, you need real world physics, just like picking up every other library we did, we get to choose from some wonderful physics libraries that simulate real world physics. Two libraries that you must look into are the Open Dynamics Engine(ODE) and Newton Game Dynamics. There is also Tokamak and the now commercial Novodex aka PhysX to check out too.
To add a bit more of life to your NPC, you can always turn to AI libraries like OpenSteer and MicroPather. FEAR is also something you might want to look into.
You can always use more tools in your toolkit and when its FOSS tools its even better. Boost libraries are something you can always rely on when providing random numbers or be it giving you smart pointers. wxWidgets(http://wxwidgets.org/) can provide you with an easy interface and GUI for your game editor in no time. Doxygen to document the functions you make and NSIS to pack your game and to send to all the gamers around. With these many awesome tools and technologies in your arsenal your Game Development needs are pretty much covered. All that is left to do is go make that game!
Links to all libraries mentioned here can be found here – http://www.twilightsembrace.com/personal/gamelibs.php – The list is maintained by Ben Sizer. A similar list can also be found – http://www.ebonyfortress.com/blog/free-game-development-libraries/ The Free Resource Thread in the gamedev.net contest forums can also be helpful to get you started – http://www.gamedev.net/community/forums/topic.asp?topic_id=324643 . If you are an indie or if you just like making games like the rest of us here do drop by to http://indiegamedev.in/ or follow us @ingdin on twitter. You can also find us on facebook here : http://www.facebook.com/pages/Indie-Game-Development-India-Community/101358037519
All Images are from the Ogre Showcase Forums and Ogre Flickr Gallery – A word about Ogre, OGRE (Object-Oriented Graphics Rendering Engine) is a scene-oriented, flexible 3D engine written in C++ designed to make it easier and more intuitive for developers to produce applications utilising hardware-accelerated 3D graphics. The class library abstracts all the details of using the underlying system libraries like Direct3D and OpenGL and provides an interface based on world objects and other intuitive classes – http://www.ogre3d.org
Ogre Gallery – http://www.ogre3d.org/gallery/
Ogre Showcase Forums – http://www.ogre3d.org/forums/viewforum.php?f=11&sid=3a4c8230b5decd5d06b384a15c997d97
Note
This Post was first posted on – http://osscube.com/blog/game-development-using-foss
Leave a comment
No trackbacks yet.















on November 3rd, 2009
Nice summary. You could add OpenAL and irrKlang the list of Sound libraries, to make it complete.
on November 3rd, 2009
Very interesting, if you don’t mind me asking what are the two racing games shown, and what is the ogre game shown? They look really cool.
Also i’m a web PHP programmer with some Java skills is there any good beginner places for C++ Game dev training you would recommend?
on November 3rd, 2009
Don’t forget the excellent chipmunk physics library. http://code.google.com/p/chipmunk-physics/
on November 3rd, 2009
nice, what games are those on the screenshots?
on November 4th, 2009
@ZedsDead
I did mention OpenAL but not irrKlang.. irrKlang is free for non-commercial use like fmod and bass
@Jordan
There are places that teach you game development like fullsail – http://www.fullsail.edu/ or GuildHall@SMU – http://guildhall.smu.edu/ .. even then it would be nice to start out on your own to get a feel of what you are getting into..
This could be a good place to start – http://www.gamedev.net/community/forums/topic.asp?topic_id=251811
the people there(at gdnet) are really nice and helpful =^_^=
@Blacktiger
yes! :) forgot to mention a lot of actionscript -> c -> c++ 2d physics libs :-S
@Christian
I’ve added captions for the images..
The games are..
Zombie Driver from EXOR Studios – http://www.zombiedriver.com
Torchlight from Runic Games – http://www.torchlightgame.com/
Zero gear from Nimble bit – http://myzerogear.com/
Operation Barbarossa – The Struggle for Russia from Binary Evolution Studios – http://www.binary-evolution-studios.com
Victory: Age of Racing from Vae Victis – http://www.vaevictis.it/
MotorM4x from The Easy Company – http://www.theeasyco.com/
Jack Keane from Deck13 Interactive – http://deck13.com/com/index.html
Torchlight from Runic Games – http://www.torchlightgame.com/
and sorry about all the spelling errors.. :-|