From UBC Wiki


Authors: Dante Cerron, Connie Leung, Jinmo Kim

What is the problem?

In Project 1 we found that Prolog can be used to create an engaging, interactive text-based Escape game. We will now see if Haskell is suitable for this same task. As in our Prolog version, the user should be able to interact with the game world and depending on their choices, the game state should change accordingly. In the game, the user will navigate through a series of rooms in the dark and will have to follow a logical sequence of steps in order to escape.

What is the something extra?

The user will need to escape within a certain amount of time. If this time-limit is exceeded, the game ends and the user loses.

The user must also actively change the state of the world to create a path to the exit. In this case, that means unlocking doors to new areas by searching the rooms for either:

  • keys which can only be used in certain rooms
  • puzzles that require a valid user input of a specific sequence

What did we learn from doing this?

Haskell would probably be last on our list of programming language choices for this task. As this type of game is highly stateful, it was very difficult to try to program it using a purely functional approach. Prolog was much easier. Were we to try to reimplement the game again, we would have made use of workarounds to simulate global variables, but that may have defeated the purpose of this exercise. Our time limit feature was also much more difficult to implement and required the use of threads to run properly. This meant that it only runs properly as a standalone executable (ie. doesn't work properly in ghc as child threads are not terminated with the main thread). This isn't too problematic as most programs would be run this way in the end, but it adds to the point that Haskell has many limitations in regards to creating RPG type games.