Matching Vertex Animation-Help

Users who are viewing this thread

Hello everyone,

I'm new on Talewords.com, thank you for this forum which is the best for M&B and solved me several problems so far. I'm a M&B amateur player and recently began to mod it, i got a problem which is hindering my work next to very end and i dont know what to do,
i already searched everywhere, i hope someone could help.
I created from scratch in blender a particular rifle with a complex reloading animation, made the skeletal animation for reloading, and the vertex animation (rotating gears, pulleys, shafts), made together with the same amount of frames, 38. However, i can't synchronize them.
After much work, while studying the module system and the actions.txt, i realized that the weapon type over which i built my weapon, that means the crossbow, has a hard-coded phased reloading time lapse. The reloading animation must be within the first 0-100 interval, and unlike the bows, does not play continuosly throughout the whole reload animation. At last i tried to make both match at best, but i don't want to further reduce 38 frames to barely 5-6. Besides, crossbows are not bows and are the only ones to have two reloading phases.
So i ask here please, is there a way to edit the weapon flag, or better to create a new weapon type, maybe through some small hack (or WSE)?

Thanks
 
as a new modder you should start to study the modsys https://forums.taleworlds.com/index.php/topic,240255.0.html

the .txt like actions.txt is compiled code (machine code), not really meant for humans to read or work with it. The modsys is written in MBScript (Mount Blade Scripting Language) and easy to understand.

You probably should use the musket animations and flags too. Using a crossbow to represent a weapon is a ancient hack from the early days. We have guns in the game now (engine).
 
