A Programmable Puzzler
Termulus is a casual puzzle game where players navigate a robot through various obstacles toward an end goal. But Termulus is not your typical puzzler, where you might control your robot with up and down keys. Instead, you program the robot and the world with blocks.
Each level consists of two phases - a programming phase, where the user connects a limited number of blocks together to provide instructions to their robot; and a run phase, where the instructions are carried out. While running their programs, robots interact with various level elements, such as buttons, doors, and pushers. The programmable nature of the game works very well here; for example, players may program buttons to open doors or cause their robot to take additional actions.
The logic behind Termulus is neatly divided into two portions: logic surrounding the game board (such as how robots move, how doors push robots, etc); and the block code interpreter. A block program is similar to a common compiler construct, formally an Abstract Syntax Tree. However, when interpreting an AST, one usually uses recursion and executes the tree as fast as possible. In our case, however, we wished to execute steps of the tree at a regular interval, have animations play between steps, run multiple trees simultaneously, etc. This meant our tree execution was considerably more complicated than a typical AST, and development of that took up about half my time at Hack the Planet. ## Awesomeness Termulus has some amazing features. In addition to an entire interpreter built from scratch (see above), we have a robust block editor and a great number of game elements. A user might program their robot to drive over a button, which they programmed to open a door, then cause their robot to conditionally turn when it sees red paint on the floor, to get to the end of a level. In another case, one robot may be driving toward a cliff, while another robot steps on a button to activate a device for pushing them out of the way.