• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

Backgrounds causing extremely slow gameplay

Hello, I have an issue and not the slightest idea as to what might be causing it or what could fix it. My game runs just great, until I add in backgrounds. My goal is to have parallax scrolling, so multiple background layers are required.

I have not introduced any scrolling features to the backgrounds at all. I just made some art to test it out in game. I found that it was running at least half the speed it should be. I then tried to decrease the size of my backgrounds to 1,000x1,000. I figured that this should be easy for GM to handle. Booted the game up again and it was running smoothly, because I did not stretch the background or tile it etc. Essentially, the small background was only in one area of the room so that I could test the performance. When the player object got close to the small backgrounds, the game started to chug again.

My only guess as to why this may be happening is perhaps my camera object, which follows the player and acts similarly to a view? But it seems strange that this would happen. The only other time I've noticed the game having performance issues is while on a specific ladder where the entire view shows the wall that is being scaled, so that the only things visible are the wall, ladder, and player. This is somewhat similar to the performance issues I suffer when nearing backgrounds, as it seems to reach its worst point when the entire screen features the background.

Any ideas as to what might cause this?
 

andulvar

Member
GM shouldn't chug at all from something that small. I'm assuming your "background" is actually an object? Did you try making it a tile? Do your texture swaps spike when the background is in view?
 
@andulvar it's definitely not an object. I simply created a background, not a sprite, and in the room editor, went to the background tab and put in background 0-3, so that I could start implementing the scrolling effects. But I never implemented them, since I started the game to see if the backgrounds looked good, and noticed the game running slower than half its intended speed. It's not a tile, just a background. What do you mean by texture swaps? All issues are only encountered while the background is in the view

@RangerX I could try to find any semi related code, but honestly I don't know if there is any, since, as I've stated above, I simply added the backgrounds to the room, but never got around to the parallax scrolling. The backgrounds are currently 1000x1000, as I tried seeing if shrinking them would fix it, but it didn't. The room size is 10,000x10,000. That is a big room, but it never lagged before.
 
Top