animated buildings

cool3a2

Deity
Joined
Mar 30, 2007
Messages
2,177
I'm about adding a building that should be animated if possible. Actually, I already added a ton of buildings, yet none with animation. The building in question should replace the aqueducts art. Actually, we are talking about art only, this is not meant to be a unique building. Normally, this would require us to mess with CityLSystem.xml, but I'm using my Paprika modcomp for this exercise, where you'd add the building via artdef. That modcomp worked for all other buildings (that didn't use animations though), so let us consider it works and let's think about the problem like if we would add a unique building. Now there is a kfm file for the animation as well as kfs (as the building is based on an improvement) and there is a kfm line in the artdef. Yet it seems no default building makes use of that line. My code is as follows:
<BuildingArtInfo>
<Type>ART_DEF_BUILDING_MAGYAR_AQUEDUCT_INDUSTRIAL</Type>
<LSystem>LSYSTEM_2x2</LSystem>
<bAnimated>1</bAnimated>
<fScale>0.8</fScale>
<fInterfaceScale>1.0</fInterfaceScale>
<NIF>Modules/Custom Civilizations/Hungary/Buildings/Magyar_aqueduct/gemeskut.nif</NIF>
<!--<KFM>Modules/Custom Civilizations/Hungary/Buildings/Magyar_aqueduct/waterWell.kfm</KFM> -->
<KFM/>
<Button>,Art/Interface/Buttons/Buildings/Aqueduct.dds,Art/Interface/Buttons/Buildings_Atlas.dds,4,1</Button>
</BuildingArtInfo>
The kfm line is currently commented because if a city currently builds the building and you try to zoom in, there are some troubles (the camera somes, but the interface for the city is completely missing). The kfm didn't seem to affect the building once it is built anyways. So what am I doing wrong?
 
Okay, how can this be done? Simply open the nif in nifskope, then import the animation and save the nif? Also, what is the kfm lin in the xml file then good for?
 
Okay, how can this be done? Simply open the nif in nifskope, then import the animation and save the nif?

I don't know if that is possible.

But it's possible with Blender. You can set the options so, that you are able to import a .nif with a .kfm together, and then with the export you can merge the anims into the .nif (that's just a button or checkbox for the export options).

Also, what is the kfm lin in the xml file then good for?

Probably a development leftover :dunno:.
 
I don't know if that is possible.

But it's possible with Blender. You can set the options so, that you are able to import a .nif with a .kfm together, and then with the export you can merge the anims into the .nif (that's just a button or checkbox for the export options).
What you said, is basically correct. The building is animated if I import it to blender together with the kf and then reexport it as a whole. Yet the result is buggy. I'll describe my building a little in order you understand the problem. The building in question is some kind of well:


I just have a rope on one side that holds a bucket. The animation is simple: the bucket is meant to be lifted and lowered. Yet the robe should 'hang around' to follow the gravitation. This works properly if I open the nif in nifskope and add the kf. If I do what you said via Blender, the rope is firm and diagonal (so not 'hanging' following the gravity) and the bucket is moved. Seems like animation and model are imported properly as the exported result looks different from what I imported to Blender, while the latter reflects what I get if I add the kf to the nif via nifskope. Not sure what's the problem here.

If I try to add the kf via nifskope, the result is not animated in the game...
 
Uh...i guess this needs an artist, i can't say anything further, no experience :/.


In case this is a custom model from yourself: hrochland made an animated well, maybe you have better luck with that one.
In case this one is the mentioned well...then please forget this sentence :D.
 
If I try to add the kf via nifskope, the result is not animated in the game...

While you can add a kf via nifskope (which doesn´t lead to "really" workable nifs in game) it could be better in this case if you would add the animation information for the nodes via nifskope. Look for example at the space elevator:

The animated node is #3 (SpaceElevator) - as controller a NiTransformController is added to this node. The Information for the NiTransformInterpolator and the NiTransformData can be copied from the kf. Also check the flags of the animated nodes - final nodes in the tree have 22, nodes in the tree have 6 (means nodes which have an animated node as child). In case of the space elevator #3 is the final node in the tree and has flags 22.

Unfortunally i have no idea if you can have rigged buildings - can be or not. (but looking at the public transportation nif i would now say it´s possible to have rigged buildings)

If you want an example for a building with seperate nif and kfs, the wall street files follow this princip. But considering the not working animation in game (which is also not linked in the xml) i would guess this method is not working for buildings
 
In case this is a custom model from yourself: hrochland made an animated well, maybe you have better luck with that one.
In case this one is the mentioned well...then please forget this sentence .
I know of only one well from hroch and accidently mine is based on his. I simplified its shape so that it resamples that of a Gémeskút and I altered the animation so that it doesn't rotates anymore but moves the bucket up and down only.

I will take a look at the wall street stuff as well as trying to get the animation done the way you described it. As the animation and the building are both simple. I'm optimistic your method will work.
 
Alright, I have good news. I have done it the manual way, just like you described it. The building works animated now and the rope is working properly, too. Tested it in-game and it is fine, even in the city screen it is animated. Had some difficulties at first as the animation was incomplete (around 13 seconds instead of 25). That was caused by the TransformControler nodes I copied from the spaceelevator (couldn't find a way to add this sort of node through the context menu as there were no ControlerNodes suggested) - just had to edit the stop time for each TransformControler.

BTW: I recognized that for one bone there are two interpolators in the kf. One is a TransformInterpolator, while the other is a BoolInterpolator. I didn't know how to add both interpolators at once, but tested both separately - no difference though. Maybe those Interpolators do not have (major) influence on the animation in this case. Still, how would I have to add both interpolators if necessary?
 
BTW: I recognized that for one bone there are two interpolators in the kf. One is a TransformInterpolator, while the other is a BoolInterpolator. I didn't know how to add both interpolators at once, but tested both separately - no difference though. Maybe those Interpolators do not have (major) influence on the animation in this case. Still, how would I have to add both interpolators if necessary?

A BoolInterpolator only set a flag from true to false (or 0 to 1), in most cases i have seen them they are used to control the visibility of the node or a mesh. Could you check in the kf if only visibility is affected?

To do this: look under "Controlled Blocks" (NiControllerSequence) in the kf and look if the entry of the BoolInterpolator has a entry by Controller Type Offset. If it is a NiVisController and you didn´t saw a difference / problem, imo you can ignore the BoolInterpolator.

Of course you could also add a parent node for the node with the two controllers, make the BoolInterpolator the animation of the parent node and add the actual animation to the original (now child) node. Visibility eg affects the entire branch of the tree.
 
To do this: look under "Controlled Blocks" (NiControllerSequence) in the kf and look if the entry of the BoolInterpolator has a entry by Controller Type Offset. If it is a NiVisController and you didn´t saw a difference / problem, imo you can ignore the BoolInterpolator.
Yeah, that's the case and as I don't see any difference, just as you said, I will ignore it. Good to know what I can do if I should have a case where there are two or more interpolators for the same bone. Thanks for your help!
 
Top Bottom