Choose Your Own Adventure

From UBC Wiki

Slay the Dragon

Authors: Yean Shu, Jason Ueng, Daniel Hou

What is the problem?

We will be creating a rudimentary text-adventure game using Prolog. The game will have elements of time and stat management, as well as basic story-telling elements. The basic story is that the player has 30 days to train themselves in order to defeat the dragon before it attacks the village.

What is the something extra?

In our adventure game, we are required to constantly update the player’s stats and be able to retrieve it when desired. This requires being able to constantly update our knowledge base. We also wanted to include events as a way to encourage both planning and adaptation. We first incorporated this by making stat increases random. We then settled on two types of events. The first are those that are triggered when we reach a certain condition. We also wanted to incorporate random events which have a small chance of occurring after each day. These required the use of library(random). We also wanted to make this project as moddable as possible so events and endings could be added or removed without tampering with other bits of code.

What did we learn from doing this?

We have learned that due to the nature of Prolog, it is almost impossible to create real-time games since it requires the program to change states very frequently (ie. ball moving across a screen) and Prolog cannot do that. This project also allowed us to learn some of the more practical elements of prolog. Because of the topics covered in the course, which focused mainly on the logical side of prolog such as knowledge bases, this project allowed us to learn some of the more practical elements such as if-then-else. Even so, it was difficult to implement some of the systems, especially the stat system. This was made more difficult by the fact that unlike our previous project, we started completely from scratch.

On the other hand, Prolog also excelled at adventure games, as unlike other languages which have concrete control-flows, which would force us to use multiple loops, Prolog has knowledge bases which allowed us to avoid this aspect.

It is also hard to implement a Prolog-only GUI for our program due to the lack of support, and the fact that Prolog is usually used to query relations and databases. We did attempt to implement a GUI for our program using xpce/library but was unable to due to bugs and the lack of workable solutions to fix it.

Links to code etc

https://github.com/yeanshu/CPSC312Project2