Engine Structure

Started by
3 comments, last by Magriep 21 years, 6 months ago
I was wondering how an engine for anything would be structured. I know you will use classes, but I don''t exactly know how to neatly organize it. Do the classes go in header files? I just want to know how it''s organized, maybe someone could give a quick example, because I could start the engine and it will be almost impossible to read. I know I might have to rewrite a lot of the engine if I want to add something, but hey that''s how you learn.
Advertisement
when you say "structured" what do you mean?

it seems like you are talking about file structure and not software architecture.

good OO design means putting every class in its own files. for each class you want a header file(.h) and a function file(.cpp). that''ll make coding and re-coding easier. also you can seperate the files into logically consistent directories so that even just looking at your project folder, you can get a sense of the software architecture.

if you''re talking about software architecture, that''s a much much bigger and more contriversial conversation.

what level are you at in programming? have you ever coded before? what''s the biggest project you''ve ever completed.

also, look at the For Beginners section of this site (top navigation bar, yellow link)

-me
Ok what thanks, but i guess that I was talking about software architechture also. I just would like to know if the whole engine is one class, or one class for each action (e.g. Initialize::DInput(); instead of CEngine:IntDInput(). Also, is the game inside of the engine code or is it in outside files? I noticed that Half-Life had their exe file and most of the game code in .dll files. Yes, I have programed before, I guess you could say I''m intermediate with console. Just to let you know I''m not trying to make an engine yet, I just want to have an idea of how it''s organized. And probably my biggest thing is tic-tac-toe, maybe i''ll use this advice to make an rpg, who knows.

I think there is an article on this. Look in the articles section.

Anyway, say a tic-tac-toe game using OpenGL, it might have the folowing classes:


Your application stuff:

Application (starts up, handles making and starting the other classes)
Window (interface to windows)
OpenGL (interface to OGL)

Then your game stuff (each class might draw itself, or inherit drawing stuff from a DrawableGameObject class or the like):

Game (handles all game classes, and in this case handles loading and saving your game)
Score (keeps the scores)
Board (handles the peices, make sure the move is valid, etc)
Peice (a naught or a cross in this case)


Basicly the best way to work out what you need is think of ever "thing" in your engine, and to give it a class and then write down how they would all interact, and then write a program based on that.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Go FAQ yourself ]

VERY Basic Core Engine Structure:
Graphics/Rendering sub-system,
Resource Mgmt sub-system,
Input sub-system,
Sound sub-system,
Math/Helper stuff,
Base Object/Geomtry,

Once you got a basic core structure (like the way an API), proceed to your actual game stuff.
Very Basic Game Engine (Using Core structure):
Main Game flow control,
Game Objects,
Game GUI,
Game AI,
etc, etc, etc...

Cool things to note:
#1. Your Core engine can be switched from opengl to dx if written write.
#2. Your core system can be used for multiple projects, such as for your GAME EDITOR.


- John

This topic is closed to new replies.

Advertisement