How to layout the code of a simple game?


Question

I'm coming from a background mostly developing websites, and maybe some simple form-based apps. MVC works well for that, but I don't quite see how that's applicable to a game. So how do you guys do it?

I'm developing with Qt and OpenGL, if that's relevant. I have a QGLWidget which I'm basically using as a central hub at the moment. Should it pass off input to a Player object so that it can handle it, or should it control the player directly? Should objects draw themselves, or should there another handler for that? Basically, what goes where? Who handles what?

Links to relevant articles, answers to some of these questions, tips, or file structures are all appreciated. I don't really care about how to program it, just how to modularize nicely.

Thanks :)

1
9
8/18/2009 10:52:29 PM

Well, the cliche starting point for game development seems to be gamedev. There are a number of tutorials and articles to start from, there. It also has quite an active forum. There is also book, "Programming Linux Games" (I assume through Qt that you're using Linux), but I believe it costs money. A number of books, however, can be found on the internet, and that may be one of them.

There's also the "black art of game programming", a wiki with truly terrifying chapter titles. Here is a link to a particularly relevant chapter, though of course you can view the whole thing: Chapter 2. (archive.org backup link)

Hope this helps, - Agor

5
1/20/2013 3:26:43 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon