• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - GML Visual Examples on How to Use: Ds Lists/Maps, Buffers

Where can I find some tutorials or examples on how to use buffers, ds_lists, and ds_maps? I've looked up the individual commands in the manual, but how I use the different commands together (for example say the ds_list commands) and what they'd accomplish used in series is difficult to figure out, without an example to see what they actually do.
 

zbox

Member
GMC Elder
Lists are just higher level arrays (you can manipulate them a little more intuitively, for example, delete one item and the rest of the items move down one. You can also sort them).
They just store values in succession, 0-> value, 1->value, etc etc

Maps are a way to give data values labels, where a list wouldn't be appropriate. For example if I wanted to record someone's name, favourite colour and height I would not use a list because the procedural nature is not appropriate. It also makes code a lot easier and more intuitive to understand. You would access them as follows: map[? "colour"], map[? "name"] and map[? "height"]

Buffers are just direct access to binary data stored in the memory and are a lot faster than the high level abstractions that are maps and lists. You probably don't need to worry about them. When you NEED to use them you will already know about them from experience :)


Lists and maps (maps are also referred to as objects sometimes) are a very common computer programming idiom. They form the basis for example of the JSON spec (which GM supports). Read some more here http://json-schema.org/example1.html
 

Jobo

Member
GMC Elder
List:
item1
item2
item3

Map:
item1=value1
item2=value2
item3=value3

A buffer is just a block of memory that you can store data in.
 
Top