Where can I find good (well organized) examples of game code? I'm hoping that I can pick up some organizational tips. Most examples in books are too short and leave out lots of detail for the sake of brevity. I'm particularly interested on how to group your variables and methods so that another programmer would know where to look in the code. For example initializers at the top, then methods that take input, then methods that update views.
I don't care about a particular language, as long as its OOP. I looked at the Quake 2 and 3 sources, but they're straight C and not much help for getting tips on organizing your objects.
So, have you seen some good source? Any pointers to code that makes you say "wow, that's well organized" would be great.
Answer
Several commercial games have had their source code released. Some of the games are listed here. There's no guarantee that the code in these is well organized, but by looking at some source code from games that were commercially successful you might get a good idea what works in practice.
Also, while not a game, OpenSceneGraph has many of the components of a game and is well architected in C++, using different design patterns, plug-ins, etc. It's a big enough code base and has been around long enough that you can learn a lot from it.
No comments:
Post a Comment