Sign in to follow this  
batmansDad

Proper Game Structure

Recommended Posts

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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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])

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this