OpenRA icon indicating copy to clipboard operation
OpenRA copied to clipboard

Fly, use rotating buffer over list to store last 5 positions.

Open anvilvapre opened this issue 2 years ago • 0 comments

Fly stores the last the position over the lats 5 ticks to determine the distance travelled and whether flight is stuck.

  • Replace position buffer List with an rotating buffer. To avoid removing the head element from a list array each tick. Avoiding a ArrayCopy/Move each tick.
  • Avoid addition of one WVec/Pos to Zero WVev/Pos. Trivial.
  • Tickfacing, 50% change of one less subtraction. Trivial.
  • RotatingBuffer can be reused in new contrail implementation. Could potentially also be used in input tap detection. (only used function tested)

Future possible improvements: Map.DistanceAboveTerrain is looked up more often by all flight activites/functions - during the same tick. For rectangular maps the operation is not that expensive. Functions already take many arguments - did not want to add it.

anvilvapre avatar Jul 23 '22 16:07 anvilvapre