Parallax Lag

Hello everyone, I finally got my parallax layers working. Unfortunately, my game now runs really slowly on an iPhone 3GS.

The MTE debug shows that ~1600-1700 tiles (average) are displayed in-game, and that it’s using around 25MB of memory.

Is it too much for this device ? All my tiles are in 8x8 format, that shouldn’t be too memory-sucking, should it ?

Please notice that I’m using x3 zoom to make the “pixel” effect.

Also, when I remove the parallax layers (city is in two layers), the amount of tiles suddenly decreases by 1000… So what’s happening ? Look at the city in the background, are there really 1000 tiles displayed ?

140823021616607650.png

Thank you in advance.

I usually try to keep my total tiles on screen below 300-450 max…and my game features 4 levels going up and down displaying them all at once(my maps hold 1000s of tiles, but I make sure to spread them out to only show 300-450 on screen at a time). Sure at the start I was showing over 1000 tiles on screen, but soon after got into more advanced game features like tons of monsters, improved AI, random game misc stuff going on all the time and started getting some huge fps problems (especially with all the physics).

Dyson even says to keep tiles below 1000 for android, and I’m running a samsung S3 and I still have some lag running 400 tiles…but I got a lot going on in the background.

I have a few misc thoughts… yes  your memory seems HUGE and I noticed dyson likes to use collectgarbage(“step”, 20) line to help with his memory but that line is also costly on performance, I actually use that on all my maps too and it turns my 5mb display to 3mb display. What you have on screen seems weird to have 1600-1700 tiles on screen right there and 25MB seems absurd I have giant maps and probably only uses like 1500 tiles max and that takes like 30-40 seconds to get across. I know bigger sizes helps with performance being like 64x64 tiles, your background could probably easily use an image transplant that it moves around and same with your floor, the culprit could be the 8x8 tiles but that’s just speculation. But it also could be a lot on something in the coding or the file sizes of all these images on texture memory? Maybe convert your game to 16x16 or 32x32? I have my map follow different tile size rules, and my player following his own rules( your case 8x8)

Thanks for your answer, Azmar.

I tried resizing my tiles to something really bigger (16x) and… look at this…

140826120903218752.png

…WTF ???

1393 tiles -> 183 tiles ???

Anyway, my game is now working perfectly ! It uses around 12MB of memory, which is a LOT better.

I usually try to keep my total tiles on screen below 300-450 max…and my game features 4 levels going up and down displaying them all at once(my maps hold 1000s of tiles, but I make sure to spread them out to only show 300-450 on screen at a time). Sure at the start I was showing over 1000 tiles on screen, but soon after got into more advanced game features like tons of monsters, improved AI, random game misc stuff going on all the time and started getting some huge fps problems (especially with all the physics).

Dyson even says to keep tiles below 1000 for android, and I’m running a samsung S3 and I still have some lag running 400 tiles…but I got a lot going on in the background.

I have a few misc thoughts… yes  your memory seems HUGE and I noticed dyson likes to use collectgarbage(“step”, 20) line to help with his memory but that line is also costly on performance, I actually use that on all my maps too and it turns my 5mb display to 3mb display. What you have on screen seems weird to have 1600-1700 tiles on screen right there and 25MB seems absurd I have giant maps and probably only uses like 1500 tiles max and that takes like 30-40 seconds to get across. I know bigger sizes helps with performance being like 64x64 tiles, your background could probably easily use an image transplant that it moves around and same with your floor, the culprit could be the 8x8 tiles but that’s just speculation. But it also could be a lot on something in the coding or the file sizes of all these images on texture memory? Maybe convert your game to 16x16 or 32x32? I have my map follow different tile size rules, and my player following his own rules( your case 8x8)

Thanks for your answer, Azmar.

I tried resizing my tiles to something really bigger (16x) and… look at this…

140826120903218752.png

…WTF ???

1393 tiles -> 183 tiles ???

Anyway, my game is now working perfectly ! It uses around 12MB of memory, which is a LOT better.