Opened 7 years ago

Last modified 4 years ago

#4420 closed enhancement

[PATCH] UnitMotion rewrite — at Initial Version

Reported by: wraitii Owned by:
Priority: Must Have Milestone: Alpha 24
Component: Simulation Keywords: patch
Cc: Patch:

Description

UnitMotion has always been quite annoying to change, and full of a variety of complicated bugs. Its ties with unitAI are also quite annoying. I have rewritten it.

"Big" changes: -Dumped the m_State/m_PathState variables, and generally streamlined the unitMotion logic, implemented an easier way to wait some turns when paths fail and react accordingly (should reduce units getting stuck and the number of potential bugs in general). -Let UnitMotion handle the move animations instead of hacking it with unitAI. This means that ultimately we could have "walk-attack", "run-gather" animations. But for now we don't really support that. -Changed speed to just walk speed, and use a ratio to change it instead of an absolute value. Ultimately, I plan te delete run speeds, but haven't gotten around to it yet.

In some finer points, I dump the "longPath"/"shortPath" split to just be a simple "Path", so that if we remove the short pathfinder someday that will be easier, and it just makes the whole thing nicer.

I also have a test map, available on my github branches: -Working branch: https://github.com/wraitii/0ad/tree/UnitMotionRewrite -"Cleaned up" branch: https://github.com/wraitii/0ad/tree/UMRewrite_Clean

Cleaned up branch might be slightly easier to review. Attached unified diff (sans map) below.

Change History (1)

by wraitii, 7 years ago

Attachment: unitMotionRewrite.patch added

Basic version - working but needs refinements.

Note: See TracTickets for help on using tickets.