Structure and Best practises

Hi, I was wondering if anyone could point me in the direction of an article/whatever, that gives some pointers and best practises on how to structure your game code. I seem to end up tieing myself in knots when my game gets large, so I’d like a heads up from the outset to make my life a lot easier and my game easier to develop!
Many Thanks

that’s a huge topic, you probably won’t find a 3-page article or something like that on the web, because every game is so different from all the others.
personally i learned very much about programming when i learned C, it’s a really structured language and you always know pretty much exactly what the computer is doing at any time, that way you get to know how the computer works and can modify your code according to this knowledge.
another way to avoid “code-mess” is a good and detailed planning before you start programming, most people just want to start making games and underestimate this step, but you could probably already have avoided some of the problems you have run into. make a list of what you want your game to do and what not to do, which scripts do certain operations and why they even have to do them.
either way you won’t get around earning your own experience, if you take your time solving all the little problems you are having right now, you can learn alot from them and won’t have them in your next project(s).

Don’t give in to the temptation of doing quick hacks or workarounds in your code. Do things the right way even if means spending time doing boring things like rewriting routines to properly support new functionality, because you will save yourself a huge amount of aggravation later.

–Eric