Implementing an inventory system
Hi all,
In this devlog, I wanted to drive you through the process of creating an inventory system for my game. This is a technical devlog, where I explain in detail the code side of the inventory implementation. The inventory is meant to be extendible and to account for all kind of items. From the moment an item is stored, to the usage and the removal of the item, any behaviour can be defined. In this way, the inventory items can trigger any necessary action. As an example, I explain how a key item is implemented. This item is meant to open a specific door of the scene. To achieve this behaviour, I make use of the variables system too. The item has an action which is triggered when it is stored in the inventory. The action will change the variable state to true. This variable is related to the opening of the door: when it is true, the player can open the door. Whenever we remove the item from the inventory, we trigger another action which does the opposite, it sets the variable to false. Finally, since this is a single use key and can be consumed. We add another action which will trigger when we use the item. This action will basically consume the item.
As you can see, we can build up an item from actions happening on storage, usage and removal from the inventory. We can create incredibly complex behaviour by using this system and all items are not more than data objects holding this information.
Here you can watch a video where I explain all this in more detail.
Get 3D game project
3D game project
3D game development project using the OpenTK framework
More posts
- Implementing a spawnable attackAug 02, 2024
- New enemy visuals and covering mechanicJul 26, 2024
- Graphics upgradeJul 13, 2024
- Prototype level designJul 02, 2024
- Implementing world events and cutscenes systemJun 21, 2024
- How game development process looks like when using a custom-made game engine.Jun 18, 2024
- Testing stealth prototype game mechanicsJun 17, 2024
- Enemies field of view rendering and detectionJun 07, 2024
- Demo of the prototype available to download!May 25, 2024
Leave a comment
Log in with itch.io to leave a comment.