Well, machine code (i think it's hex language?) it's obviously unintelligible but in the module_animations.py (which verts to actions.txt) it becomes clearer and the flags are quite easily explained too (acf, amf, arf, etc). I do use flags and tried the musket's one but it's useless (the game doesn't have nor play the animation), the crossbow is the only choice (NW uses it too if i'm not wrong), mainly because has the useful reloading "step". Any suggestion?

Edit: No one hasn't a suggestion yet? I wouldn't waste all the work made so far. The vertex animation is hard-coded, only the engine accesses it and can't be modified, i wonder whether WSE could change it and hope to find a solution as soon as possible.

PS: Where is mtarini? I wrote him two times but he seems to have vanished months ago...
 
Item capabilities in module_items.py define which animations an item is used with. In Mount & Blade With Fire & Sword all muskets are itp_type_crossbow with the item capability itcf_shoot_musket. The firing locks of flintlocks can be animated with simple 3 frame vertex animations. WFaS adds smoke and sparks on firing at the lock and muzzzle using the scripts game_missile_launch and oim_on_musket_on_attack.
There is also an item capability itcf_reload_musket but this is only used for double barrelled weapons.
 
Hello there,
eventually someone answered. So you're saying there is no chance to get it working? Item capabilities define which type of weapon and how it shoots, animation is defined in actions.txt. I tried different combinations, but only crossbows have phased reloading.
Muskets in wfas have the three frames like all crossbows, two identical (i won't say anymore) both with their purpose, then 100 (2nd)
and 200 (3rd) intervals. Bows have one more to look smoother. Hey, are you one of the Pike&Shotte developers? Thanks for the great mod, i followed and promoted it on moddb, 'tis one of the best for WFAS! I went on servers sometimes though there was no one...
Thanks for the infos.
 
I'm not one of Dazzer's NW Pike & Shotte team. Mine's the WFaS mod.  :grin:

All Warband's vertex animations have a duplicated frame - think of it as an at rest frame. The other two frames just define the start and end points of the vertex movement over the allocated time. I doubt you can get a more complex vertex animation working on pulling a trigger, but I'm no expert. However, if you have different firing or reloading animations (i.e. human skeleton animations) you should be able to substitute those for Warband's default ones. I was happy to stick with the default ones in WFaS.
 
Haha! I've seen your name in mod discussion pages, i didnt remember well 'twas for NW, many months have passed, but i did play on it and found many interesting things. By the way, is the ONLY mod ever including pike & shot tactics for M&B (whence the name), and the priest with the english bible on the field is very peculiar. Yes Dazzerius, i gave him 9/10 if i'm not wrong. Forsooth, rest frame-back position, second reloading phase, third empty (and not only:cool:). You doubt foreboding, as i wrote beforehand i realized the two anims together, they both work ingame but could not match, because the vertex one's timing is hardcoded. Pulling a trigger is simpler, but putting a trigger in Morgh's Editor weapon slot could possibly work, by an expert coder of course.:cry:
 
Sir John Hawkwood said:
Haha! I've seen your name in mod discussion pages, i didnt remember well 'twas for NW, many months have passed, but i did play on it and found many interesting things. By the way, is the ONLY mod ever including pike & shot tactics for M&B (whence the name), and the priest with the english bible on the field is very peculiar. Yes Dazzerius, i gave him 9/10 if i'm not wrong. Forsooth, rest frame-back position, second reloading phase, third empty (and not only:cool:). You doubt foreboding, as i wrote beforehand i realized the two anims together, they both work ingame but could not match, because the vertex one's timing is hardcoded. Pulling a trigger is simpler, but putting a trigger in Morgh's Editor weapon slot could possibly work, by an expert coder of course.:cry:

With Fire & Sword is good for pikemen and musketeers. If you ever buy it, click on my signature & try a single player mod of the English Civil War.  :grin:
 
I will, i have WFAS and played it longtime. For everyone, i could need a trigger or script as well, something like dilatate/extend vertex
reload time to whole sequence. I can't wait much longer.
 
Sir John Hawkwood said:
I will, i have WFAS and played it longtime. For everyone, i could need a trigger or script as well, something like dilatate/extend vertex
reload time to whole sequence. I can't wait much longer.

I don't think that's possible as you'll see in this quote:
mtarini said:
can you explain please how to add vertex animation in proper frames of skeletal animation,

vertex animations and skeletal animations are totally unrelated things in this system.

The games uses vertex animations in a few hardwired ways only, and I don't think it will be easy, or possible at all, to convince the game to use vertex animations for any other purpose.

The list of uses of vertex animations employed by the game is:
  • for the icons of moving things on the map
  • for the quivers, showing progressively fewer arrows
  • for the body armours changing their shape according to the gender (or, more generally, the "skin") of the wearer
  • for closing/opening hands/gloves (judging by the assets: but then it seems this is not actually done; open gloves only used in inventory, closes fist is always used in all scenes)
  • for the bows being tended during the draw-arrow animation
  • for the scabbards looking empty when they are not holding their weapon

The list above might be incomplete, but unfortunately the point is that whatever you are trying to do with vertex animations, either it is something that native does already, or you probably won't be able to make your MOD do it.

In each case in the list, the animations are used in very strict way. For example, in the quiver case, the "time" of a frame of the animation actually represents the number of remaining ammo. So if your are trying to do customize something the game does, your best bet is to replicate an existing, working vertex animation from native (number of frames, time assigned to each frame).
 
Thanks, i've already read this post (it's from mtarini of course). Now that i read it again, the word 'hardwired' sounds even more severe and peremptory. So far i used some workarounds to get past game limits, i'm afraid this time i will have to adapt.
PLEASE TALEWORDS DON'T use hardcoded weapon flags and vertex animations on Bannerlord! MORE EDITABLE WEAPON FLAGS we should have total freedom of choosing and edit them! I shall wait little more then i'll close the thread.
 
Actually, I think it is possible. After all, K700 managed to create a moving flail with WSE and vertex animations. The code is OSP, see here. The discussion is also interesting, because another modder managed to do something similar without WSE. He made only the hadle of the flail an item and added the chain and star as vertex animated scene props to the handle with the operation agent_get_bone_position. This might even work better for you, because you need the vertex animation only for loading and shooting.

I hope this helps.
 
Blast, Stephen Hawking is dead folks. I'm in dole.

Anyways, i removed the post. It was a bit too enthusiastic, and too explained and specific for most of the users in this forum i think.
When i'll have the time, i'll keep experimenting trying to improve the vertex animation.
The time interval splitting is crucial. That's because, to match good enough, you need to make it fit PERFECTLY to the skeletal.
I mean variations too small to be corrected with frames, even the slightest timing shift could mismatch the animations.
Please Talewords, if you have any secret about harcoded vertex anims structure, it's time to reveal it.
I will keep you informed of any improvement, the problem is close to solution.

As for the alternative solution, this is the item's trigger:

[(ti_on_weapon_attack, 
[(store_trigger_param_1, ":attacker_agent_no"),
(try_begin),         
(multiplayer_is_server),
(get_max_players, ":num_players"),       
(try_for_range, ":current_player_no", 1, ":num_players"),             
(player_is_active, ":current_player_no"),
(multiplayer_send_int_to_player, ":current_player_no", action_react_to_flail_attack, ":attacker_agent_no"),       
(try_end),
(else_try),
(agent_get_wielded_item_slot_no, ":slot_no", ":attacker_agent_no"),
(val_add, ":slot_no", bmm_item_1),
(agent_body_meta_mesh_set_vertex_keys_time_point, ":attacker_agent_no", ":slot_no", 10),
(agent_set_slot, ":attacker_agent_no", slot_agent_flail_using, 1),
(agent_play_sound, ":attacker_agent_no", "snd_draw_flail"),
(try_end),
])]

Is it possible to edit it? I would need to make the animation play only when reloading.

edit: i forgot, what is "bmm_item_1"? It doesn't exist.
        These operations are not recognized by the MS:
       
agent_get_wielded_item_slot_no
agent_body_meta_mesh_set_vertex_keys_time_point
how should i add them?
 
Well i will keep the thread open, in case.
The animation now looks better, but it's not perfect, and i'm afraid it could be improved only with triggers.
I examined a bit further the flail OSP, and it's almost Aramaic to me. I dare say mission_templates.py is
more important since i found many more references to vertex-anims. I hoped an item trigger was enough.
I confirm it, i need my rifle to animate throughout the reload.

module_mission_templates.py triggers:
K700-flail_trigger = [
      (0, 0, 0,
      [(neg|multiplayer_is_dedicated_server),],
      [(try_for_agents, ":agent_no"),
      (agent_is_active, ":agent_no"),
      (agent_is_alive, ":agent_no"),
      (agent_slot_eq, ":agent_no", slot_agent_flail_using, 1),
      (agent_get_wielded_item, ":wielded_weapon", ":agent_no", 0),
      (try_begin),
        (eq, ":wielded_weapon", "itm_flail"),
        (agent_get_wielded_item_slot_no, ":slot_no", ":agent_no"),
        (val_add, ":slot_no", bmm_item_1),
        (agent_get_animation, ":upper_anim", ":agent_no", 1),
        (try_begin),
          (this_or_next|eq, ":upper_anim", "anim_release_slashright_onehanded"),
          (this_or_next|eq, ":upper_anim", "anim_release_slashleft_onehanded"),
          (this_or_next|eq, ":upper_anim", "anim_release_overswing_onehanded"),
          (this_or_next|eq, ":upper_anim", "anim_release_slash_horseback_right"),
          (eq, ":upper_anim", "anim_release_slash_horseback_left"),
          (agent_get_animation_progress, ":animation_progress", ":agent_no", 1),
          (store_mul, ":vertex_animation_time", 55, ":animation_progress"),
          (val_div, ":vertex_animation_time", 100),
          (val_add, ":vertex_animation_time", 10),
          (agent_body_meta_mesh_set_vertex_keys_time_point, ":agent_no", ":slot_no", ":vertex_animation_time"),
        (else_try),
          (agent_body_meta_mesh_set_vertex_keys_time_point, ":agent_no", ":slot_no", 65),
          (agent_set_slot, ":agent_no", slot_agent_flail_using, 0),
        (try_end),
        (else_try),
          (agent_set_slot, ":agent_no", slot_agent_flail_using, 0),
        (try_end),
        (try_end),])]
Thank you
 
Laddies and gentlemen (eh :eek:),
i am proud to announce you, after months of wearying work, waits and trials, the vertex animation is done, the goal is reached.
How? Because i paid for it, thanks to an expert coder. It was a drudgery, yet another huge, annoying devious hardcoded obstacle of M&B got overtaken. Two solutions came out, with and without WSE.

The first one, holding on the previous attempts, thus manually, it's much harder because you have to match perfectly both after many,
MANY slight corrections, adapting and stretching them, due to hardcoded timings.

The second one with WSE, whereas a script runs the vertex animation, it's much more simple to configure and precise, since you could overwrite anything. Both are valid, still the manual one will, regardless of how precise the scripted is, look better because of the game engine blending, which scripts cannot afford. It just looks more natural, smoother, unlike the mechanical looking scripted, so eventually i will go for the first method, at least for carriable weapons.

Now, the last problem  :lol:, passed over so far, the mesh import issues.
In fact, hitherto i tested with the weapon mesh misshapen, but now i want the model good as in editor,
so i tried every export (Wavefront.obj) combination fom Blender, but whatever you try, openBRF will always screw up your vertex animation frames, not all, just those you merge together in vertex animated mesh.

Further i tried every openBRF importing and assembling option, recalculations of normals,
tangents, redundant vertices cleaning, but the mesh frames get always messed up, save the first one.
It seems that, although each with same number of faces points etc, the addiction of vertex new frames damages them, also, the more they change from origin, the more they deform.

Please help
 
Maybe

mtarini said:
mmmm... Anyway, here's something for you to try:

(1) Change settings:
[Settings]->[On import meshes]->[do nothing]

(2) Re-import your models.
(you'll see that they have a tremendous amount of redundant vertices/pos).

(3) Merge them into an animation.

(4) Is the problem still there?
If it is gone, then, only now, do [clean redundant verts/pos] (which is what it usually does at import time) on the assembled ani.


If that changes anything, it might mean that the problem was due to a face collapsed to exactly a line
(e.g. a face connecting vertices A,B,C where A is an exact copy of B, including text coords and postions).
This might make the "clean up" go different in the two meshes, which makes /apparently/ no difference for either of them but it breaks the "sync" between the two, causing the artifact when you put them together. MAYBE.

(but, with the models you sent me, it seems to work fine with or without that workaround).

Might also be worth checking if Blender is culling back faces on export.
 
Thanks, i already tried what he said in many ways, my models don't have any collapsed face nor seeable import glitches whatsoever, either in Blender or in openBRF...only when i merge them in vertex animation, it screws all the frames up except first, the more the variation from it, the greater they distort. I may try again with old .md3 format, but it'll be unlikely.

For aught i know backface culling only affects shading.
 
Ok. I had a similar problem with animated windmills. The only way I solved it was to create two separate vertex animations. One with the moving parts only - in my case the windmills sails - and the other of all the frames of the static building. Then I combined those two vetex animated meshes.

PS - if you are experiencing the same issue, I don’t believe it has anything to do with Blender or exporting from Blender. I think its due to the way OpenBRF creates its vertex animations.
 
Yea, but the frames assembled in vertex animation will keep the same issue.
I think its due to the way OpenBRF creates its vertex animations.
Exactly.

Announcement:
I will pay whoever manages to assemble a (long) vertex animation from .obj files without errors in openBRF.
Same with whomever exports correctly a .md3 animated mesh from Blender.
I already paid for this, i'm ready to do it again.
 
Sir John Hawkwood said:
Yea, but the frames assembled in vertex animation will keep the same issue.
I think its due to the way OpenBRF creates its vertex animations.
Exactly.

Announcement:
I will pay whoever manages to assemble a (long) vertex animation from .obj files without errors in openBRF.
Same with whomever exports correctly a .md3 animated mesh from Blender.
I already paid for this, i'm ready to do it again.

Even though I doubt the Warband engine will accept a longer vertex animation, you can PM me a link to the obj files of your frames. I'll look at them for free to see if it's the problem I suspect.
 
Back
Top Bottom