Skip to content

Game Loop

Austen McDonald edited this page Nov 11, 2016 · 1 revision

The crate interacts with the game via the Game object. Make a Game object by using the Bootstrap::createGame() method. All the initialization (like database connections) will be done within this method. After that, we'll have to figure out a way to specify which user is being played currently---a game should really represent only a single user.

"Playing" the game involves sending the Game object messages about actions taken by the player and receiving menus and forms back to display to the user. This interface has not been finalized, but possibly something like $game->takeAction($someAction) where $someAction could be an object representing a menu item or the result of a form entry.

Then something like $s = $game->getScene() would return the new scene to display to the user. The crate would acquire input then send it back through takeAction() and the loop would continue.

Clone this wiki locally