• Separating the Engine and UI

    When I started to create my game, I knew I wanted a few basic things. I wanted the game engine to be completely separate from whatever UI I wrapped around it. I wanted to be able to switch the game between a graphical or text based UI. I also decided that I wanted the UI to drive the engine, passing in Actions for actors who required input.

  • Implementing Reactions in Hoplite

    In most turn based games, each actor gets to take a single action on their turn. So the game loop is pretty simple.

  • Control your UI with State Machines

    Managing the various screens and menus of your UI can be greatly simplified by using a Finite State Machine(FSM) to control the flow of the UI. FSMs are easy to model and work very well for modeling the flow of a user’s action throughout a game. Furthermore, they compartmentalize code specific to each screen, making it simpler to reason about changes to any specific screen.

  • An Event System in one line of Python

    Just wanted to jot down here something that I found very clever. Using a couple datastructures from the python standard libary, and a little known fact about functions in python, it's possible to build an event system in a single line of code.