Click here to see the Game Devlog video I made for this!
This is a WIP game that I worked on for about a month in the summer. The main idea was to make a 2D RPG platformer focused on exploration. This means:
We will cover these down below.
As the project was of a small scope, our GDD didn't get out of draft (Link to GDD) As for tasks, I used Trello as it was simple to use and was very similar to GitHub project boards. (Link to my Trello)
General structure of the project is straight-forward:
Assets Audio // Contains audio manager Cameras Entities // For NPCs, Enemies, and players FX Items // For the inventory system UI Prefabs Managers UI Resources // Keeps mostly data (Scriptable Objects / Models) Dialogue Items Scenes Scripts Editor // Script for development tools I made Game // Mainly contains Controllers NPC // Everything related to AI and State Machines Player Sprites
(visual results down below) We have 2 main scripts for making the State machine work:
The State
class is an abstract class. Many new classes will inherit from it to define their own behaviors.
Here are some examples:
The skeleton Enemy npc has many states. One of which is Skeleton_MeleeAttackState.cs
It overrides the base functions that can be utilized easily from everywhere without having to worry about the underlying complexities of the Skeleton class.
This NPC is a companion. After interacting with the companion via E
key, it follows the player. If the player attacks an enemy, it will attack the same enemy until it dies.
This enemy (a boss fight) has multiple stages to its behavior. In stage 1, it attacks with melee (punch, kick) and runs/dash in a slow interval. In stage 2 (when his HP gets to half), it uses its sword and starts dashing a lot more.
The inventory system was made to be flexible and scalable. Here's a general idea of how it works:
Item.cs
class is used for all items, which allows the inventory to work on an abstraction layer without being tightly coupled.List
of items. However, this would make searching O(n)
. Therefore, in D_Inventory.cs
line 20, I made a TODO to change it into a Dictionary (for O(1)
lookup, add, and delete)All managed in the editor as a dev tool:
The dialog system is also very similar, as it's basically many data nodes connected to each other (AKA a Tree)
A fun thing I wanted to add was water. This would make for greate water sections where the player could swim and swing (has nice tone to it!) I was inspired by what Super Mario Bros. did in their platformers:
The main idea behind recreating this is to Fake it 'til you make it! Using mainly Hooke's law and euler methods (for the surface of the water, since we're basically working with connected dots). Here's a link to an article by Michael Hoffman that explains how to do it.