Eleanor Gregory's Portfolio

View My GitHub Profile

RPG Overworld Test

Video

Art assets used:

Introduction

With my continued interest in RPG mechanics and their storytelling, I was interested in putting together a small scene that could make use of an external dialogue engine in order to show branching conversations between characters, as no previous game projects of mine had required any form of dialogue. This project then developed into a test of including several other typical game features I hadn’t previously created: an inventory system, saving and loading a game’s state between sessions, and a changing overworld (tying into remembering the game’s state).

Results

At the end of the time I allowed myself for working on this project, the overworld scene contains these features:

What Was Learned

This project was my first attempt at implementing a number of typical game features such as saving the game and an inventory system, and in doing so I have learned a large amount about designing data structures to be used by both the player and the game in what their offered functionality should be and where it should be offered to neatly be accessed by the rest of the game. Saving and loading in particular as my first try at serialization was a challenging experience: as the project did not begin with save/load in mind, no implemented features accounted for later needing to be serialized, and a large amount had to be restructured. When next working on a project that will need to have its game state saved, I have learned to consider this fact first and structure the game around it rather than trying to tack it on as an afterthought.

Through using Yarn Spinner I have also gained experience with including a third party system within my project and extending it to fit my project’s needs. Though I specifically learnt Yarn Spinner, I now feel more confident in being able to understand and extend third party code even where documentation regarding the specifics of what I want to do is lacking or nonexistent.

Working with Yarn Spinner

Dialogue inclusion made use of Yarn Spinner, a tool created by Secret Lab for easy creation of interactive dialogue for games. I chose to use a third party dialogue system rather than developing my own to gain practice working with and extending software not written by myself, and I chose Yarn Spinner specifically due to its intended integration being with C# and Unity. Yarn Spinner also provides a base not specific to any one type of game which I felt I could spring off easily, as opposed to a system specifically developed for a genre like visual novels.

In including Yarn Spinner in my project, I made use of the standard features offered such as the displaying of the dialogue text and the structuring of a conversation around choosable options. To fulfil my project’s scope however I built on top of the example classes given by Yarn Spinner for these basics.

Below is a list of the Yarn Spinner functionality used and my extensions to them:

Technologies Used and Implementation

The RPG scene was created in the Unity game engine in the C# programming language, along with interpretation of the Yarn language (further described in the next section).

Both the inventory and the save/load systems were original systems written by myself. For the inventory system, each object visible in the overworld that can be feasibly picked up is its own class of InventoryItem, with specific behaviour (such as the noise that plays when a vegetable is taken) further defined in their specific classes. The inventory manages a certain number of slots for these items, which can be displayed in an ‘Inventory’ submenu.

Saving and loading makes use of Unity’s Serialization and Deserialization to write the player’s current state to disk. On pressing ‘Save Game’, a save object is created to serialize the player’s current position in the world, their current inventory, the current status of all dialogue flags present in the scene (such as whether a certain quest has yet been started), and which items if any have been removed from the overworld. All data except the player’s position required custom serialization to store their information, being based on my own structures that Unity has no way of automatically serializing. On loading of this game data, the overworld scene reloads itself and appropriately applies the data found in the save object, such as moving the player to the correct position and refilling their inventory.

To create the changeable overworld, scene reloading on load of a save game uses an additive approach: the base scene is the town map without any takeable items, and each takeable item is contained within their own scene which is loaded on top of the base if the saved game state does not mark that item as having been removed. I chose this approach rather than a reverse direction, as loading the full scene with all items then searching for and deactivating those taken would have required much more careful management of item storage and identification in order to not accidentally remove the wrong one.

Improvements

Overall I am very happy with the results of this project and the fact that I managed to implement each feature I wanted to. I am particularly happy with the additions unique to my project game such as my extensions to Yarn Spinner and the custom serialization of my game’s structures. However there are still features I would have liked to try add with more time or in any next similar project, or some small smoothings out to included features: