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

Out of Memory Error

Z

ZeToastedBagel

Guest
I am coming across this error making my game un-playable in extremely early development.

Important details:
-The room I am running is in 4096x4096.
-I have wall objects throughout the whole room (is a randomly generated dungeon crawler that creates paths in the walls).
-The biggest "wall" piece is 2048x2048.
-This is the second version of this game and this has been my solution to this problem

if x<view_xview+view_wview || x>view_xview || y>view_yview || y<view_yview+view_hview
draw_self();

And this code would be placed in a parent object for my enemies, particles, and walls inside the draw event.

-In the current state I would be just standing still and it will run out of memory.
-All the room creation(any pathing) is deleted as soon as the character is placed in and ready to delve in the dungeon.

Any suggestions?
 

obscene

Member
You have a memory leak that could be coming from all kinds of things...

Particle systems being created but not destroyed?
Audio Emitters being created but not destroyed?
Instance being created but not destroyed?
Surfaces being created but not destroyed?

Wherever you are doing any of the above that you suspsect you don't fully understand, copy the code here.
 
B

bojack29

Guest
What you should look into doing is instead of creating thousands of objects to make up the room itself, consider drawing these objects to a surface and using a global grid to detect collisions. This will save you hugely on performance.
 
M

Murr_

Guest
Make sure not to bombard your MEMORY with things that are not being used at the moment. So always destroy those objects whether they get out of the VIEW or when there not being used.
 
Z

ZeToastedBagel

Guest
So currently in this state of the game, I am not using any particle emmiters, and no audio. Ive got walls that shrink in size: (say, ive got a 32x32 that will break to 4 16x16). On an older but similar project (changing some of the mechanics and level creation) I have been able to just not draw the objects while outside the view and be fine. (I need the walls for some path-finding enemies, and to remember as I traverse the dungeon).

I also have not learned to use surfaces yet.
 

FrostyCat

Redemption Seeker
Are your blocks dividing when they shouldn't be? Keep an eye on your instance count using the debugger.

Are your path-finding enemies creating new paths every step without cleaning them up? Make the create an empty path in its Create event and reuse it until it dies off, or use step-based mp_*() functions.

Are you dynamically allocating any kind of resource (e.g. data structures, motion planning grids, etc.) every step? Make sure to clean up after them.
 
Z

ZeToastedBagel

Guest
So i have figured out the problem. When going into debug mode I found in my global variables that I was creating the mp grid at every step instead of only once when the final room is created. Ending up with over 2000 path grids before crashing. Thanks all for your help!
 
Top