
Welcome to the course!
In this first section, we will be setting up the project, getting our assets, creating a plugin and programming item interactions.
We create and set up our project and migrate the course assets over to it.
We change out the Unreal Engine mannequin for our new and improved Thorne!
We create a plugin for the Inventory System so we can use it in multiple projects.
We create the Player Controller for this project so we can set up inputs.
We create an input action for our Primary Interact action. This will allow us to interact with and pick up items.
We create the HUD widget for our game.
We create a custom Trace Channel for Items - this allows us to perform spatial queries such as line traces in an optimized manner.
We implement tracing for Items.
We create the Pickup Message widget.
We create a highlight material for items so we know which ones we can currently interact with.
In this section, we will create the Inventory Menu Widgets for our spatial inventory.
We create an Inventory Component that will keep track of items in our inventory.
We create the Input Action needed to toggle our inventory menu.
We add a close button to the menu for convenience.
We create the widget class for a grid of spaces in our inventory.
We add buttons for switching between inventory grids in our Widget Switcher.
We create the Grid Slot class for a single slot on the grid.
In this section, we will create the Fast Array Serializer - an optimized way to handle collections of replicated data.
We create the Fast Array Serializer for our Inventory.
We implement the utility functions in the Fast Array Serializer for adding and removing items.
We implement a solution for attempting to add an item in the inventory when there is no room.
We create the function for checking our inventory for room for an item.
We create Server RPCs for adding stacks and new items.
We create the Item Manifest, a struct that will contain all important properties for Items.
We create Item GameplayTags to identify items.
We implement a function to respond to the addition of new items to the inventory.
In this section, we introduce the concept of an Item Fragment - a modular piece of code that can be added to an item to give it new properties.
We create the Item Fragment base struct.
We create the Image Fragment, based on the Item Fragment base struct.
We create the function for checking our inventory grid.
We create the function for adding an item to a set of indices.
We create utilities for getting a given Fragment by type and tag.
We create the Slotted Item class, a widget that will represent a visual item icon in the inventory.
We create the function for adding a Slotted Item to our inventory's Canvas Panel.
We add textures to the Grid Slot for changing its state.
We create a two-dimensional For Each algorithm, capable of iterating over a 2D range on a grid.
We create the Stackable Fragment, to be given to items that will be stackable.
We implement showing the Stack Count in a Slotted Item for stackables.
We update the grid slots in the 2D range covered by an item, applying cosmetic changes to the grid texture.
We outline the steps we'll take to check for room in our inventory. This is a large piece in our overall inventory system!
We first check to see if the item is stackable.
We calculate how many stacks to add for this item, if stackable.
We exit the loop early based on the amount to fill reaching zero.
We check to see if the index is claimed.
We create a function for checking if there's room at a given index.
We create the skeleton of the function for checking slot constraints.
We check to see if the index is claimed...Again
We check to make sure this is an upper left Grid Slot
We check to make sure this is a stackable Item
We check to make sure the item types match.
We check to see if the current slot is already at max capacity.
We implement a check to make sure the item can fit without going out of grid bounds.
We determine the amount to fill for the slot.
We fill in the results struct for our HasRoomForItem algorithm.
We create a function for finding the first item by its Item Type tag.
We test our algorithm to make sure it works so far.
We add a Total Stack Count to the Inventory Item class.
We allow the Item Component to destroy its owning Actor when picked up.
We create and broadcast a delegate when adding stacks to a preexisting Item in the inventory.
We implement the AddStacks function, incrementing stack counts and adding Slotted Items where necessary.
In this section, we will deal with moving items around in the inventory.
We create the Hover Item widget class so that we can click on items and move them with the mouse.
We create a callback for when a Slotted Item is clicked.
We learn how to distinguish between a left and right click on a Widget
We assign a Hover Item for moving objects in our inventory
We give a stack count to the Hover Item
We implement removing an Item from the grid.
In this section, we will implement important features for our Hover Item, such as highlighting and unhighlighting the grid slots behind the Hover Item.
We create a data structure for storing parameters for a given tile.
We calculate and store the Canvas and Mouse positions.
We calculate the coordinates for the hovered Grid Slot.
We calculate the tile quadrant for the hovered Grid Slot.
We create a function for performing important actions once the tile parameters have been updated.
We calculate the Hover Item dimensions.
We calculate the coordinate we should start at when highlighting the 2D range behind the Hover Item.
We check the Hover Position to see if it's a valid spot.
We check to see if the Hover Item can fit within the grid bounds.
We check to see if the location has a valid swappable Item.
We detect if the cursor has exited the Canvas.
We implement functions for highlighting and unhighlighting the Grid Slots over a 2D range.
We implement a function for changing the hover type for grid slots so we can see if that location is valid for swapping.
In this section, we will implement the ability to click on an item in the inventory to pick it up.
We create events to broadcast from the Grid Slot when clicking, hovering, and unhovering.
We implement the Grid Slot Clicked event and callback.
We implement the ability to put an item down on a specific grid index.
We create functions to show and hide custom cursor icons for each Inventory Grid.
We implement the callback for when a Slotted Item is clicked.
We create the function for swapping a clicked item with the hover item.
We create a function for determining whether or not to swap stack counts with the clicked and hover item.
We implement actually swapping stack counts.
We implement consuming the stacks for a hover item when clicking on an item that can accommodate for those stacks.
We implement filling in stack amounts without consuming the Hover Item
We return early if the slot is full.
In this section, we'll make a pop up menu that will allow us to split, consume, and drop items.
We create the C++ class to back our pop up menu, called Item Pop Up
We bind to the events on the important widgets in the Item Pop Up
We create delegates to broadcast from the Item Pop Up
We polish up the Item Pop Up Class
We create the Widget Blueprint for the Item Pop Up Widget.
We create a function for creating a new Item Pop Up instance.
We add a weak pointer to the Item Pop Up to the Grid Slot.
We create callbacks to execute when clicking on the Split and Drop Item buttons
We implement the callback for splitting stackable items
In this course, you will learn how to create inventory systems for your games in Unreal Engine 5 using C++ and Blueprints.
We will create a spatial inventory with item grids for different categories (Equippable, Consumable, and Craftable) and the ability to switch between grids filled with items. Items can be different sizes, each taking up a different number of squares in the grid, and items can be stackable, allowing for splitting, combining, consuming, and dropping items.
This inventory system is architected for scalability, modularity, and uses Unreal Engine C++ best practices. The inventory is coded in its own separate plugin, which can be added to multiple game projects or simply kept in a single project.
Assets are provided for this course, including:
All 3D meshes for items used, including consumable potions, equippable cloaks, masks, and weapons, and craftable foraging materials.
All 2D textures for icons, widgets, menus, borders, and messages.
Niagara effects for picking up items
This project uses Unreal Engine 5.5 and works in Unreal Engine 5.6 - you may use the latest version of Unreal Engine for this course!
Features of this course include:
Spatial inventory grids and the ability to switch between multiple grids in the inventory to house items of different categories (we implement Equippables, Consumables, and Craftables),
An Item Fragment system whereby items can be customized by adding modular "Fragments" to give them functionality (a well-established software pattern in the games industry). Add a Grid Fragment to make the item capable of taking up multiple squares on the grid - add an Equippable Fragment to make the item equippable, etc.,
Item tooltip popups showing item attributes and the use of design patterns to make a highly-flexible system where tooltips adapt to an item's fragments to display item information,
The ability to move items in a spatial inventory,
Stackable items with stack counts (just add a Stackable Fragment), supporting max stack sizes, and the ability to split, combine, and drop items in the inventory,
Consumable items, the ability to consume and apply custom behaviors upon item consumption (we will implement potions),
Equipment with equippable slots, and actually equipping items of different types (we will implement cloaks, masks, and weapons),
Assets will be provided for this course, including the character, weapons, equipment, potions, and craftables, as well as all UI textures for inventory menu widgets. Though you are free to use your own assets!
Everything is programmed to work in a multiplayer environment, both Listen Server and Dedicated Servers. It also works in single-player, Standalone games.
Items are functional - not just affecting what we see in the menus, but also what happens in the game - the system is coded to be flexible, allowing you to program your own functionality when items are consumed/equipped/used, including incorporation with the Gameplay Ability System (GAS).
My students have easily incorporated this inventory into their own projects with little effort.
We will cover topics from intermediate to advanced Unreal Engine C++. If you have taken my course titled Unreal Engine 5 C++ The Ultimate Game Developer Course or have equivalent knowledge, you are ready for this course!
You will also have access to the Druid Mechanics Discord Community, a community I have created for my students, designed to be your most helpful resource when learning. We are going on 35,000 students and climbing! We're all here to help each other out!
I hope you enjoy this course as much as I did while creating it!
Jump in, and let's make some inventories!