Skip to main content
gamedev.net
🔒 Locked

game code structure

Started by mutinousmunkey Mar 13, 2005 at 10:10 PM 9 replies 2.9k views
Original Post
mutinousmunkey
mutinousmunkey
i've been looking around here and google and i cant find articles/tutorials on how to actually set out a game, i can only find tutorials on specific parts of programming e.g. ai, graphics etc. Where can I get an article that actually explains specifically (with code and pseudo code) how to structure a game, and set things out??? I can write the code in DirectX to do whatever I need, i just have no idea how to structure a game - because what i have now, just doesnt look right. any help appreciated
cozman
cozman
I've never seen a good online tutorial on this, there are a few books that present complete games that might be a good idea to look at, in lieu of recommending any books I'd recommend a trip to the bookstore, find a book that uses the language/libraries you're interested in that presents a (semi-)complete game.

Perhaps you could go to sourceforge and find an open source game (keep it relatively simple) in the language of your choice and have a look at it's source. It might not be that easy at first, but learning how to read code that you didn't write is an important skill.
mutinousmunkey
mutinousmunkey
Im looking for something made with DirectX using C++
cozman
cozman
The API shouldn't matter much, if you're using DX looking at an OpenGL game in C++ should work out alright for you if you're just trying to get the idea of how a game is structured.
ElJoelio
ElJoelio
I learnt (read: stole) my style of engine design from working on an Unreal Tournament mod. In lieu of a full explanation of the UT engine's design, I will say it is heavily object-oriented and well structured.

Perhaps you could make a simple mod for an existing engine (or a few different engines) in order to get a feel for how other people do it?
mutinousmunkey
mutinousmunkey
thats a good idea but.. there must be some tutorials or ebooks on game code structure, I think its a really important aspect, which I have never seen anything on.

Maybe when I learn good structure I will write a tutorial!!
mutinousmunkey
mutinousmunkey
anybody??

*sorry about this bump, I really need help here, thanks*
Cygon
Cygon
This normally comes with experience and there are thousands of variants in which you could set up your game's object model. It's sad that, to my knowledge, nobody took the time writing an introduction or something explaining a good architecture so far.

There's always a certain battle about having everything as modular and reusable as possible versus actually making substantial progress by hacking together what you need. Anyway, if you can gain some actual experience in object oriented design, it becomes less of a trouble to create a usable object model for a game, even when you're not planning everything ahead. The learning process involves lots of rewrites and failures most of the time, however ;)


It might help to look at some of those books guiding you through the development of a complete game. I you've got the time, you can also find the source code of some older full-price games on the net, thought I don't think there's much to learn from those codepiles developed under ridiculous deadlines...

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
DGates
DGates
Here's a couple games written in C++/DirectX 8 with full source.

They were both written as part of a games programming course. They are fairly basic from a code point of view - ie. no fancy shaders, etc. and the code base is not huge. If I remember correctly, they compile with VC++ 6. Of course you'll need the DirectX 8 SDK as well.

Sci-Fi Showdown
Critical Care

enjoy!
mutinousmunkey
mutinousmunkey
thanks for the help, but i found this in the article section as part of a series:
Article1294

it includes a small diagram on how the game should be structured

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.