var chunk_x = argument0;
var chunk_y = argument1;
var chunkdata = chunk_data_load(chunk_x,chunk_y);
var chunk_object = instance_create(chunk_x*BLOCK_SIZE*CHUNK_SIZE,chunk_y*BLOCK_SIZE*CHUNK_SIZE,obj_blockchunk);
chunk_object.data = ds_grid_create(CHUNK_SIZE,CHUNK_SIZE);//create the grid for the object
ds_grid_read(chunk_object.data, chunkdata); //load data into the grid
chunk_object.chunk_x = chunk_x;
chunk_object.chunk_y = chunk_y;
I suggest taking some time recordingsAny thoughts?
var time = current_time;
// functions here
var delay = current_time - time;
show_debug_message("time: " + string(delay) + " ms");
var time = current_time;
var chunk_x = argument0;
var chunk_y = argument1;
var chunkdata = chunk_data_load(chunk_x,chunk_y);
var chunk_object = instance_create(chunk_x*BLOCK_SIZE*CHUNK_SIZE,chunk_y*BLOCK_SIZE*CHUNK_SIZE,obj_blockchunk);
chunk_object.data = ds_grid_create(CHUNK_SIZE,CHUNK_SIZE);//create the grid for the object
ds_grid_read(chunk_object.data, chunkdata); //load data into the grid
chunk_object.chunk_x = chunk_x;
chunk_object.chunk_y = chunk_y;
var delay = current_time - time;
show_debug_message("time: " + string(delay) + " ms");
Would be cool if the red bar would be cpu and the yellow bar gpu. But they decided that the red bar is just everything in the step / yellow bar in the draw event. So drawing in the step event will make the red bar increase.Have you used the profiler within the debugger to try to identify the cause of the lag spikes?
Also, turn on show_debug_overlay(true) and see if the lag is CPU or GPU based. I think the red bar is code and yellow bar is drawing.
I can't use debug messages because it's being spammed with "Grid 0, index out of bounds writing [0,32] - size is [32,32] - in fact, maybe that has to do with my issue?I suggest taking some time recordings
ExampleCode:var time = current_time; // functions here var delay = current_time - time; show_debug_message("time: " + string(delay) + " ms");
Your console should spit out messages that tell how much miliseconds have passed since that function.Code:var time = current_time; var chunk_x = argument0; var chunk_y = argument1; var chunkdata = chunk_data_load(chunk_x,chunk_y); var chunk_object = instance_create(chunk_x*BLOCK_SIZE*CHUNK_SIZE,chunk_y*BLOCK_SIZE*CHUNK_SIZE,obj_blockchunk); chunk_object.data = ds_grid_create(CHUNK_SIZE,CHUNK_SIZE);//create the grid for the object ds_grid_read(chunk_object.data, chunkdata); //load data into the grid chunk_object.chunk_x = chunk_x; chunk_object.chunk_y = chunk_y; var delay = current_time - time; show_debug_message("time: " + string(delay) + " ms");
You might want to fix that then before you deal with other issues...I can't use debug messages because it's being spammed with "Grid 0, index out of bounds writing [0,32] - size is [32,32] - in fact, maybe that has to do with my issue?