Proper Game Structure

Started by
7 comments, last by batmansDad 17 years, 1 month ago
I have been working on an engine for a few months now, I am happy that I have the engine in a stable condition that I will try my hand at a game using my engine. I have made basic games in the past such as Tetris, a bust a move rip off etc. While they worked I often felt they were chopped together and the design really wasn't there. Because the game I want to make is a tad more complex than Bus'A'Move, I really want to focus on proper game design and using good structure. Granted the game is small and manageable but I still want to get into good habits early on. So my question 1. Any tutorials on making a good game structure 2. Any recommended books that cover making a game (Not via scripting & that doesn't focus primarily on the engine, math etc, something that focuses on gameplay) 3. Any small existing open source games that have a good structure? Thanks...
Advertisement
Moved to For Beginners.
from experience I have learned that there is no substitute for experience. Now I just start programming and constantly refactor. The overall structure evolves naturally. If your code starts to become unmaintainable in one aspect you go in and fix that part. Maybe someday I will have the experience to write each part once but not yet. I used to think that I could just plan it all out ahead of time but that simply isn't true. You see in programming the code is the design. You don't build software, your compiler and linker build the software.
I believe what you are asking for is in reference to the "Main Game Loop".

If you already have your engine coded and working, then that code will basically sit in the background and come to life when called.

Main Game Loop...

main.cpp
-- Game Init ( loads all necessary game files such as models, graphics, ai, physics stuff, ect. )
-- Game Loop ( gather input from user, manipulate objects in world based on user input and/or world effects, render the world )
-- Game Shutdown ( release the hounds )

If your game is a windows based game, then the game loop will be structured within the windows messaging system.

Hope this helps.
Paul.
Quote:Original post by batmansDad
So my question

1. Any tutorials on making a good game structure

Unfortunately, no (or, more exactly, I haven't found any). To be even more pessimistic, I'd say that most of the time, you feel that your software structure is good (or not good), and I don't know many authors that are able to go from that feeling to a good, clear, concise, formal view of how to correctly design a software (be it a game or something else). So there's little resource on the web and outside on this subject (although I found some books that I'm investigating. For example, "The Object oriented Though Process", by Matt Weisfeld, seems to be quite interesting. Same goes for "Object Oriented Design Knowledge" by Garzas, Piattini & al. But I still have more to read before I can post some good advices regarding these books).

Quote:Original post by batmansDad
2. Any recommended books that cover making a game (Not via scripting & that doesn't focus primarily on the engine, math etc, something that focuses on gameplay)

"A theory of Fun for Game Design" by Raph Koster is quite entertaining. Adams's books on game design are also very good.

Quote:Original post by batmansDad
3. Any small existing open source games that have a good structure?

Isn't that a paradoxical statement? [smile]
I was going to make a post similar to Emmanuel's, but I got called in to a meeting and he beat me to it. C'est triste!

Aside from EG's excellent recommendations, I don't fully understand your question. When you say "game structure", do you mean the design of play elements from the player's perspective? Or do you mean programming elements like gamestates and model-view-controller relationships?

I guess my confusion stems from not knowing where your engine ends and your game begins. As an example, I'm using the irrlicht engine in C++, while all my game logic is in Lua. The main loop, the game states and character stats are all in Lua, while the scene graph, renderer, GUI, etc. are in C++ in the irrlicht engine/framework.

If you could provide a similar demarcation in your engine and clarify which part you want advice on and the nature of the advice, I think I could be more helpful.

As an outside guess, you could always look up Dave Eberly's Game Engine Architecture book. I don't like many of his implementations, but his design is good and the implementations work.
XBox 360 gamertag: templewulf feel free to add me!
as you say.
3. Any small existing open source games that have a good structure?

For 2D Engine, take a look at
HGE http://hge.relishgames.com/

For 3D Engine,
Ogre http://www.ogre3d.org/ (This is a little big though)


There you have engines that have a broad user base, and a quite good

also. are you making an engine or game?
if you are making a game you will probably be better of with a specialized engine that has the features you need.

if you are making a engine you should make it totaly general in the begining
Quote:Original post by LackOfGrace
For 3D Engine,
Ogre http://www.ogre3d.org/ (This is a little big though)

Not to mention that the software design is a bit... ogresque. (OK, I stop with that [smile])

Thanks for the replies, but I believe there is a bit of confusion going on here.

1. I have programmed my 3D engine / Game Engine (plugins that add to it), it's functional and is fit for the purpose intended.

2. I am looking to design my games code flow prior to jumping in and getting started. This would mean proper analysis and design. UML Class Diagrams, Use Cases, Component Diagrams, Sequence Diagrams etc. Granted as I begin development these plans will be altered but initially I want to sit down and plan it out in my head so it is clear as to what I really want to achieve.

If there are any well coded open-source games that I could potentially learn from it would be great. Something that is small, well laid out and easy to follow.

To me Game Design actually means planning out your game, covering all the gameplay aspects, art assets etc. Perhaps my interpretation on it is blurred somewhat but I do not view it as actually designing your code.

This topic is closed to new replies.

Advertisement