Idle balls begin to lag a ton after level 1k since you usually have so many balls by then. The goal is to fix this issue or at least make it better. I already added a way to switch sounds off which fixes a bit of lag but phyisc are the other problem.
I watched a video where some guys made a lag machine in Minecraft. This lag machine spawned and stored a ton of snowballs. In order to make the server’s inhabitants lag but not the machine’s builders lag, the builders of the machine used some PC Minecraft thing that changes textures on one’s client. The guy then used this thing to change the snowball texture to a 1x1 transparent square for himself, preventing his own lag but still keeping the others.
Perhaps you could create a setting in game that reduces the pixel size for the balls at later levels?
Flowlab works differently than minecraft, while that would optimize the pixel art, it would not optimize the physics which means it would barely change the lag.
Hmm. Maybe you could request grazer to add a feature that lets you change physics mid-game?
can you post a screenshot of the game with performance metrics on when the game is laggy?
How many balls are in the game at this point do you think?
What objects have proximity in them? Can you replace them with a distance formula? Not related to physics, but it might improve performance.
Wow, there is a lot of stuff going on in that performance panel. There are really two big bottlenecks that need to be addressed:
The physics (probably collision detection/resolution) is taking 32ms, which is a long time, probably due to that big cluster of balls touching each other in the center
The behaviors are taking 21ms, which is also a long time. There isn’t really one huge standout behavior, but I’m interested in that Destroyer number - I have no idea what could be making that take almost 3ms. Are there a lot of objects being destroyed every frame?
Yep. Plenty of blocks are constantly being destroyed on a whim due to the sheer power of the player’s balls.
No, the game destroys the balls when a level ends and respawns them, though. I’ve figured out that the destroyer is very laggy. In SWARM, the explosion particles lag from destroying just 25 of them each enemy.
this gets much worse when they start moving.