Opened 3 years ago

Last modified 23 months ago

#6127 new enhancement

Further 'unit pushing' work

Reported by: wraitii Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords:
Cc: Patch:

Description

Follows Phab:rP25182

There are some other improvements to pushing that would be desirable:

  • Ideally, idle units would go in a 'sleep' state to avoid having to check them against other idle units. This would need some logic to wake them up once units come nearby.
  • Idle-Moving unit pushing was not implemented. Implementing this would streamline the pushing logic somewhat, and would further improve movement (see also #3442).
    • The hard problem is managing to use the short-pathfinder to still walk around impossible paths, such as a U-shaped big blob of units that you can't 'push through' (_or_ pushing those units away in the first place).
  • There's no template-ability > all UnitMotion units use pushing to the same degree. It would possibly be useful to give units weights". Likewise, the distance at which units push could be tweaked.
    • This could possibly be used to make force fields.

...[complete this]...

Change History (3)

comment:1 by Imarok, 3 years ago

Milestone: Alpha 25Alpha 26

comment:2 by wraitii, 2 years ago

In 26245:

UnitMotion pushing improvements

The main change is the introduction of a 'pushing pressure' counter on units. This counter increases when units get pushed around, and decreases over time. In essence, units under high pressure move slower & are harder to push around.
The major effect is that units can now get bogged down when very dense groups start colliding. This makes movement more realistic, makes unit movement more 'chokepointy', and generally improves the mathematical soundness of the system (lower values are easier to handle for our 200ms turns).

Other changes:

  • The logic to detect units crossing each other's path has been reworked. Units that run towards each other should not more obviously avoid each other.
  • New parameters: 'Spread' is a measure of how strong the pushing effect is based on distance. With the current settings, static-pushing is rather 'on/off', whereas moving-pushing is more gradual (and thus the max influence distance was increased when moving).
  • Default values have been tweaked for lower overlap.
  • Units only looked at other units within their grid region. This led to overlap near grid-borders. Units now look at neighboring grid elements, which largely removes this issue. While this may be slower, the performance of pushing was largely negligible before, so it is unlikely to become a main cause of lag (and overlap was generally disliked by players).
  • Units no longer orient in the direction of pushing, but instead keep facing their target. This can look slightly odd under very heavy pushing forces, but vastly improves behaviour of very slow units such as rams (since they spend much less time turning around). As a side-effect, clean up angle code following rP25953 .

Engine changes:

  • Add a debug rendering mode at compile-time to help understand what is happening.
  • Make it possible to constexpr initialise fractional fixed numbers by using FromFraction

The 'pressure' change was inspired by alre's suggestion at https://wildfiregames.com/forum/topic/56436-for-a-better-unit-movement/#comment-461987

Refs #6127

Differential Revision: https://code.wildfiregames.com/D4439

comment:3 by Freagarach, 23 months ago

Milestone: Alpha 26Backlog
Note: See TracTickets for help on using tickets.