Page MenuHomeWildfire Games

Fix UnitMotion calculation of time left to avoid units going ever so slightly too fast.
ClosedPublic

Authored by wraitii on May 1 2019, 12:03 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22249: Fix UnitMotion calculation of time left to avoid units going back and forth…
Summary

As reported by @wowgetoffyourcellphone on the forums: units sometimes go ever so slightly too fast over an individual turn, making them quickly alternate between walking and running animation to disastrous effect.

The attached replay show this behaviour for blue cav at 3:15-30.

The source of this issue is that unitMotion is too optimistic about how much it can travel sometimes. This appears to be because the timeLeft computation rounds incorrectly. Changing the division arithmetic fixes it (though admittedly this is a tad slower).

Test Plan

Review the math change / suggest better.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
temp
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 7359
Build 11985: Vulcan BuildJenkins
Build 11984: arc lint + arc unit

Event Timeline

wraitii created this revision.May 1 2019, 12:03 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/1315/display/redirect

Imarok added a subscriber: Imarok.May 1 2019, 2:52 PM

No idea, but does it make sense to test against that behaviour?

gameboy added a subscriber: gameboy.May 1 2019, 2:53 PM

Can this patch be officially released?

Imarok added inline comments.May 1 2019, 2:56 PM
source/simulation2/components/CCmpUnitMotion.cpp
912

Why not reuse maxdist?

Can't be easily tested as it's the middle part of a big function in UnitMotion I think.

source/simulation2/components/CCmpUnitMotion.cpp
912

Didn't notice we did that calculation already.

Stan added a subscriber: Stan.May 1 2019, 4:33 PM

Good this way it won't be any slower :)

wraitii updated this revision to Diff 7904.May 4 2019, 4:54 PM

Optimised.

Vulcan added a comment.May 4 2019, 5:28 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/1324/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.May 4 2019, 5:53 PM
This revision was automatically updated to reflect the committed changes.

I'm not sure, but I don't think this was fixed. Units still randomly enter run mode even after the autobuild.