Mechanics for a survival type of game

One of my favourite genre of games to play are survival and crafting games. I started this project by developing an inventory system (first iteration displayed on the second video) inspired by the Subnautica franchise. But recently I started to add more elements to it, like a crafting system and a complementary UI that informs the player.

Design and Mechanics

Inventory System

The inventory system is designed to be sorted in a custom way (e.g. alphabetically) and each slot is not stackable. The user can assign objects to a toolbar slot either from their backpack inventory or the toolbar. The user can also store their items to storage containers and retrieve them in the future. I used Scriptable Objects to create different types of items divided by categories such as resource, consumable, equipment and tool. Each category has its own features but inherit from the same Scriptable object. During this implementation I also introduced events and learned how to use them.

Crafting System

The crafting system is using recipes that are also Scriptable objects. The recipes are designed to accept ingredients (items) and the amount of each. The player can access the crafting system while using a crafting table. The crafting would not be complete without a user interface. I separated the items that the player can craft into the categories of the items themselves. The crafting menu allows the player to craft items only if all items are in their backpack.

User Interface

In the first iteration of this project, the only UI elements were the toolbar, the backpack and storage. In this new iteration I added more UI elements because I enjoy developing them. First, I added tooltips, i.e. a box that shows up when the player hovers over items that includes important information, i.e. name, description, stats as well as information about controls. Second, I implement a pop up message system to inform the player about what items are removed/added to their inventory, as well as important messages like when they are starving/dehydrated and when their inventory is full. This would not be complete if I didn't add information at the center of the screen to inform the player how they can interact with each item. This was very fun to implement since I also created the 2D art myself for all sprites used.

General

The player can pick up items, smash objects to get resources (e.g. stone, tree trunk) and open any storage container. The backpack can be accessed using the Tab key. When the backpack is open the player can assign any item to their toolbar using the binding keys 1-5. On the other hand, when the backpack is closed, the player can equip any item in their toolbar using the mouse scroll wheel. Equiping tools will add to the stats of the player i.e. allow them to damage items with less hits. The player is also able to consume any consumable from their inventory of the toolbar. This affects their health, starvation and thirst.

Animation and Assets

Since I didn't want the world to be bare and boring, I added some free 3D assets from the Unity Store to lighten the environment. Some 3D assets I created myself using ProBuilder in Unity like the storage container, crafting table, axe, pickaxe and most consumables (soup, berry juice etc). In addition, I created the UI assets using photoshop.

Furthermore, I wanted to add animation to the character to indicate when they pick up or break an item, so I added some animation clips including an avatar from Mixamo. I also ended up creating the breaking animation myself in Unity because I couldn't find something I liked. This was my first time using only Unity to create an animation. I also used Animation Rigging so that when the player holds a weapon to follow the motion of the hand as well as the Animation Layering to blend the motion of the hands while the player is walking. I spent a lot of time tweaking the animation state machine so that the animation looks decent in the end result and I had a lot of fun doing so.

Project information

  • Category: Game project
  • Genre: Survival Game
  • Project URL: Source Code
  • Tools: Unity, C#, Photoshop