Seas of Infamy is a personal project of mine built in Unity.
Throughout this project, I learned and practiced many core programming concepts. It also includes an inventory and equipment system, allowing the player to equip, collect or drop items. Enemies have random item drops as well. The player can level up, which increases core attributes like health and damage. Additionally, the game features a saving system that saves the state of enemies in the level, the player's location and state, items dropped on the ground, and the items in the player's inventory.
As you can see the player can equip items, which then appear visibly on the character. Currently, only four items are implemented in the game: a hat, a sword, a bow, and a fireball ability. Each item has different modifiers. For example, weapons have flat and percentage damage modifiers, and the hat increases health.
The items are built using Scriptable Objects. Through this process, I have learned a lot about inheritance. The setup involves creating a base item or weapon class that derives from the Scriptable Object class, and then having all specific items derive from this base class. This allows for a more abstract and flexible use of items in functions.
During the development of the saving system, I learned about interfaces in OOP.
The system works by adding a JsonSaveableEntity component to all GameObjects that need to be saved. This signals the system to save these objects. When saving, we gather all JsonSaveableEntities in the scene and call their save function.
This is where interfaces come into play. All components and data we want to save implement an IJsonSaveable interface. In the JsonSaveableEntity’s save function, we identify all components with this interface and call their specific save implementations. This approach allowed me to build a flexible system that saves only the necessary data.
Loading follows a similar process: it reads from a file, matches GUIDs to objects, and loads their corresponding data.