Programming Patterns
-
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.
-
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.