Course:CPSC312-2023/NatLangTextBasedGame

From UBC Wiki

Authors: Amanda, Ethan, Maggie

What is the problem?

We are going to create a text-based adventure game in Prolog, using a Natural Language interface to handle inputs from the player. Examples of player inputs are as such: 'go into the cave', 'take the sword', 'drink the antidote'. We are planning on the player having a large amount of variety in what actions they choose, allowing for both fun ways to 'break' the game, as well as replayability by doing different things in different playthroughs.

What is the something extra?

This game being quite modular, we have many ideas/mechanics in mind to create a deeper world for the player to interact. These include NPC interactions/conversations with a potential dialogue tree, a simple battle mechanic, webscraping data to use for a trivia section, and more.

What did we learn from doing this?

Overall, logic programming using Prolog was very suitable for our project. Implementing natural language inputs was very easy as that is something Prolog excels at. We essentially implemented two versions of natural language processing too, one based on the difference list implementation introduced in the lecture, and one using the DCG tools and trees that Prolog has built in. Prolog is also a very good language for handling databases, which came in handy since our game has many different items/people/states/interactions with unique properties (dialogues/strength stat/etc.). Accessing these properties was very simple and easy and required little abstraction and helpers. Prolog is a bit tedious when it comes to case checking, of which we had many because we wanted specific interactions for specific inputs. This included a lot of retracting and asserting, as well as a constant use the cut operator to make sure we only got 1 specific outcome for inputs. This then took a good amount of time, however, Prolog's pattern matching made the case checking simple, and the loose, non-static typing system made avoiding errors easy.

Links to code etc

https://github.com/eritter100/CPSC312_Project2_NatLangGame