Opened 3 years ago

Last modified 10 days ago

#4420 new enhancement

[PATCH] UnitMotion rewrite

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

Description (last modified by wraitii)

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: -"Cleaned up" branch: Cleaned up branch might be slightly easier to review. Attached unified diff (sans map) below.

Attachments (1)

unitMotionRewrite.patch (89.3 KB) - added by wraitii 3 years ago.
Basic version - working but needs refinements.

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by wraitii

Attachment: unitMotionRewrite.patch added

Basic version - working but needs refinements.

comment:1 Changed 3 years ago by wraitii

Note that this isn't a complete rewrite, but PathResult? and Move have been mostly rewritten.

TODOs: -Make unitmotionFlying work again (forgot we use that for birds). -make serialization work again -Change unitAI IsIdle? maybe to call IsTryingToMove?? -Give the AI scripts information maybe? -Update templates for my running changes -Probably scrap the whole fleeing logic, it's stupid -Make visual actor nicer, handle "stops" mid-animations -Do some of the TODOs in the files. -Improve test map.

Edit: oh yeah and formation stuff. Completely broken now.

edit2: also to clarify what I want: the above patch should work as long as you don't use formations, so I'm looking for a review and some testing if possible, obviously not about the TODOs above though. I will post a separate patch to go on top of this one with those TODOs, to make reviewing possibly slightly easier.

edit3: oh yeah also I have a weird bug where attack animations seem to go super slowly for some reason. Not sure sure it's cause by these changes though.

Last edited 3 years ago by wraitii (previous) (diff)

comment:2 Changed 3 years ago by wraitii

Keywords: review added; rfc removed

Ready for review on phabricator.

comment:3 Changed 3 years ago by fatherbushido

It's a big work. I will try to (understand the part I didn't know), review and test. But my sole input will not be sufficient. It would be nice if we put energy on that now, then we will have the whole release process to investigate unexpected bugs.

comment:4 Changed 2 years ago by Imarok

Description: modified (diff)
Keywords: review removed

review is taking place on Phabricator:

comment:5 Changed 2 years ago by elexis

Milestone: Alpha 22Work In Progress

Moving to the Work In Progress milestone, since there is a patch asking for feedback, but since it is not strictly bound to a specific release.

comment:6 Changed 5 months ago by Imarok

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:7 Changed 6 weeks ago by wraitii

Description: modified (diff)
Owner: set to wraitii

Re-assigning as I'm currently committing the v2 of this rewrite. Here's a list of reported issues, along with status:

  • Angen reports that fleeing units don't get chased efficiently.fixed, fleeing itself needs fixing.
  • There was a report of an issue with attacking units but I haven't been able to understand what exactly. probably fixed by rP22313 followups.

- gameboy reports that armies can't reach his warships. As that sounds more game-breaking, I'll look into it right away. ( edit:

Self noted:

Last edited 5 weeks ago by wraitii (previous) (diff)

comment:8 Changed 10 days ago by wraitii

Milestone: Work In ProgressAlpha 24
Note: See TracTickets for help on using tickets.