Pyrogenesis trunk

Variables  
constexpr int  PUSHING_GRID_SIZE = 20 
Units push within their square and neighboring squares (except diagonals). More...  
constexpr entity_pos_t  PUSHING_CORRECTION = entity_pos_t::FromFraction(5, 7) 
For pushing, treat the clearances as a circle  they're defined as squares, so we'll take the circumscribing square (approximately). More...  
constexpr int  PUSHING_REDUCTION_FACTOR = 2 
Arbitrary constant used to reduce pushing to levels that won't break physics for our turn length. More...  
constexpr entity_pos_t  MAX_DISTANCE_FACTOR = entity_pos_t::FromFraction(5, 2) 
Maximum distancerelated multiplier. More...  
constexpr int  MAX_PUSHING_MULTIPLIER = 4 
Maximum pushing multiplier for a single push calculation. More...  
constexpr entity_pos_t  PERPENDICULAR_NUDGE_THRESHOLD = entity_pos_t::FromFraction(1, 10) 
When two units collide, if their movement dot product is below this value, give them a perpendicular nudge instead of trying to push in the regular way. More...  
constexpr int  MAX_PUSH_DAMPING_PRESSURE = 160 
Pushing is dampened by pushing pressure, but this is capped so that units still get pushed. More...  
constexpr int  MIN_PRESSURE_IF_OBSTRUCTED = 80 
When units are obstructed because they're being pushed away from where they want to go, raise the pushing pressure to at least this value. More...  
constexpr entity_pos_t  PRESSURE_STATIC_FACTOR = entity_pos_t::FromInt(2) 
These two numbers are used to calculate pushing pressure between two units. More...  
constexpr int  PRESSURE_DISTANCE_FACTOR = 5 

constexpr 
Maximum distancerelated multiplier.
NB: this value interacts with the "minimal pushing" force, as two perfectly overlapping units exert MAX_DISTANCE_FACTOR * Turn length in ms / REDUCTION_FACTOR of force on each other each turn. If this is below the minimal pushing force, any 2 units can entirely overlap.

constexpr 
Pushing is dampened by pushing pressure, but this is capped so that units still get pushed.

constexpr 
Maximum pushing multiplier for a single push calculation.
This exists for numerical stability of the system between a lightweight and a heavy unit.

constexpr 
When units are obstructed because they're being pushed away from where they want to go, raise the pushing pressure to at least this value.

constexpr 
When two units collide, if their movement dot product is below this value, give them a perpendicular nudge instead of trying to push in the regular way.

constexpr 

constexpr 
These two numbers are used to calculate pushing pressure between two units.

constexpr 
For pushing, treat the clearances as a circle  they're defined as squares, so we'll take the circumscribing square (approximately).
Clerances are also fullwidth instead of half, so we want to divide by two. sqrt(2)/2 is about 0.71 < 5/7.

constexpr 
Units push within their square and neighboring squares (except diagonals).
This is the size of each square (in meters). I have tested grid sizes from 10 up to 80 and overall it made little difference to the performance, mostly, I suspect, because pushing is generally dwarfed by regular motion costs. However, the algorithm remains n^2 in comparisons so it's probably best to err on the side of smaller grids, which will have lower spikes. The balancing act is between comparisons, unordered_set insertions and unordered_set iterations. For these reasons, a value of 20 which is rather small but not overly so was chosen.

constexpr 
Arbitrary constant used to reduce pushing to levels that won't break physics for our turn length.