Animation control

User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Animation control

Post by b_o »

I think all of the unit animations in all of the Stratagus games are too fast. I want to slow down the speed that frames change to other frames. I don't want to change the speed of the movement, I only want to change the appearance of the animation. Does anyone know how to do this? I imagine that these parts of the anim.LUA files need to be altered, but I'm not sure if anything else would need to be altered, and when I only change the "wait" amount, the game crashes:

Move = {"unbreakable begin", "frame 0", "move 3", "wait 1", "frame 0", "move 3", "wait 1",
"frame 5", "move 2", "wait 1", "frame 5", "move 3", "wait 1",
"frame 10", "move 2", "wait 1", "frame 10", "move 3", "wait 1",
"frame 10", "move 3", "wait 1", "frame 15", "move 2", "wait 1",
"frame 15", "move 3", "wait 1", "frame 20", "move 3", "wait 1",
"frame 20", "move 3", "wait 1", "frame 0", "move 2", "unbreakable end", "wait 1",},

Does anyone know how to accomplish this?
User avatar
cybermind
Posts: 110
Joined: Sat Dec 31, 2011 11:43 pm

Re: Animation control

Post by cybermind »

Hmm...if you will just change "wait" amount, the game should work normally. If there are any messages in stderr.txt/stdout.txt files?
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Animation control

Post by b_o »

cybermind wrote:If there are any messages in stderr.txt/stdout.txt files?
I'm not seeing those files anywhere. I was having issues with editing the LUA, as the folder was set to "read only". I then changed that and edited the LUA. I will try a few more things. But am I correct to think that the "wait" is what affects the speed of animation without affecting the speed of movement? and is there a formula for what the "wait" must be set to?
User avatar
cybermind
Posts: 110
Joined: Sat Dec 31, 2011 11:43 pm

Re: Animation control

Post by cybermind »

No, "wait" controls the speed of animation, and if there are big values in "wait", unit will slow down. Let me reveal you one of the secrets of Stratagus - the sum of "move" commands in Move animation block should be EXACTLY 32 - the tile size in Stratagus. Otherwise unit will go into infinite move loop.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Animation control

Post by b_o »

That's what I thought. The problem was that I needed to re-install wargus to a folder other than the program files folder. It's working. now I need to find the appropriate wait times. thanks.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Animation control

Post by b_o »

Hmm.. by changing only the "wait" it does slow the animation, but it also slows the movement.

I doubled the wait times for all of the unit animations in anim.lua, but the hero's seem unaffected and move faster than the unit type which shares their animation code.
User avatar
jarod42
Posts: 101
Joined: Fri Jan 20, 2012 7:43 pm

Re: Animation control

Post by jarod42 »

few things about animation:
- Animation uses gameTime
- Animation executes each part of it script until it reaches wait.
- Some sections are marked unbreakable, that means that if unit has a new animation to display, it should wait for a 'breakable wait'. for example 'move animation' shouldn't break until the unit reach a new tile.
- The time to move a tile is the sum of the "wait" (and the sum of the move should be the size of a tile, so 32 in wargus).

You may 'split' some "move 4", "wait 4"
by replacing by:
"move 1", "wait 1", "move 1", "wait 1", "move 1", "wait 1", "move 1", "wait 1"
with is equivalent in 'normal speed' (see PS about magic).
(and adding different "frame X")

PS:
Spell may modify wait time (slow, fast). As I remember, fast divide wait time by 2 (with a minimum of 1, and a round for odd number)
so "wait 1", "wait 1" and "wait 2" behave differently when magic is used.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Animation control

Post by b_o »

thanks jarod, that helps.

But where can you alter the animation code for the hero's?
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Animation control

Post by Andrettin »

b_o wrote:thanks jarod, that helps.

But where can you alter the animation code for the hero's?
They are in the same file as normal units. For instance, the Zul'jin animation is under "animations-sharp-axe", in the orc animations file.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Animation control

Post by b_o »

That's what I thought, but....
When I edit the wait's here:

Code: Select all

local AxeThrowerMove = {"unbreakable begin","frame 0", "move 3", "wait 2", "frame 5", "move 3", "wait 1",
    "frame 5", "move 3", "wait 2", "frame 10", "move 2", "wait 1",
    "frame 10", "move 3", "wait 1", "frame 0", "move 2", "wait 1",
    "frame 0", "move 3", "wait 2", "frame 15", "move 3", "wait 1",
    "frame 15", "move 3", "wait 2", "frame 20", "move 2", "wait 1",
    "frame 20", "move 3", "wait 1", "frame 0", "move 2", "unbreakable end", "wait 1",}
The unit speed is affected here:

Code: Select all

DefineAnimations("animations-berserker", {
  Still = AxeThrowerStill,
  Move = AxeThrowerMove,
but not here:

Code: Select all

DefineAnimations("animations-sharp-axe", {
  Still = AxeThrowerStill,
  Move = AxeThrowerMove,
Though I've only really tested this with ogres/ogre hero's and grunts/grunt heros, those use similar code, where the hero's Move= points to the same code as the non-hero. In theory the movement/animation behavior should be the same for hero's and non-hero's, but it's not.
Post Reply