top of page

Week of Tuning and Optimization

  • Writer: Liam Healey
    Liam Healey
  • Oct 30, 2021
  • 2 min read

Updated: May 22, 2024

Voidsinger

This week was spent tuning the movement system and optimizing the part grid. Work was also started on a new build UI; however, it was delayed by the part grid being too laggy when adding new parts.


Movement Tuning

Previously the movement system had been quite clunky as when rotating the player ship would often spin continuously. Also when the player switched movement directions they would keep moving in their previous direction of travel unless the player actively compensated. These two factors also made the AI struggle to control ships and so it needed to be improved. I did this in two ways: first by making it so that when moving the ship would not accelerate in the target direction but in the delta-v required to reach the target velocity, and second by making the ship decide the rotation direction based on the time to the desired look direction and the time to decelerate.



Part Grid Optimizations

We wanted ships in the game to be significantly larger than they have been during testing; however, when we try to create larger ships the game gets exponentially laggier. The first and easiest fix was to refactor some old and extremely overly complicated code for resources systems that was iterating through all parts when it didn't need to. Next was to rename the GetMass/CenterOfMass/MomentOfInteria functions to CalcMass/CenterOfMass/MomentOfInteria as they would actually recalculate the mass instead of getting the current mass and swap them with the actual getter functions. These fixes were not enough as the find and contain functions on the base TMap would iterate through all elements. I thus started creating a custom struct that would sort the map and use binary searches for dramatically increased speed.

Comments


bottom of page