WilsonCWu / battlegame

init
0 stars 0 forks source link

Unity Profiling Notes #845

Open WilsonCWu opened 3 years ago

WilsonCWu commented 3 years ago

Need to remove all layout groups lighting needs to be baked

WilsonCWu commented 3 years ago

More profiling notes:

we only have 16ms per frame to hit 60fps, quick maths

tested on samsung s7-edge. the goal is 60fps on it, anything worse will just be capped to 30.

simulating a battle is actually quite expensive. costs 150+ms to simulate (I only did short battles, it goes way longer). we need to split this simulation time across multiple frames, and add an anim to hide this cost

still investigating further, but our canvases suck. 6ms is being used just to render the canvas, even when we dont move/change it at all. I'm under the impression that this shouldnt happen if nothing is happening, so will try to see what's actually causing this to happen.

6-10 ms is being used per frame to render the actual combat. there's not much way of avoiding this cost, though removing lighting shaves off a lot. Even with removing all particles and projectiles, plus limiting to max 1 enemy, the time improvement isnt very significant here. Most of the character stuff is somewhat batched anyways since materials are mostly shared, and we dont really have that many projectiles/particles to begin with (especially at 1x speed for afk battles)

literally all other code is so lightweight that it doesnt show up until the very bottom of the list. absolutely no point in optimizing that performance compared to spending time on graphics

30fps cap actually doesnt feel that bad, but when it keeps jumping between 30-60 its horrible.

WilsonCWu commented 3 years ago

check if scroller inertia is clamped edit: looks like unity has thsi built in now