So here's the problem- I'm writing my own engine library, and it works fine with stuff like menus and the actual game screen. The thing is, I can't really figure out how to integrate something like an intro or dialogue preceding certain levels into this system. Let's look at another example- say I have a game-specific engine which gets a Level object and runs it. Engine would have its own collision and physics system, all hard coded. Now, what if at some point in a level, I want the player to enter a mini-game with different rules? How do I morph the Engine class to support these sub-systems without having to deal with their code all the time (as in: if(regular game) ... else if(mini game) ...)?

And what if I want an intro animation at the start of a level, and I want the player to be able to assume control of his character once the animation ends, do I implement the animation into the Engine class itself? Or maybe I need to run another class, CutScene, and when it ends, it calls Engine and starts the level? What if I want to add a dialogue system, where at the start of each level there's a short dialogue and the player can't control his character, and once it ends, he can? Would I then run the dialogue code inside the Engine code?

Maybe these sub-systems should all be scripted? I don't know anything about scripting, is it necessary for this kind of situation? Any help would be appreciated.


Broad and hard questions, there is a ton of ways to engineer this. But i would go with something like an interface for a "Game" module, and then code different games from there. That way you could have an array of pointers to different classes which is different mini-games, but comes from the same pure virtual interface.

I think a good idea is to read some basic design patterns, and especially about modules and interfaces, and test some with that. In my opinion there is never a bad design for anything as long as you find it simple and use full to use it.

Design patterns on Wiki Random design pattern on google

Im not sure if thees are super good links, but what i saw they look like a good starting point for what you are asking.

Other than this, i think this is a super broad question and i cant even answer it all. You have to google around and hope for some more good answer to this question.

| improve this answer | |
  • \$\begingroup\$ Thanks! That seems like a good idea. I'm not sure how further design patterns could get me now, I've been reading about them for a while, and I'm planning on reading that book. That second link seems extremely useful as well. \$\endgroup\$ – Hillel Jun 25 '13 at 13:05
  • 1
    \$\begingroup\$ unfortunately, engine designs is not something one can have in one day, it takes a while to get the hang of it, and only from fail & horror designs. so eventually, you will find a neat way! \$\endgroup\$ – Tordin Jun 26 '13 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.