Introduction

In computer science, a specific way of storing and organising the data is known as data structures. Each data structure can be designed and implemented to fit the specific purpose and needs. There are many data structure types, such as arrays, linked lists, queues, stacks, heaps, binary trees, hash tables and more. From the fist glance, data structures themselves might seem not that useful, however they are indispensable when operated in particular applications with certain algorithms, e.g., sorting, searching, deletion, insertion and so on. It allows to access and manipulate data more efficiently. [1], [2]
Data structures are widely used in game development. In video-games, operating data with certain algorithms can be used to create complex interactive experiences for players or model real-world situations and objects. [2]
For example, data structures can be used for a scene management in games. Video-games can get way too complex for any hardware to handle at once, e.g., thousands of polygons are rendered, physics has to be processed, special effects have to be drawn and updated in milliseconds. Therefore, data structures in combination with algorithms are used to speed up and optimise the performance. [2]
Furthermore, data structures can be used for artificial intelligence (AI) in video-games. Various data structures and algorithms are used to control the behavior of dynamic game elements, even in simple AI systems. [2]
Data structures are also used for the dynamic physics in video-games. Physics in games handles realistic representations of laws of physics (e.g., gravity) in object and environment. Those forces result in object movement or interaction with other objects or environment, e.g., collision. Physics and collisions holds their own set of data structures and algorithms (e.g., rigid bodies, point masses, algorithms to apply external forces, resolve interactions, etc.) that are carried out to allow objects to interact in a real time with each other and their environment. [2]
Moreover, the use of data structures can be seen in a video-game inventory system development, since game inventory systems strive to be dynamic, with quickly accessible and retrievable objects. Most of the seen examples would be implemented with dictionaries instead of just static arrays. Arrays can offer quick insertion and retrieval, however size has to be predetermined. Dictionaries, on other hand are dynamic, and will likely to be much smaller in size than arrays. Furthermore, dictionaries require Keys to retrieve elements, therefore route is often direct and as O(1). Some inventories do use linked lists, however those seem to be rather slow.[3]
Seeing how useful data structures and algorithms can be, we chose to take an advantage and use it in our own game production. This work will focus on gathering more information on already implement inventory systems with the aid of data structures and algorithms, designing and improving our own already existing inventory system for the game we were developing for the past few months.

Related work

 It is very satisfying in a video-game to loot and equip one’s character. For that a placeholder for collected items throughout games are usually implemented and called inventory systems.
In game development inventory system is not as complex in comparison to other operations such as rendering or physics. However, it is still an important aspect for most adventurous games. Data as game objects has to be organised and manipulated in a way to complement the overall functionality of the game and it’s robustness, as well as be presented to the user in understandable fashion.
According to developers’ discussions in forums, there is no “correct” way to implement inventory systems and it is highly dependent on the context and purpose of the game and it’s overall functionalities. However, when researched, it appears that the most common way to structure inventory systems seemed to be by using arrays, lists, or more complex structures as dictionaries. All of the listed examples below are mostly drawn from the programming forums - discussions amongst game developers.

Arrays and Lists

More basic data structures used for inventory systems are arrays and lists. One example suggests, the building of a stackable inventory system with the use of lists. Here, different types of items can be stacked till pre-set limit, before filling the inventory slot. First of all the base class for all inventory items are defined, where different types of items are inherited from this class. FIGURE 1