Game Engine Design

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Game Engine Design

Post by dejai »

I have decided to write a modest game engine that depends on both OpenGL and SDL, I have decided to do this for two reasons. One it allows me to change the back end without having to rewrite the code and also because I am interested in it. Now at the moment I am writing it in C since I am very comfortable with C and I write a lot of my game code in C. But I have written a 1000 line Game State Engine in C++ and with my current model I will probably be moving to C++. Anyway I was wondering if you had any suggestions about how to do it? I am writing a static library and my outline follows.

dejai(.c,.h):
This is a single object that contains all the following managers, we say Dejai* game = createGame(params); I am opening up the possibility to load the modules separately using something like AI* ai = device->createAI(params); but for now I like the idea of it all being inside dejai. Then I can go game->ai->pathFinding(); etc.

I then have a group of managers that do just that. graphics manages graphics, gui manages gui, io, physics, ai etc. And that makes up the engine. What do you think? Comment are very welcome.
andrew
Chaos Rift Regular
Chaos Rift Regular
Posts: 121
Joined: Mon Dec 08, 2008 2:12 pm

Re: Game Engine Design

Post by andrew »

Enginuity
It might give you some ideas even though it has some old non-standard code, and it wasn't finished.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Game Engine Design

Post by Falco Girgis »

I mean no offense, but you have a bad habit of posting absolutely nothing other than ideas and asking for feedback/information.

Half of development and design is doing. You posted some pretty little ideas which are the basis of every engine. Have a "something manager" to manage "something"--these are simple OO principles to talk about, but grueling tasks to implement. Quite a lot of things change once your idea is in code. Come back when you've done that.

As for commenting on your 1/100000th of an engine, it looks good. Or maybe since the object encompasses everything, we want to allocate it on the stack without new? I'm curious as to why "createGame" and "createAI" are random functions rather than the constructor of these objects. Would that not be neater?

Unless, of course, you wanted to be able to make games that weren't just "Dejais," but we wouldn't know that without you posting any code now, would we? ;)
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Game Engine Design

Post by K-Bal »

Like Gyro said, there is not much to comment on. Just go on and code and you will see if you are heading in the right direction. Let me just add this link, since you said nothing about an actual game: http://scientificninja.com/advice/write ... ot-engines.

Ciao,
Marius
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: Game Engine Design

Post by RyanPridgeon »

dejai wrote: I then have a group of managers that do just that. graphics manages graphics, gui manages gui, io, physics, ai etc. And that makes up the engine. What do you think? Comment are very welcome.
Yes, that's how almost all game engines do it these days. Get to work! :P xD
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: Game Engine Design

Post by dejai »

Fair enough.
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: Game Engine Design

Post by dejai »

Also that was C code, so it had nothing to do with constructors.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Game Engine Design

Post by Falco Girgis »

dejai wrote:Also that was C code, so it had nothing to do with constructors.
Really? Then why do you have member functions?
dejai wrote:Then I can go game->ai->pathFinding();
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: Game Engine Design

Post by dejai »

Sorry must have been confusing I was talking about what I would do if I was using C++ in that section, the previous was about C which I was writing it in at the time.
Post Reply