Opened 3 years ago

Closed 3 years ago

#5936 closed defect (fixed)

Ranged cavalry cannot be efficiently chased

Reported by: wraitii Owned by: wraitii
Priority: Release Blocker Milestone: Alpha 24
Component: Simulation Keywords:
Cc: Patch: Phab:D3402, Phab:D3482, Phab:D3230

Description

Try to chase ranged cavalry with melee cavalry: it doesn't really work.

Attachments (1)

commands.txt (220.1 KB ) - added by Feldfeld 3 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by Stan, 3 years ago

Patch: Phab: D3402Phab:D3402

comment:2 by Stan, 3 years ago

Owner: set to wraitii
Status: assignednew

comment:3 by Silier, 3 years ago

Component: Core engineSimulation

comment:4 by wraitii, 3 years ago

Resolution: fixed
Status: newclosed

In 24708:

[gameplay] Fix chasing range cavalry

This fixes chasing, particularly chasing ranged cavalry.

  • Standardise the range of melee cav to 4.
  • Decreases the speed of ranged cavalry slightly to make melee cavalry a better counter & reduce the ability of ranged cavalry to dominate an area.
  • Fix UnitMotion to better chase units, by increasing direct-range distance and making "from scratch" short paths recompute better paths (by increasing the search range).
  • Gives some free rotation time for slight angles to units. Angles below 30° take no time to rotate towards. Chasing units that recomputed a lot of paths could be slowed down substantially by minute angle differences.

Fixes #5936

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

by Feldfeld, 3 years ago

Attachment: commands.txt added

comment:5 by wraitii, 3 years ago

Resolution: fixed
Status: closedreopened

Reopening, it so happens that my test map tested with an chaser having a _lower_ entity ID than the chasee, meaning it moves first. This means that it starts every Move() call too far to attack, and ends in range, but at that point it doesn't inform UnitAI or that would bug.

It should be fixable without too much complexity and in fact it's basically D3230, but I need to check if there aren't other issues with MP turns.

comment:6 by wraitii, 3 years ago

Patch: Phab:D3402Phab:D3402, Phab:D3482, Phab:D3230

comment:7 by wraitii, 3 years ago

In 24797:

Check for movement success/failure on turn start.

Unit Motion currently checks if the unit is at destination during the MT_Update_Motion* step, which happens late in the turn (notably, after Timer.js) and moreover happens while entities are being moved (e.g. entities with lower IDs have moved already, entities with higher IDs have yet to do so).

This changes UnitMotion to instead check at turn start, which:

  • benefits from in-turn path computations for more fluid movement
  • ensure that distance checks aren't done against an entity that has already moved for the turn.

The latter issue led to units failing to get in range of their target when chasing them, in some situations.

As a side effect, this means that UnitAI move requests always take one turn to succeed, so orders should be updated to check for range (or they'll waste a turn). This is done for garrisoning, other orders were already doing so.

Also includes a small tweak to avoid units rotating randomly when they have no movement to accomplish.

Patch by: bb

Reviewed By: wraitii

Refs #5936

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

comment:8 by wraitii, 3 years ago

In 24798:

Chasing fix - ignore the target's obstruction to avoid colliding with it.

Units movement is currently "all or nothing". This means that a chasing entity that moves fast enough is likely to collide with its target, if the latter is moving also. This means that it might fail to get in range if the max range is smaller than the movement speed over a turn.
This happens to be very much the case in MP, as cavalry range is 4, melee cav speed is ~20 and turns are 500ms.

This problem depends on which unit moves first (i.e. which unit is lowest-ID).

To fix this, ignore the obstruction of the target, if it is moving, when moving. This however means sometimes chasers will 'overshoot' and block their target pathing, making the chase easier than it probably should be.
Fleeing units don't suffer from this problem since they also ignore their target (and their code handles it).

This new problem introduced in this diff is heavily dependent on the exact speeds and ranges at play, and a further diff will improve the situation to acceptable levels.

Reported by: FeldFeld

Refs #5936

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

comment:9 by wraitii, 3 years ago

In 24800:

UnitMotion - Additional chasing fixes

  • Because units slow down when turning, and JPS paths often begin with a J-shape, chasers can fail to catch up to slower chasee, because the latter don't recompute paths as often. To fix this, ignore the first waypoint if it's close by and the next is accessible.
  • Don't interpolate the target position when interpolation isn't necessary (i.e. when not processing the MT_Update_Motion* message), as that resulted in the "follow known bad path" hack to active un-necessarily.
  • Tweak PathingUpdateNeeded, it will return true when it has no path to follow
  • Remove the direct-range consideration in the "distance uncertainty" calculation.

Refs #5936

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

comment:10 by wraitii, 3 years ago

In 24802:

[gameplay] Adjust cavalry movement speed and melee attack range.

Nerf cavalry movement speed somewhat, by reducing walk speed and their run multiplier.

Further, following rP24798, units have a chance of going through their target when chasing them. This diff adjusts melee cavalry ranges from 4 to 6 to reduce the probability of that happening. The speed reduction also helps with this.

Refs #5936

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

comment:11 by wraitii, 3 years ago

In 24803:

Fix ranged unit chasing following rP24797

D3230 / rP24797 introduced range checking at turn start, and removed a hack that made units predict the position of their target too far ahead. This worked fine when in "straight movement" mode, unfortunately I failed to recognise that ranged units would never use that mode. This meant that ranged-unit chasing was broken.

There is a straightforward fix however, since we can simply change TryGoingStraightToTarget to be used by ranged units. It fixes the issue efficiently and improves movement for ranged units in general, so it probably should have been done from the start.

Refs #5936

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

comment:12 by wraitii, 3 years ago

So this was a bad, bad bug... Ultimately, this still needs unit pushing (Phab:D1490). I think the current state is stable enough, but make sure to pay particular attention to chasing situations in the upcoming days.

In the meantime, I think Phab:rP24798 should be reverted if/once we have 200ms turns in MP. It's just safer that way.

Leaving open for the moment to remind people to check.

comment:13 by wraitii, 3 years ago

Resolution: fixed
Status: reopenedclosed

No issues reported over the WE -> looks fixed.

Note: See TracTickets for help on using tickets.