Struggle
About
This project is an attempt to try and showcase the perspective of someone who is mentally ill, with themes of anxiety, depression and eating disorders. Taking inspiration from my own healing journey this game serves more as a message and a “read between the lines” sorta game where the player can try and empathise with the character while seeing and feeling the things they do which is distorted and warped.
This game was also a good practice project that I worked on during my second year of university during summer break where I kept my skills up to date.
Project Summary
This project was a fun and somewhat challenging experience for me where I had the opportunity to create a modular interaction system, focusing on clean, modular code that could be used throughout my project.
In order to create this functionality I made use of Unity’s Scriptable Object system, allowing me to input the data I needed and combining it with a script to read in the data as I use Scriptable Objects as ‘read-only’ containers.
Additionally I used abstraction on certain objects to allow them to have a dual purpose. As the player would be able to interact with a lot of objects, I needed a way to differentiate between normal interaction objects that only give information and objects that both give information and progress the game along. Using abstraction allowed for this to happen and made it so I did not have to write repetitive lines of code to change one single function.
Interaction System
Due to the game being a walking/story sim interacting with objects would be a key system to the game to add any sort of value to it. I created my own interaction system by utilizing a mix of abstraction and using Unity’s Scriptable Objects as a way to store the data for the object, mainly the name and the description of the item itself. I used a base class that all interaction items would inherit from and then override the base Interaction method that the player would call when interacting with the objects. This allowed multiple items to provide different data all while using the same class and removing the need to write additional code.
In addition to the passing of data, I also combined with with a typing effect UI system. Once the data was passed in, I used Unity’s Event System in order to also pass in the data to a UI script in order to show the data to the player. Once the UI script had the string, it utilized a coroutine in order to show each character one by one with a delay to give the illusion of a typing effect.
While the interaction system itself can be classed as quite simple the foundations of the system have been laid down where it could easily be expanded upon to create even more effects or change the gameplay but as it was not within the scope of the project I simply wished to be able to show text/descriptions to the player from the items.
Task System
Following the interaction system I also created my own Task System that would be the main mechanic that drives the game forward. I utilised a Task class as well as the Scriptable Objects again in order to provide the data needed to pass to the UI to tell the player their next objective. The player would keep a list of tasks on their own class and a Task Manager would ask for the next respective Task in the list when called
Similarly to the interaction/story objects, to progress to the next task the player needs to interact with objects however some of these items can also be story objects and so the task items would need to choose which function to call depending on their state of being active or not. Utilizing enums and checking to see if the current task is active the object can switch between it’s method, either giving the player information or progressing the game. The task objects still utilize the interaction code and simply add the task code on top if needed.
This system took awhile for me to figure out in terms of what solution to go for, however once enough rough testing was done and the initial object’s implementation worked successfully it was then easier to simply add more objects and task to the system.
What I Learned
With this being a re-work of a previous attempt on this project and comparing my scripts I have learned how to optimize and shorten my code, allowing for a more OOP paradigm of programming and less brute-forcing a mechanic to work and not thinking of a bigger picture and how other mechanics and systems could share the same systems without needing to re-invent them every single time
Redoing this project has also helped me with the idea that refactoring code needs to be a painful process and it helped me overcome my fear of planning for failure where I plan for every possible mechanic eventuality that I simply do not think of what is needed right now and become too scared/anxious over what “might” need to be added.
You can watch the gameplay of struggle on YouTube below. Make sure to check out my repository on Github