2025-07-21: Spawn phase reordering

Reordered the spawn phase for capital ship fighters.

Originally the timeline was:

  • Capital ships spawn fighters
  • Capital ships refresh their view of the fighters
  • Capital ships send orders to fighters (these take effect immediately)
  • Sort internal fighter data by their current task for easy batching
  • (general game simulation)
  • Fighters prune dead entities if any were killed
  • Tick end

This involves changes to the fighters’ data layout three times in the tick (spawn, sort, prune). It was messy and the data’s representation was less stable than I wanted.

Capitals now queue spawn requests which are committed at the end of the frame, right after the kills. We now have two layout changes instead of one. Capitals now see a stable view of the fighters during their decision phase.

I intend to make the orders also use a queue system. I can either delay to the tick end or the start of the next tick. Either way, all the state changes will be localised to one tick boundary.

My check() calls CQ tests are proving their worth. The transition to tick-end spawns was pretty simple. Issues with the data were caught immediately by the check() calls and the tests confirmed the resulting gameplay was unchanged.