top of page

Inventory Functionality


Over the past few weeks, I have put a lot of work into many of my assignments. Recently, I have began to focus more on my survival game. There were various things which I learned to do and implemented into the game, but there is still a lot that I need to do as well.

As can be seen from this image, I have implemented an inventory system and a system to track player statistics. To show more capabilities of the inventory system, I have already implemented all of the items which I plan to include in my game. Not all are shown here, since I plan for some items to only be able to exist inside of the inventory. This will be possible because I plan for the game to exist inside of the house and to be a survival/inventory management game, which requires player strategy to survive. The player will have to prioritize the items that they hold. When they interact with the front door, they will lose health and stamina, but have gathered more resources. I chose to do this because the player must decide if it is worth the risk to require more resources, and to consider whether they should discard any items to make more room for items to bring back. This is why not all items give the option of dropping.

Each item is made using a structure (struct in some programming languages) which is essentially a collection of variables. Every item is a child of an item which contains this struct, meaning that every item will have the same values which can be used, but each item can have different values, and have different effects on the player depending on these values.

My inventory works by placing these structs in an array with a corresponding array of integers to display the count for each item. Once an item is picked up, it will take the first empty slot in the inventory, unless it already exists in the inventory. If it does, it will stack. If there is no room left in the inventory, the item will not be added, and the item will not be removed from the game world, so that it can still be picked up later.

I also learned how to make my own unique materials. A material is something that is applied to an object in the game so that it looks like it has textures. The can in the above image is an example of a material which I have made. I made it so that the metal looks shiny and metallic, but the logo doesn't. I researched how to make my own normal maps to get the effect of the ripples on the can, and the indents on the lid. Despite how it looks, the can of food is a cylinder without these indentations. That is what a normal map does; it makes light reflect differently off a flat surface to make it appear as though it isn't flat. The wall in the background is another material that I made, however pressing T will change the colour from white to black.

There is still a lot which I have to do in this game. I still need to give the items some functionality (which shouldn't be too hard due to the way I have set everything up), make the level (including the door to interact with), add menus, add sounds, and implement a crafting system which I hope I have set up properly. Ideally, I will be able to complete the game today.

bottom of page