RefresherTowel
Member
Hey guys, I've got a situation going on that feels kinda funny to me and I just want to understand what's happening.
I've got a game that's basically an endless runner going downwards. It's got a basic world generation chunk system going on that creates chunks of map about 900 pixels in height and the width of the screen and destroys anything that goes above the top of the screen. The chunks of map are also entirely populated with blocks that are 16x16 in size (this is a probly a little silly, but it's just a prototype right now). The speed of the player also gradually increases as the game goes on.
As the speed gets higher and higher, the FPS drops (not dramatically, but just gradually drops with the increase in speed). I kind of expected this, I mean, at the very least I wasn't super surprised, but when I open task manager and monitor the game as it goes on, the memory use also gradually increases (not fast, just very slowly gets higher and higher). This seems a little funny to me, because it really should only be dealing with like three, four at the very max, chunks. Eventually at a vspeed of around 20-30 the game gets into an unplayable state FPS wise (memory wise it's using about 60-70 megs and CPU usage is maybe 15% or so).
So I did a little exploring. I added in a command that entirely stops the players speed and any world generation, expecting everything to stabilise when I hit the appropriate stop button. The CPU and FPS recover to normal, but the memory usage stays exactly where it was. So I added in some keyboard commands so I can move the view around to make sure that my spawned blocks are being destroyed and not clogging up the memory, and when I move the view around, there's no blocks apart from the current chunk the player is in.
I'm just curious as to what could possibly be causing the memory to not drop back down to normal when everything else does.
My block deletion code is in Begin Step and goes thusly:
The commented out section is part of me trying to figure out if anything was wrong and stop is only true when I hit space.
I've also put a check in the blocks Step Event to destroy the blocks if y < view_yview[0]. As I said, when I look around, I can't see anything other than the current chunk, but it seems as though everything being created is still stored somewhere in the memory.
Any help would be greatly appreciated.
I've got a game that's basically an endless runner going downwards. It's got a basic world generation chunk system going on that creates chunks of map about 900 pixels in height and the width of the screen and destroys anything that goes above the top of the screen. The chunks of map are also entirely populated with blocks that are 16x16 in size (this is a probly a little silly, but it's just a prototype right now). The speed of the player also gradually increases as the game goes on.
As the speed gets higher and higher, the FPS drops (not dramatically, but just gradually drops with the increase in speed). I kind of expected this, I mean, at the very least I wasn't super surprised, but when I open task manager and monitor the game as it goes on, the memory use also gradually increases (not fast, just very slowly gets higher and higher). This seems a little funny to me, because it really should only be dealing with like three, four at the very max, chunks. Eventually at a vspeed of around 20-30 the game gets into an unplayable state FPS wise (memory wise it's using about 60-70 megs and CPU usage is maybe 15% or so).
So I did a little exploring. I added in a command that entirely stops the players speed and any world generation, expecting everything to stabilise when I hit the appropriate stop button. The CPU and FPS recover to normal, but the memory usage stays exactly where it was. So I added in some keyboard commands so I can move the view around to make sure that my spawned blocks are being destroyed and not clogging up the memory, and when I move the view around, there's no blocks apart from the current chunk the player is in.
I'm just curious as to what could possibly be causing the memory to not drop back down to normal when everything else does.
My block deletion code is in Begin Step and goes thusly:
Code:
if (stop == false) {
with (all) {
if (y < view_yview[0]-15) {
instance_destroy();
}
}
//instance_deactivate_region(view_xview[0]-50,view_yview[0]-50,view_wview[0]+100,view_hview[0]+100,false,true);
instance_deactivate_all(true);
instance_activate_region(view_xview[0]-50,view_yview[0]-50,view_wview[0]+100,view_hview[0]+100,true);
}
I've also put a check in the blocks Step Event to destroy the blocks if y < view_yview[0]. As I said, when I look around, I can't see anything other than the current chunk, but it seems as though everything being created is still stored somewhere in the memory.
Any help would be greatly appreciated.