• 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!

Legacy GM Data Structure Dumps

T

The5thElement

Guest
Hello fellow GMC members! I am working on a dungeon crawler style game that requires a lot
of data structures to store items, abilities and such. I would like to create and application using
Visual C# to create DataGridView that would allow me to visually create a ds_grid. I was just
wondering if there is a specific way the ds_grid_write() function converts the values for the
data dump. So that I can use that same process to convert a DataGridView into a data dump
that game makers ds_grid_read() function can understand.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
ds_grid_write\ds_grid_read format is binary data encoded as text. It's not documented and a bit purpose-specific. I would suggest to either:

A. Make a helper function that can set an entire grid row at once, so that you can have a bunch of calls to these and not make an external program at all,
Code:
#define ds_grid_set_row
/// ds_grid_set_row(grid, y, ...values)
var g = argument0;
var r = argument1;
var i = 0;
repeat (argument_count - 2) {
    ds_grid_set(g, i, r, argument[i + 2]);
    i += 1;
}
Code:
ds_grid_set_row(items, 0, "Sword", ItemType.Weapon);
ds_grid_set_row(items, 1, "Helmet", ItemType.Armor);
B. Make a reader for [urll=[URL]https://en.wikipedia.org/wiki/Comma-separated_values]comma-separated[/URL] value[/url] so that you could use Microsoft Excel/OpenOffice Calc/Google Spreadsheets to edit the actual table (with all convenience) and re-export a CSV over the included file in the game.

C. If you are determined to make your own software for the task, make some simple-to-parse format that it can export and GameMaker code could import.
 
T

The5thElement

Guest
I'm a little confused. You say that the read and write functions use binary, but isn't binary groups of eight 0s and 1s not containing
alphabetic characters or numeric characters greater than 1? But it looks like it would be better to use suggestions A and B in
conjunction. Thank you very much for the help, it is greatly appreciated!
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I'm a little confused. You say that the read and write functions use binary, but isn't binary groups of eight 0s and 1s not containing
alphabetic characters or numeric characters greater than 1?
Binary data can be compacted for storage in variety of ways.
For instance, a common method is to encode every 4 bits as a symbol of set 0123456789ABCDEF, meaning that every byte will become 2 symbols.
Other common method is Base64, which has every 3 bytes become 4 symbols.
 

GMWolf

aka fel666
I would write my own system. Perhaps using buffers.
At the start of the buffer, but the size of the grid. Then just iterate through the grid and add the information to the buffer.
To decode, read the size of the grid, then iterate through the grid, reading one value each time.
 
Top