Description

A set of scripts that replace the functionality of ds_grid_write/read with a buffer equivalent that provides much much smaller storage size and speed.

Works with grids that are filled with numbers only, not strings.

On average, compared to using GM's functions to write to a string, saving the grid as a buffer can make the resulting data 5-15% of its original size. That means if the size of your grid as a string takes up 1kb, your file size can be reduced to a measly 50 bytes of storage. Provides the following functions

ds_grid_write_buffer(grid[,decimals])
/* Returns a buffer. The decimals parameter is optional, if supplied and true it will store floats (decimal numbers) accurately. Otherwise if omitted or set to false, all numbers will be truncated if need be to integers.
*/
ds_grid_read_buffer(buffer) // Returns the grid back in tact

See the included test object for a working demonstration.

More Assets:

GMLVideo

SafeSave

Easy Google Analytics

WebView

End User Licence Agreement (EULA).

Changes in 1.0.1

Fixed a typo within the demo.

Version 1.0.1. Published April 3, 2017

Created with GameMaker: Studio v1.99.525

Age Rating: 4+

Average Rating

Your review

You can only review assets you've bought.


Gravatar

Anonymous 15 August 2017

Error

ERROR in
action number 1
of Step Event0
for object obj_player:

Illegal Buffer Index
at gml_Script_ds_grid_read_buffer (line 6) - buffer_seek(b, buffer_seek_start, 0);
stack frame is
gml_Script_ds_grid_read_buffer (line 6)
called from - gml_Script_chunk_data_load (line 18) - case(0): return ds_grid_read_buffer(grid1); break;
called from - gml_Script_chunk_load (line 26) - var chunkdata = chunk_data_load(chunk_x,chunk_y,0);
called from - gml_Script_tile_check (line 27) - chunk_load(chunk_x,chunk_y);
called from - gml_Script_col_tile_meeting (line 5) - if tile_check(argument0,argument1,argument2) > 0
called from - gml_Script_grid_place_meeting (line 14) - var col_1 = col_tile_meeting(bbox_left,bbox_bottom,0);
called from - gml_Script_playerStateNormal (line 25) - if (place_meeting(x,y+1,obj_solid)) || (grid_place_meeting(x,y+1)) {
called from - gml_Object_obj_player_Step_0 (line 23) - script_execute(state);

Dunno what this issue is.


Gravatar

Myles P 04 April 2017

Extremely useful

I have been using and saving large grids for an open world game. This has helped optimize and save memory greatly. Thanks!

Package contents

Total size 4.05 KB

What is the issue?

Back to Top