Hey all, after much learning, I am finally getting ready to attempt my own 2D engine in C++ using SDL as the sole graphics library. However I need some clarification in terms of setting up the structure of the "engine", I have heard that the best idea is to have headers dealing with the various sections such as graphics.h and then a main header such as engine.h that using multiple inheritance inherits all the public functions andvariables of the various other headers and using a function such as Engine::Start(), start the various functions from the various headers.
However I have also heard that it would be easier to perhaps just have a header such as Engine and then deal with the structure by having all the headers in one place thus avoiding multiple inheritance and most likely sticking to simple inheritance as I have heard multiple inheritance can get very frustrating.
My engine will be rather simple as it is my first attempt, if anyone can clarify the question abover OR
provide me with a 2D Engine Structure, I would be most appreciative, thanks a lot
v0rtex
2D SDL Game: Engine Structure
Page 1 of 16 Replies - 15355 Views - Last Post: 23 June 2010 - 12:49 PM
Replies To: 2D SDL Game: Engine Structure
#2
Re: 2D SDL Game: Engine Structure
Posted 23 June 2010 - 07:12 AM
Why not check out stayscrisp's SDL tutorials here? He has some good ideas on how to set up an SDL game state management, the 4th tutorial, that may help you. Just a suggestion.
#3
Re: 2D SDL Game: Engine Structure
Posted 23 June 2010 - 07:23 AM
Thanks a lot, that does help, thanks to stayscrisp aswell for making those tutorials, I will definitely look at them but I understand how a game loop should work aswell as states etc but what is my concern is the design of the engine, how should I structure the 2D engine, my post above this one will hopefully make the question a little bit less vague!
Thanks.
Thanks.
#4
Re: 2D SDL Game: Engine Structure
Posted 23 June 2010 - 07:28 AM
I was talking about his ideas of state management, not really the game loop. You have a single base class that describes your game. Each state of your game is a derived class. You would have the graphics in a class of its own and call any drawing from the game state class. I believe it was the 4th one that he explained it best.
#5
Re: 2D SDL Game: Engine Structure
Posted 23 June 2010 - 11:42 AM
Oh ok, thanks alot.
#6
Re: 2D SDL Game: Engine Structure
Posted 23 June 2010 - 12:20 PM
I think this is more of what you are looking for.
http://gpwiki.org/in...Engine_Overview
It does include some OpenGL components in the graphics part, but I'm sure you will be able to modify it a bit to meet your goals.
I hope that helps!
http://gpwiki.org/in...Engine_Overview
It does include some OpenGL components in the graphics part, but I'm sure you will be able to modify it a bit to meet your goals.
I hope that helps!
This post has been edited by Fib: 23 June 2010 - 12:21 PM
#7
Re: 2D SDL Game: Engine Structure
Posted 23 June 2010 - 12:49 PM
That is exactly what I am looking for! thanks, Sorry my question was very vague, I wanted the structure of an engine and you both aided me alot, I will try to make my questioning more to the point and precise, after all it will hopefully bring better results, that way. thanks alot.
~v0rtex
~v0rtex
This post has been edited by v0rtex: 23 June 2010 - 12:55 PM
Page 1 of 1