Scaling the speed of animations

Discussions about modding, questions, mod requests or just show off what you're working on.
Post Reply
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Scaling the speed of animations

Post by Boothand »

Does anyone know how, if possible, to scale the speed of animations in the gamecode? I'm interested in scaling the speed of saber swings.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Is possible. But im at the beach tight now :lol: i scaled the blue swing in bg_animate when 1.02 mode is active and reverted back the speed when 1.04 mode is active (with a cvar). But i think u need clientside to get rid of the little lag when animate ... Or play with pmove_fixed in a way to get work properly.
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

I'm already compiling the clientside for a lot of the things I've changed, so that won't be a problem. Have fiddled around in bg_panimate.c, but have only found ways to mess up animations rather than slow them down so far.
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

OK!!!!!! I think I've got it. The only way (or the way), seems to be to change animation.cfg in models/players/_humanoid :D :mrgreen:

Still untested on connecting players.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Boothand wrote:OK!!!!!! I think I've got it. The only way (or the way), seems to be to change animation.cfg in models/players/_humanoid :D :mrgreen:

Still untested on connecting players.
Yes that is another way. But not the only... The cfg is only a bunch of "instructions" sent to the client and the client code "translate" these info.

I still preffer to do that via server code, because u can have a total control over that. I will back sunday to my home, i can show u how i manage the animation speed on my gameplay changer.
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: Scaling the speed of animations

Post by Daggolin »

Why does your gameplay changer even change animation speed? o.O
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Daggolin wrote:Why does your gameplay changer even change animation speed? o.O
Blue stance spinning attack (left or right) is slower on 1.02 instead 1.03 & 1.04, i know is not the proper way to do, but i did the change of the animation speed before ravensoft release... So it works fine
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

Still interested to know where you do it in the code :D
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Boothand wrote:Still interested to know where you do it in the code :D
Im returning to my home right now :D i was on the beach, is summer here :lol:
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: Scaling the speed of animations

Post by Daggolin »

Tr!Force wrote:
Daggolin wrote:Why does your gameplay changer even change animation speed? o.O
Blue stance spinning attack (left or right) is slower on 1.02 instead 1.03 & 1.04, i know is not the proper way to do, but i did the change of the animation speed before ravensoft release... So it works fine
I don't remember any changes regarding animation-speed in the jk2 code. :/
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Daggolin wrote:
Tr!Force wrote:
Daggolin wrote:Why does your gameplay changer even change animation speed? o.O
Blue stance spinning attack (left or right) is slower on 1.02 instead 1.03 & 1.04, i know is not the proper way to do, but i did the change of the animation speed before ravensoft release... So it works fine
I don't remember any changes regarding animation-speed in the jk2 code. :/
i did via code because in those days i did not have the code, u just found a way to do that. i dont know how works now (in the real source code), but that animation is slower on 1.02, just try :)
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

i just back, i used BG_SaberStartTransAnim function to manage the speed of animations :D
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

Isn't that only the speed between chain animations? I was able to change that, but not the fps of each individual animation. Doing it via animation.cfg is great though. No recompile needed etc.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Boothand wrote:Isn't that only the speed between chain animations? I was able to change that, but not the fps of each individual animation. Doing it via animation.cfg is great though. No recompile needed etc.
Ya i know, is just a way to do, i have my own animation.cfg too :p but in my case i was used with a cvar to change the speed everytime i want, the code one works over the current speed, so u cam increase or decrease
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

But not the fps of an animation, right? I don't think there's anything in the code that lets an actual animation go slower, let alone a specific one?
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Boothand wrote:But not the fps of an animation, right? I don't think there's anything in the code that lets an actual animation go slower, let alone a specific one?
is not fps management, with that function the animation goes slower. for example i did this:

Code: Select all

#ifdef CLIENTCOMPILE
	g_gameplay.integer=cgs.g_gameplay;
#endif
    
