Original Post
I'm writing a game library so I can quickly and easily put together new games. I'm trying to keep it as generic, loosely coupled, and well designed as possible on the off-chance that I need to show it to a company as resume padding, etc. I'm trying to black-box the Engine as much as possible. Under the hood it will have a stack of GameMode objects and the GameMode on top gets called to do whatever the designer has programmed it to do. My game loop within the Engine object will be something like: Gather User Input into a Queue Update any Engine-Internal Stuff (gametime, etc) Call GameMode (operates on game objects and state managed by the Engine) Clean-up I'm just wondering how best to allow the GameMode to interact with the Engine. I've had a few ideas: a)Give GameMode's an API object that exposes functions that operate on the Engine. (Kind of like an Adapter/Mediator pattern, I guess). b)Give GameMode's a callback function provided by the Engine that lets the GameMode request operations or data. ie: CallBack(GET_OBJECT_DATA, objectID, "health"); CallBack(PAUSE_GAME); etc. c)Give GameModes direct access to the Engine and have the Engine expose a crapload of public functions. Any other ideas? Your input is appreciated!!