Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#3952 closed defect (fixed)

[PATCH] Allow simulation to set actor variation selection

Reported by: sanderd17 Owned by: sanderd17
Priority: Should Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: wraitii, Ben Patch:


Currently, the simulation can only choose one variation by chosing the animation. This causes problems, f.e. it's not possible to have the moving animation of the siege tower combined with the garrison flag.

So the simulation should be able to pick whatever variation it wants, without interfering with the animation selection.

Note that this would also allow other things like burning buildings when they're damaged (currently also not possible as it interferes with the garrison flag), or blood on units that are hit.

Attachments (2)

simulationVariations.diff (6.3 KB) - added by sanderd17 3 years ago.
simulationVariations.2.diff (11.5 KB) - added by sanderd17 3 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 3 years ago by sanderd17

Cc: wraitii Ben added

Changed 3 years ago by sanderd17

Attachment: simulationVariations.diff added

comment:2 Changed 3 years ago by sanderd17

The proposed patch also serializes the variations, so that the model isn't reset when reloading or rejoining a game. But I'm not entirely sure it's safe to do yet.

comment:3 Changed 3 years ago by stanislas69

#2679 is somewhat related cause visible garisonning causes that issue too.

Changed 3 years ago by sanderd17

Attachment: simulationVariations.2.diff added

comment:4 Changed 3 years ago by sanderd17

New patch which should be safer WRT serialization.

Now the variants are kept in a map, and every component can overwrite its own key, without touching the selections chosen by other components (so the garrison flag can be updated independently from the unitAI animation and from possible future damaged variants).

The map is used in Unit.cpp for optimisation (if the same key is set to the same value, the actor doesn't have to be updated). And it's also kept in VisualActor?.cpp to enable the serialization of it.

The SetUnitEntitySelection? method was only used by the waypoint rendering, and is now replaced with the newer, generic selection setting. All animation selections also store the variant name under the "animation" key now. So setting a new animation still overrides the old animation.

comment:5 Changed 3 years ago by fatherbushido

Just a game feedback. I tested the patch in games vs petra and i didn't notice anything wrong in game. We have the garrison flag combined with the siege animation tower.

comment:6 Changed 3 years ago by sanderd17

Owner: set to sanderd17
Resolution: fixed
Status: newclosed

In 18266:

Allow simulation to set the actor variant selection, and use it for the garrison flag. Fixes #3952 Refs #2679, #3983

comment:7 Changed 3 years ago by sanderd17

Keywords: review removed

comment:8 Changed 3 years ago by Itms

In 18812:

In CCmpVisualActor, m_Unit is not initialized when running without graphics, so we must check that pointer everytime. Also make one call consistent with the rest of the file.

Fixes #4238, refs #3952

Note: See TracTickets for help on using tickets.