if ( ( (anim&~ANIM_TOGGLEBIT) >= BOTH_T1_BR__R &&
	(anim&~ANIM_TOGGLEBIT) <= BOTH_T1_BL_TL ) ||
	( (anim&~ANIM_TOGGLEBIT) >= BOTH_T2_BR__R &&
	(anim&~ANIM_TOGGLEBIT) <= BOTH_T2_BL_TL ) ||
	( (anim&~ANIM_TOGGLEBIT) >= BOTH_T3_BR__R &&
	(anim&~ANIM_TOGGLEBIT) <= BOTH_T3_BL_TL ) )
	{
    
 	if ( saberAnimLevel == FORCE_LEVEL_1 )
	{
        	if (g_gameplay.integer == 0)
        	{
           		*animSpeed *= 1.0; //1.0 = v1.02
        	}
		else
		{
			*animSpeed *= 1.5; //1.5 = v1.03 and v1.04
		}
 	} 
	
	[...]
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

Hmm, was sure I had tried to change that variable, in lots of places. I'll check it out later.
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

Making those numbers low only makes the animations stop and wait before going on. In any case, I use animation.cfg for the actual speeds, so won't be an issue.
Also, I just noticed by the way in my jk2mp sourcecode, that 1.5 is 1.02's default, regarding the above example.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

Boothand wrote:Making those numbers low only makes the animations stop and wait before going on. In any case, I use animation.cfg for the actual speeds, so won't be an issue.
Also, I just noticed by the way in my jk2mp sourcecode, that 1.5 is 1.02's default, regarding the above example.
Yes, is 1.5 in every version, but that 1.5 is applied to the base speed in animation.cfg, so, 1.5 applied into 1.02 is ok, 1.5 applied into 1.03 or 1.04 is different, is why i reduced only to 1.0, because i used the 1.04 source code in these days... animSpeed value is not a definition of the speed, is just how much i want increase or decrease the actual speed of an animation.

about the stop & wait problem, that is because u need send that info from the server to the client, u need a conection (if u want to get it customizable by a cvar), is why i used:

Code: Select all

#ifdef CLIENTCOMPILE
   g_gameplay.integer=cgs.g_gameplay;
#endif
is how i get everything about movements recognized by the clientside. (and to get rid the "stop & wait" problem)

look this example, i did it only via code (the code i posted above):



anyways, if u dont want to change it everytime, just use animation.cfg :D
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Scaling the speed of animations

Post by Boothand »

As I mentioned earlier though (and as your video demonstrates), it only changes the speed of the transition animations, not the swings themselves, so I don't see an alternative to using animation.cfg.

As for the client knowing what's going on when it stops and waits, this is a BG function, and compiled into the cgame (which I'm using) as well, so I don't think it's that. Probably more to do with the math going on outside when animSpeedScale returns from the TransAnim function.

Code: Select all

BG_SaberStartTransAnim(self->client->ps.fd.saberAnimLevel, f, &animSpeedScale);

		animSpeed = 50.0f / bgGlobalAnimations[f].frameLerp;
		animSpeedScale = (animSpeed *= animSpeedScale);
Anyway, not important unless people google this :D


However, if you can think of a way to change the blend time or speed between certain animations (specific animations), then that would still be interesting. I have buttons for triggering block animations, but they are only a keyframe that it blends to over time, so it can't be solved by changing animation speed in animation.cfg - but what sets the time they use to get in position? If anyone has a clue, do tell. The animation tables have a blendTime associated but changing them doesn't have an effect there, so I assume it gets overridden somehow. Somewhere. Somewhere obscure.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Scaling the speed of animations

Post by Tr!Force »

nice, i thought it worked differently, i did these work a long time ago, so did not remember how it worked :lol: thanks for the clarification
Boothand wrote:I have buttons for triggering block animations, but they are only a keyframe that it blends to over time - but what time is that? If anyone has a clue, do tell. The animation tables have a blendTime associated but changing them don't have an effect there, so I assume it gets overridden somehow. Somewhere. Somewhere obscure.
i have the same question, ive played a little with ModView to look for a clue to search it in somewhere in the code but i didnt find anything...

maybe is in some obscure place. :|
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
Post Reply
Created by Matti from StylesFactory.pl and Warlords of Draenor (modified by jk2.info)
Powered by phpBB® Forum Software © phpBB Limited