• she/her

Gamedev w Slug Human.
evil milf 🐾🏳️‍⚧️🦝💕

posts from @schera tagged #game design

also:

You can usually guess the source of performance issues without even profiling, just by how things look.

First off, u need to be able to tell spikes from slowdown.

Spikes ~ hanging on a single frame while others run normally
Slowdown ~ low frame rate across a stretch of frames

A patch of frequent spikes looks slightly different from a patch of slowdown bc the framerate is more jittery and choppy. But at times it can be hard to tell. Ofc you can have spikes and slowdown at the same time...

So, if ur experiencing spikes, there are a couple likely culprits.

If your spikes are happening at the exact moment that something occurs, its likely tied to either asset loading or object creation/destruction/activation.

Activating an object for the first time comes w a small performance spike, and creating or destroying and object comes with a larger one. Preloading or pooling gameobjects can help. Also, asset loading can be vastly improved by tuning the assets' import settings.

If your spikes are happening at seemingly-random moments, the Garbage Collector is probably the reason. The GC isn't as bad as it used to be, but can still ruin your performance. Luckily there are still tons of tutorials explaining how to optimize for GC from back when it was the Unity-game-ruiner.

Anyways, if you're experiencing slowdown and not spikes, you should first figure out if the framerate corresponds to where the camera is pointed. If it does, you probably have too many renderers in view. Transparent renderers especially. Maybe it could be poly count, but probably not unless youre using models that arent meant for games. Otherwise, scripts that use OnWillRender() could be contributing.

If the camera orientation doesnt much change consistent slowdown, this leaves us with the sort of "everything else" of optimization. Ive seen this happen for all kinds of reasons, and you will definitely need to use the profiler to be sure.

This is where scripts with expensive Update()/FixedUpdate() will take their toll. So pretty much all the stuff people usually think of as optimization. It's not just inefficient code tho; if you have enough objects, even a tiny update function can take a huge toll too. Recently our biggest framerate-drain was from having hundreds of objects which just rotated at a constant rate...

Anyways, hope this was helpful or interesting. Obviously im not against using the profiler, its just useful and speedy to be able to eyeball things.

Also, it makes you feel like a badass when you guess correctly idk ☆♡