Mottafier
Member
Hello!
I have been working with my brother on a mining game recently, featuring many small ore objects that span over the length of the screen, and pretty far down. There are probably over a thousand in the room total. Obviously this is going to cause issues, and I've been trying to optimize it for a few days now with little success. The closest I've come is deactivating all of the ore parent's objects, then activating all the objects within the view.
In this screenshot, I've created a second view and zoomed out, just to give you a better idea. The objects within the game view activate as they come into camera range, and the objects out of camera range deactivate. On the left are two numbers; FPS and below it FPS real. The game runs smooth when at 60 FPS, and the game runs smoothly while there is no ore on screen, but as soon as you dig down, FPS drops. I have also tried activating and deactivating on an alarm instead of every step, but when the alarm is a higher number, such as a 6 step alarm, when that goes off there is a larger framerate spike.
I should also note that the ore objects themselves aren't so bad; I've experimenting with seeing how many there can be active in total without lag. If I'm not actively deactivating or activating instances, the room can hold about twice the amount of active ore objects as in the image, with relatively smooth framerate. So I don't think the objects themselves are the issue, although I'm sure there is room for improvement.
Any solutions??
I have been working with my brother on a mining game recently, featuring many small ore objects that span over the length of the screen, and pretty far down. There are probably over a thousand in the room total. Obviously this is going to cause issues, and I've been trying to optimize it for a few days now with little success. The closest I've come is deactivating all of the ore parent's objects, then activating all the objects within the view.
In this screenshot, I've created a second view and zoomed out, just to give you a better idea. The objects within the game view activate as they come into camera range, and the objects out of camera range deactivate. On the left are two numbers; FPS and below it FPS real. The game runs smooth when at 60 FPS, and the game runs smoothly while there is no ore on screen, but as soon as you dig down, FPS drops. I have also tried activating and deactivating on an alarm instead of every step, but when the alarm is a higher number, such as a 6 step alarm, when that goes off there is a larger framerate spike.
I should also note that the ore objects themselves aren't so bad; I've experimenting with seeing how many there can be active in total without lag. If I'm not actively deactivating or activating instances, the room can hold about twice the amount of active ore objects as in the image, with relatively smooth framerate. So I don't think the objects themselves are the issue, although I'm sure there is room for improvement.
Any solutions??