In my project (Minecraft- type game) Im using WithThreeJS extension, so every sprite is tiled sprite
And when i have more than 80 objects i get max 20 FPS
Do you guys know what could i do in order to reduce the amount of objects in the scene? Like Idk mush them together or something like that?
also i have too much events in my scene, could that also cause problems with performance, i have such big performance issues that it just won’t launch the game anymore because it crashes
80 objects isn’t much. It can be a number of things that affect the game speed. Could you screen shot the events, or some of them that represent a good cross section of the overall events? It’s a good starting point.
These are the ones that debugger said were taking the most resources
I think it’s because there is too many object on he scene so i think i need to combine some of them into one object or something like that like minecraft does it, or something Idk
i was forced to make my own collisions because WithThreeJS can’t resolve collisions between Oriented bounding box and it’s the only way i can put SpriteSheets on the objects
No, it’s because you are iterating over all ObstacleObjects multiple times per game frame. That event can add up in terms of processor usage.
You should narrow down the objects you are working with on event before you iterate over them in a subevent of that. So something like:
Hitbox is in collision with ObstacleObject
Repeat for each ObstacleObject
However, unless there's the possibility of the Hitbox colliding with more than 1 ObstacleObject at a time, you don't need to iterate over every ObstacleObject. Instead, just check for an ObstacleObject collision with Hitbox. GDevelop will just work with the 2 objects that meet the condition.
If there will only ever be 1 ObstacleObject colliding with Hitbox, then you can get rid of the "Repeat for each instance of ObstacleObject" event and replace it with a standard event with the condition "Hitbox is in collision with ObstacleObject".
Yup I’m using obstacle objects as a blocks, i already am trying to make the events a little better but either everything collapses on itself or program just straight up crashes
Also i did some testing and on the new scene without any events or objects on the scene program can only handle 400~ tiled sprite objects without FPS loss (for comparison players can see 6,400 blocks on the surface in minecraft on 2 chunk render distance)
now im starting to wonder if “Multithreading” exists in Gdevelop
Or “Frustum Culling”, “Occlusion Culling”, “LOD” or anything like that?
Heya, so i was doing stress test a few days ago and i noticed that tiled sprites are significantly more resource intensive than regular sprites (i got ~20fps with 100+ tiled sprites rendered on the screen whereas normal sprites got consistent 60 fps with 1000+) . So it’s save to say the amount of sprites is one of the contributors to the lag. So if you can you should try replacing those tiled sprites with regular sprites. Otherwise you can just use the culling code that MrMan linked.