I try to load big level, and found that FPS is super low. Time for optimization 🙂 I think of three things that can be slow:
- Colliders debug draw;
- Tilemap;
- Non-tile entities (eg. player, enemies, objects).
Colliders debug draw
I try to disable debug draw, but it doesn’t help.
Tilemap & entities
Okay. Next I tried to disable everything except colliders debug draw.
60 FPS. So problem is in tilemap or entities.
Tilemap
Next I disable tilemap rendering:
58-60 FPS. The problem is definitely in tilemap. What happens if I disable only the floor?
42 FPS. I’m on the right way.
First try: visibility
I try to use visible
property to hide tiles that are out of screen. But with little success. Instead of desired 60 FPS I get only 30. It is better than initial (14), but still bad.
So, even if geometry is not visible, luxe still need some time to process them.
Second try
Fine. And what if, instead of switching visibility
, try dynamically adding and removing geometry to / from the batcher?
58-60 FPS. It turned out that this is the right way.
P.S.
In the process of debugging 🙂
P.S.S.
See you later!
2 thoughts on “GD2D: dev log #8”