Windows What's actually happening behind the "background"


So I'm 15 days into learning GML and I'm getting the hang of most things and reasons why things break. Until now. So I'm going through as much as my project as I can to clean up my code. I discovered that if I turn off the 'background layer' that is created with a basic room, something odd happens.

in the image the top part the background is on. Everything seems to draw normal.
in the bottom layer the background is off. and it seems like the objects just infinity draw sprites.

To me this seems like a huge performance hit. I cant understand why the engine would draw sprites in this way.

all i have set in my objects are draw_self(); within the draw event.

The weirder thing is, not objects seem to have this effect. Slower objects don't seem to draw in this fashion.

Is there something more i need to learn about GML draw function on why this is happening? is this killing resources?

Mucho thanks for the help!



Forum Staff
Think of it like painting on a canvas. You can't remove layers of paint from it, only paint on top of what's already there.

By drawing a background, you turn it a solid color which you can then draw on top of.
Not drawing a background therefore doesn't clear what's already there, leading to the effect you found.


Ok I get it. Thanks! I wisent sure if I was spawning to many images or something else. trying to debug and turned off backgrounds because i was ceriouse. Thanks for the explanation!