Data_structure - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
A data structure is a way of storing information. The data structure you use is dependent on what kind of information you have to store. Below is a table comparing the data structures.
Data Structure | Description | Best used for | Example Use |
---|---|---|---|
Lists | The most common data structure, a list is a collection of values ordered across one dimension. | Keeping track of many variables of a common nature. | Storing the names of ten levels. |
Grids | Similar to a list, a grid is a collection of values ordered across two dimensions. | If you find yourself using many lists identical in nature but different for each object, you could use a grid. | Storing the starting variables (health, items equipped, score etc) of each player. |
Stacks | A list to which items are pushed onto and popped (the correct terminology for adding and removing). The item most recently pushed onto the stack is the first one to be popped from it. | Creating a list of priorities, with newest items being the most important. | Showing unread messages for a player. |
Queues | A list to which items are enqueued and dequeued; the oldest item on the list is dealt with first. | Creating a list of priorities, with items becoming more important the older they are. | Unfinished |
Maps | A map is a collection of pairs; each pair consists of a key and a value. | Unfinished | Unfinished |
Priority Queues | Unfinished | Unfinished | Unfinished |
Data Structures in GM and LGM
Data can also be stored in an array or in a variable.