Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to make various sorts of games throughout the past few months, I've had several false starts (currently using python + pygame). I find that what happens is that I get a first pass of the basic mechanics working, and then I find it impossible to proceed because the internal organization of the game does not scale up well. What typically happens is that after I get a working prototype, the complexity of the code is at a manageable level. Then I add a new feature, and the complexity increases, and another feature, which leads to more complexity. Soon enough, the complexity is unmanageable - there are so many special cases that it becomes impossible to account for all of them.

How should I deal with this kind of problem? Is there some kind of technique of abstraction that I am not applying? Do you know of any resources or guides that might be useful here? Or am I just bad for not being able to deal with a little complexity?


migration rejected from Nov 5 '13 at 19:43

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Josh Petrie Nov 5 '13 at 19:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started" or "what should I learn next" cannot reasonably be answered with anything other than opinion polling and therefore are off topic for the site. For more information on how to ask a better question, see the help center" – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

OO design is a pretty common way of abstracting complexity behind manageable layers (although by no means the only valid way of doing so). There are plenty of good resources on the topic, such the ObjectMentor series of articles on core OO design principles.

Reading those and other articles on OO or abstraction and dependency management in general will certainly help you, but they won't necessarily be direct solutions to your problem.

What you should be doing is examining the state of your code and your systems at every juncture, particular when you are adding a new feature or subsystem. Look at the code, look for things you can refactor or clean up in some fashion -- repeated code, overly complex interfaces that require too many parameters or are not self-contained. Clean those up; harden the code and the API design until you are satisfied with its complexity before moving on.

It sounds like you might have simply been driving forward with feature development on your projects without spending adequate time doing postmortem analysis on each new feature you added to see how you might have improved it once it got working. If you do that, and also if you pay attention to the eventual design/scalability problems you do run across (write them down if you must!) you'll start to develop a better understand of how to craft things properly the first time. You'll rarely ever get it right the first time -- but you'll eventually learn to get it right within a very small number of iterations.

If you're having a hard time doing that kind of analysis, you could certainly post another question here outlining a specific scalability or complexity problem you're having in your current code and get some specific, directed advice on how to improve it.