Search
Username:
Password:

Register or Reset Password

SUBMISSIONS
Counter Strike
   New Maps
   New Tutorials
   New Skins
   New GUI's
   New Sounds
   New Threads
Other
   Media
   Gamers
   Clans
   Studios
Calculating Animation FPS
Difficulty: Beginner
Category: CS:S > AnimatingAuthor(s): CapnJack

So we've all seen great releases with the most awesome looking model/skin ever right? Well here's the thing that really ruins a nice replacement for me - improperly timed animations! Improperly timed animations result in an animation not being played all the way through or ending too quickly thus leaving time at the end of a sequence where the gun does not move. This problem is really annoying throwing off the player's reload timing and looks weird because your replacement gun just sits there doing nothing for a time which defeats the purpose of animating it. So here's how you fix this problem:

First off decompile Valve's model for whatever gun you are going to replace. This is always a good idea when you are replacing any skin as it is a great reference to start from. If you are replacing animations for the USP, decompile Valve's USP and then open up the SMD for the animation you want to replace in MS3D or 3DS and view the framecount in there. The default FPS for Valve's animation will be in the mdldecompiler.qc file next to the corresponding sequences.

For those of you who do not wish to read about the math involved skip to the bold yellow text below, this is the formula you will need to calculate your target FPS in a simplified version.

As an example I'm going to replace the USP silencer detach animation. The number of frames in my animation I have made is 86. The number of frames in Valve's default silencer detach animation is 116. The default framerate for Valve's animation is 37. So now we need to find out how fast we need to play our animation to match the amount of time it takes to remove the silencer in Valve's animation. To do this we use simple proportions (see picture).

  1. Write your animation's framecount (86) over x which will be your target framerate.

  2. Write the fraction from step 1 equal to Valve's framecount (116) over Valve's framerate (37).

  3. Cross multiply.

  4. Divide to get x by itself so in this case we will divide both sides by 116. 116x will cancel out to just x as a result.

  5. Multiply/divide out the remaining numbers to get your target framerate which is approximately 27.43 in this case.


If the math bothers you then use this easy formula:
Target Framerate = (Your Framecount x Valve's Framerate) / Valve's Framecount

Sorry for the math lesson ;).

Now apply this knowledge to the qc file the text in red is the command you should have changed:

$sequence detach_silencer "detach_silencer" ACT_VM_DETACH_SILENCER 1 fps 27.43 {
{ event 5004 29 "Weapon_USP.DetachSilencer" }
}


Please note there is only a certain level to which you can apply this. Obviously you can't stretch something like a 5 frame animation across a time of about 10 seconds otherwise it would look like it was in slow motion.
Added: 1 year agoTags: math, calculation, compiling, animation, drugs, boring
Feedback (16)
Page of 2   1 2 Next Page
Dave-Life .
BananiteY2M
Posted 3 months ago
How do you decompile models?
- Bananite
.
work > playY2M
Posted 3 months ago
One of the most useful and handy tutorials I have ever found here. I use this quite frequently when compiling and animating.

Thanks a lot!!
sick420 .
vista suxY2M
Posted 5 months ago
Thank you^^
.
LOAD "*",8,1Y2M
Posted 5 months ago
Posted by sick420

Could you explain how the "reverse" this tut?

i want my sequence to play on 30 fps.

as an example=

valves stuff: "20" frames "40" fps

my stuff: "?" frames "30" fps

i think i have to reverse this math stuff, but i dont know how :(

Well if you use the formula you can use algebra to solve for any unknown value assuming you know all the other values. So for example if you wanted to find a frame count at a given frame rate you would instead solve for "Your Framecount".

The simplified/reversed formula for this would be:
YourFrames = YourFPS x ValveFrames / ValveFPS

If you look at the proportion in the first picture instead of starting with 86 (Your Frame count) over x (target fps) you would start with (in your example's case) x over 30 since you already know your FPS.
sick420 .
vista suxY2M
Posted 5 months ago
Could you explain how the "reverse" this tut?

i want my sequence to play on 30 fps.

as an example=

valves stuff: "20" frames "40" fps

my stuff: "?" frames "30" fps

i think i have to reverse this math stuff, but i dont know how :(
.
LOAD "*",8,1Y2M
Posted 6 months ago
Posted by sick420

Pros: very helpfull tut :D will become handy i think
Cons: none
Improvements: none
Notes: how do i calculate animation frames? i mean:

Default= 20 frames, 40 fps
new= ? frames, 30 fps

would appreciate that

Your new animation length is either the length of the already existing animations you are replacing it with or the length you chose for your custom animations to be. So if I make a reload and decide I want to do my reload in 100 frames then that is your new animation's frame count and you just apply that to the formula. Thanks for the assessment and comments by the way, much appreciated. :)
sick420 .
vista suxY2M
Posted 6 months ago
Pros: very helpfull tut :D will become handy i think
Cons: none
Improvements: none
Notes: how do i calculate animation frames? i mean:

Default= 20 frames, 40 fps
new= ? frames, 30 fps

would appreciate that
Tr33t .
~Blargnuggets~Y2M
Posted 7 months ago
Posted by CapnJack

Posted by Tr33t

LAWL, yea it's simple math... *Rolls eyes*

It is if you can divide and multiply. Or if you have a calculator and can press buttons. :P ;)


; ) Thing is, I can't do simple math, but I can do algebra, calculus, and geometry. xD
- ~Blargnuggets~
.
LOAD "*",8,1Y2M
Posted 7 months ago
Posted by Tr33t

LAWL, yea it's simple math... *Rolls eyes*

It is if you can divide and multiply. Or if you have a calculator and can press buttons. :P ;)
Tr33t .
~Blargnuggets~Y2M
Posted 7 months ago
LAWL, yea it's simple math... *Rolls eyes*
- ~Blargnuggets~
Page of 2   1 2 Next Page
Add Feedback
Provide constructive feedback. What is "constructive"?
You cannot post yet!
Get involved on FPSB by posting your thoughts. Give authors your feedback to help them develop.

To post in this submission register or login.
Assessment
The community's verdict.
User Rating [+]
9.6/10
bScore
9.6/10
You cannot assess yet!
Moderating FPSB is in your hands - when you assess a submission your vote determines its success or failure.

To vote on this submission register or login.
Stamps
This Tutorial in a nutshell...
Useful & Detailed
You cannot stamp yet!
Stamps let you apply characteristics to submissions to help others understand them.

To stamp this submission register or login.


Added by...
.
LOAD "*",8,1
Ripe Member and CSSRPG Supervisor
Ranked 102nd with 20,498 points. 494 points behind jhobbs .

[+] Donate
Related Tutorials