Performance bounceback project
Optimizing a pessimized game for the VR Nanodegree.
No write up was required for this project, but I jotted down my notes so I do not forget key learnings.
Started by running in profiler, only after few balls out noticed that performance was in the sub-30FPS range, with most of the processing time spent in Trampoline.Update(). The code run there could just be run in Start() for now.
Removed empty Update() and Start() calls from GameManager().
Building of the game constantly fails because the build nukes actions.json. Trying to reimport SteamVR input plugin to solve the issue. Issue was unrelated to this, I needed to build in a subdirectory instead of the main project folder, the actions.json got nuked if the build was being done in the top-level folder.
Removed RigidBodies from the Ground Trampolines. This seemed to improve physics performance a lot.
Added RigidBodies to AirTrampolines, so as not to break physics engine optimizations.
All AirTrampolines have the same movement characteristics, the update cycle can done by one Update() call. Removed component Trampoline and added TrampolineManager, which updates all air trampolines in one pass of Update().
Balls can be removed if they stay on the floor. BallManager notices collisions with floor and removes the Ball after a while.
Score is now kept in GameManager which updates the texts of the scoreboards only if there is a change.
RigidBody in ballspawner is cached as well. This properly did not help that much, as there are now only few dozen balls active at any given time.