Optimizing objects
-
@Stanica yeah that could be the cause also. 60 objects is a pretty big number imo. My main scene on my game has at the most 30 items and I was already dealing with FPS issues as well. My only other recommendation is to possibly recycle those images on view. For example have only like 20 objects on scene and constantly move them to the players view.
-
@SplitMindGaming Unfortunately, the course is procedurally generated so I can't do anything fancy like render only the part of the course that's currently visible. If I could set a seed for the random number generator then I might be able to....
-
How large are your graphics? and how much transparent space is there? Transparency really kills performance. You should try to crop as tightly around your objects as possible.
-
You should be able to have more than 60 objects out without having lots of lag. If you want to you could upload your project for me/anyone else to look at and see if they can help find causes of lag (my iPad is expert at this cause it's already laggy 😛)
-
@Murtaza said in Optimizing objects:
How large are your graphics? and how much transparent space is there? Transparency really kills performance. You should try to crop as tightly around your objects as possible.
Each sprite is 2048x2048, scaled down to 10% with no transparency.
@Aidan-Oxley said in Optimizing objects:
You should be able to have more than 60 objects out without having lots of lag. If you want to you could upload your project for me/anyone else to look at and see if they can help find causes of lag (my iPad is expert at this cause it's already laggy 😛)
I might take you up on that if I can't find a suitable fix.
-
@Stanica That's massive. If you can, scale down the actual image size so that your objects can exist at 100%. You should get the same quality images but way less lag.
-
@Aidan-Oxley I'll try that or increasing their size to 20% so there are fewer objects on screen at once.
-
@Stanica If your image editor allows it, scale your sprites down to 205 × 205 pixels, and then replace your objects with those and scale them to 100%. They should look exactly the same, I think. Yeah having fewer objects can help a bit, like if you can combine some tiles that don't do much from 2 or more separate objects into one, especially if they are background objects that don't move.
-
@Aidan-Oxley 👍
-
@Stanica that has to be the problem right there. 2048 x 2048 for each sprite. Yeah I always try to make each of my object the exact size it needs to be without having hyperPad constantly tell the code to resize the image. The less instructions you can have hyperPad make. The better. Scaling it down to the actual size. Removing all the empty space borders. If you have photoshop the best way to really crop it perfect is to to go to file. Then export to layers. This will crop each image perfectly.
-
Yeah the image size is definitely affecting your performance.
As the rest have suggested, try making it the actual size you need. For something like this that will be used to create a procedurally generated level I would avoid going beyond 256x256 pixels.
-
Thanks for the tips everyone. Managed to fix all performance issues by decreasing the size of my assets!