Developer Blog

Inventory / Items Part 3

Oct 17, 2021 by Tony "Sgt. Flame" Richards

Well, quite a bit more progress made this past weekend.

Inventory

With the interact system complete, the next part I tackled was an inventory system.

I watched a bunch of Youtube videos again and learned a few new things, but it seems like most of the tutorials keep things quite simple without using the Ability System or even the Enhanced Input System, so while I learned a lot, I could only use a bit of the tutorials and needed to come up with the rest on my own.

While it’s not pretty graphically, I’m pleased with the way it works.

Takeable Item Interact

First, the base item that supports the player to “take” it and put it into inventory implements interact by calling the Inventory Component Take Item function.

Take Item

Inventory Component Take Item

The Inventory Component first tries to stack the item if possible, and if the item isn’t stackable or all of the inventory slots are already stacked with the maxium count then the component tries to add a new item.

TakeItem

TryStackItem

TryAddItem

As you can see, the most complex piece of logic is only when trying to add an item and there isn’t any room in the inventory so it looks to see if there are any slots that has been populated with an Empty or Nothing item, at which point is uses that slot.

I think this should be easily simplified as it was added as an afterthought, but even still it’s not really that complex.

First Person Shooter

So the next pieces that I would like to implement are more FPS-like… some new animations for holding a weapon (starting with an AR4), and then implementing a way for the player to equip an item from inventory and use it (starting with firing bullets from an AR4 and reloading it).

I definitely would like to finish this within the next two weekends so that it can be included in Milestone 0.3.0.

Base Security System

I’ve also been playing around with camera systems to enable a “master control” area in the player’s base where video feeds and alarms / lights will display when potential threats are identified. After placing a camera and naming it, the player will be able to place a video monitor which can be used to view the camera. Alarms can also be implemented when a foe or enemy player steps into the view of a camera.

So far I only have a rudimentary implementation (primarily from a tutorial), so it’s not flushed out enough to make it into Milestone 0.3.0, but maybe that’s something I can do for the following Milestone.