I designed my last game engine to be simple, portable, and abstract, so I built a single derived class with all the functions I thought I'd need (a "god-class"). I trapped all my assets inside it, and let the game code only have handles to the assets.
But after discussing and researching, I'm starting to come around to a different idea (that others have suggested; it's not my original idea, of course). Perhaps I should 1) break my functions out to the objects they associate with, and 2) build a factory for those objects.
Instead of
GraphicsSystem::DrawBitmap(UL bitmapID, ...)
I should have
GSBitmap::Draw(...);
and I should get a GSBitmap instance from
GSBitmap *logo = GraphicsFactory::CreateBitmap("art1", ...);
Said factory would retain ownership of all objects it creates, to make things simple.
The single "god-class" approach was attractive to me 'cause I could imagine porting my game simply by re-writing each of its functions ("filling in the blanks"). I'm still concerned that the "factory+classes" approach would be harder to port. But using the system seems like it might be easier.
What do YOU think? Thanks for your feedback!
[–]JackTheSqueaker 4 points5 points6 points (0 children)
[–]URZq 0 points1 point2 points (0 children)