Building an Inventory System

Hi All

In a survival game what you have has a major impact on how well you survive. Over the last month I have begun working on my inventory system so as to prolong character’s life expectancy as well as appeal to the hoarder that keeps everything, or the player that has OCD and everything must have a place.

This has been an interesting bit of work for me as architecturally I have had to have quite a long think about various aspects of inventory systems and what I most wanted from my system. I considered element like an RPG style system where different items took up more slots than others, a custom GUI where items arent bound to slots and are instead bound to an area for that type, stacking items etc. Once I determined the things I wanted I went to my old reliable source of information to learn what I needed.

This month I used a tutorial series by Awful Media (https://www.youtube.com/watch?v=D5WEwG4L5HQ). It was great to come back to Austin’s videos as one of his videos was the first Game Development tutorial video I watched when learning how to use Unity for the first time. And though my system has functionally deviated significantly from what I learn in this series it is a great foundation for learning that all game developers considering using an inventory system should consider watching.

So after some though I decided to go with a simple system similar to MineCraft or 7 Days to Die. I have structured the code in a way that will also allow me to have multi slot items for larger items potentially in future but I chose not to do this in the short term.

Inventory

Instead of a drag an drop system I went for a click to pick up and click to drop. This gave me the ability with stacked items to right click while “dragging” to drop a single. I have included are control left click to split a stack (half stays in it current slot the other half is picked up. Shift click allows a player to transfer the item from the current item container to either equipable (for armour), an open loot container or to the belt.

StackingItem

I still have some more features to add and these include a right click menu, a tool tip and a help button for reminding the player of the short cut keys/combinations. I hope for now you like the look of it and I look forward to sharing more soon.

Cheers
Grae

 

Leave a Reply

Your email address will not be published.