#3286 closed enhancement (fixed)
[PATCH] File inclusion in actor files
Reported by: | sanderd17 | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 21 |
Component: | Core engine | Keywords: | patch |
Cc: | Patch: |
Description
With the capture stuff, there's a lot of discussion about what animation should be used. And I don't really want to set an animation for 300-ish units, only to have to change it again a week later. There's currently no inheritance or file inclusion to make this easier in any way.
That's why I propose variant inclusion. Variants are the building blocks of the actors. An actor is formed by picking a variant from every group (either randomly or by name), and adding those variants together to form a variation. Every task for a unit is a variant with its own animations and props. And for many tasks, these definitions are rather equal (f.e. cutting a tree has the same animation for about every unit, with the same props).
So the separate variant file could contain the animations and the props, like
<variant name="attack_capture"> <animations> <animation event="0.4" file="infantry/sword/attack/isw_s_def_01.psa" name="attack_capture" speed="100"/> <animation event="0.4" file="infantry/sword/attack/isw_s_def_06.psa" name="attack_capture" speed="100"/> <animation event="0.2" file="infantry/sword/attack/isw_s_em_04.psa" name="attack_capture" speed="100"/> </animations> <props> <prop actor="props/units/weapons/gladus.xml" attachpoint="r_hand"/> </props> </variant>
While the actor only has the reference to that file
<variant file="units/variants/biped_attack_sword.xml"/>
For common animations, but where the prop depends on the unit (f.e. a more fancy sword for higher-ranked units), the general variant and a specification can be mixed:
<variant file="units/variants/biped_attack_sword.xml"> <props> <prop actor="props/units/weapons/gladus.xml" attachpoint="r_hand"/> </props> </variant>
In attachment, there's a patch that implements this. The actor editor isn't changed so far (I don't know if it needs changes), and the XML grammar should be changed for sure.
Attachments (3)
Change History (17)
by , 9 years ago
Attachment: | easy_switch_animations.diff added |
---|
comment:1 by , 9 years ago
follow-up: 3 comment:2 by , 9 years ago
comment:3 by , 9 years ago
Replying to sanderd17: Is not better to use switch in ObjectBase.cpp:149?
by , 9 years ago
Attachment: | easy_switch_animations.2.diff added |
---|
comment:4 by , 9 years ago
New file that also supports the Actor editor to a certain degree. The variant files are taken out of the actor directory (as they didn't follow the same schema).
A schema is also added for the variants (both the rnc and rng are hand-written (or hand-copied) though, it seemed to be easier than finding a working conversion tool).
comment:5 by , 9 years ago
Replying to sanderd17:
With the capture stuff, there's a lot of discussion about what animation should be used. And I don't really want to set an animation for 300-ish units, only to have to change it again a week later. There's currently no inheritance or file inclusion to make this easier in any way.
You could copy existing animations and give them a name that likely won't change. I'm afraid all this proposal will do is make the actor format harder to understand and deal with.
comment:6 by , 9 years ago
And the prop files too? And not everything I'd defined in the animation files, like currently, there's a random selection between 3 animations with a certain distribution for capturing. It's possible this is brought to 1 animation, or more than 3. Our we might want to change the speed. Same for props, we might want to have it in the left hand instead of the right hand suddenly.
comment:7 by , 9 years ago
Milestone: | Backlog → Alpha 20 |
---|
comment:8 by , 8 years ago
Milestone: | Alpha 20 → Alpha 21 |
---|
comment:9 by , 8 years ago
In this patch you make some changes to some actors, and it looks like the changes are really few compared to all the new code: is it just a subset of the "300-ish units" you talk about in the ticket description, or is the patch just a convenience for hypothetical bigger changes?
comment:10 by , 8 years ago
The patch only includes actor changes for the basic citizen soldiers of the Athenian civ. That were the only units I gave initial animations.
So if this patch gets approved, all other units (at least those similar enough to use the same animation), could use that single xml line. If the patch (or at least the idea around it) doesn't get approved, then all units would need the extra xml you see these Athenian soldiers have already.
Of course, it's useful for other animations too, but I don't think it's a good idea to update them all immediately (as its an awful lot of work). But it's useful to have the code for when we want new units, or replace animations.
by , 8 years ago
Attachment: | easy_switch_animations.3.diff added |
---|
comment:12 by , 8 years ago
I tested the patch but i didn't look at the code. It works nice. I tried adding <variant file="biped/attack_capture.xml"/> to other infantry unit and it works as expected.
comment:13 by , 8 years ago
Keywords: | review removed |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:14 by , 8 years ago
Yaaaaay, I was also getting mad when I added/changed animations for all infantry units in my mod. This is what I have been dreaming about :)
Might wanna look at http://trac.wildfiregames.com/ticket/2324