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

How to create MUCH buffers (262144) without any array and without slow compile

Edgamer63

Member
hello, i want to know how do i create 262144 buffers without slowing down the compiler..


Yeah, i created a code that is 262144 lines, creating buffers like [Obviously with a machine created by me that creates auto-code :3 ]:
______________
Code:

global.buffer1 = buffer_create(1,buffer_grow,1);
global.buffer2 = buffer_create(1,buffer_grow,1);
global.buffer3 = buffer_create(1,buffer_grow,1);
[...]
____________________________________

But The compiler slow down so much, so i want to create this quantity , to perform a better quality to my game xD, because i can handle global buffer with only a real number like : "buffer_poke(512,255,buffer_u8,64)"

SO... There's another solution than creating a BIG ONE BUFFER, Like, making faster compiling, or creating a own function but outside gamemaker that can do it and pass buffer to my game?....

OR, Does GM2 support Compiling 262144 lines very faster?

[It consumes a lot of memory with the Array-Created Buffers]

PD: Thanks to the guy who is decided to answer this with a good way :D.
PD: It sounds crazy, but i think it's posible in GM 1.4 :v
 
L

Lonewolff

Guest
Yeah, i created a code that is 262144 lines
o_O

How's one line for you?

Code:
for(i = 0; i < 262144; i++) global.buffer[i] = buffer_create(1,buffer_grow,1);

Gotta be a better method than using a quarter of a million buffers though. I'd reconsider what it is you are trying to do.
 

Joe Ellis

Member
Or what about this:

num_buffers = 262144
repeat num_buffers
{buffer_create(1, buffer_grow, 1)}

You dont need to store the buffers in anything, once created they're stored in an internal array anyway.

You can test it by putting this in the draw event:

var i = -1;
repeat num_buffers
{draw_text(200, 200 + (i * 16), string(buffer_peek(++i, 0, buffer_u8)))}


But I'm wondering why you need to do this? Is it to make a grid that takes up less memory than an array?
 
Last edited:
Top