Page 1 of 1
Game Engine Design
Posted: Mon Dec 14, 2009 4:14 am
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.
Re: Game Engine Design
Posted: Mon Dec 14, 2009 8:58 am
by andrew
Enginuity
It might give you some ideas even though it has some old non-standard code, and it wasn't finished.
Re: Game Engine Design
Posted: Mon Dec 14, 2009 4:29 pm
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?
Re: Game Engine Design
Posted: Mon Dec 14, 2009 5:17 pm
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
Re: Game Engine Design
Posted: Mon Dec 14, 2009 5:28 pm
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
Re: Game Engine Design
Posted: Mon Dec 14, 2009 11:20 pm
by dejai
Fair enough.
Re: Game Engine Design
Posted: Mon Dec 14, 2009 11:29 pm
by dejai
Also that was C code, so it had nothing to do with constructors.
Re: Game Engine Design
Posted: Tue Dec 15, 2009 12:44 am
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();
Re: Game Engine Design
Posted: Tue Dec 15, 2009 1:04 am
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.