View previous topic :: View next topic |
Author |
Message |
lukas2288
Joined: 14 Jun 2009 Posts: 42
|
Posted: Wed Jul 01, 2009 8:34 am Post subject: Weapons Frames |
|
|
I have made 24 frame weapon animation.In game is to slow when the animation play.So i want to ask if there is some way to speed up the animation(without deleting frames)? |
|
Back to top |
|
 |
MauveBib

Joined: 04 Nov 2004 Posts: 602
|
Posted: Wed Jul 01, 2009 3:11 pm Post subject: |
|
|
self.nextthink = time + 0.05;
Add that to every animation function to double the frame rate, in theory anyway. _________________ Apathy Now! |
|
Back to top |
|
 |
Urre

Joined: 05 Nov 2004 Posts: 1073 Location: Sweden
|
Posted: Wed Jul 01, 2009 4:55 pm Post subject: |
|
|
I think he's talking about a .weaponframe weapon, no? Also, the .nextthink trick behaves better if you use a new field in which you store time upon creating the entity, and increasing that by 0.05 every animation frame, and just setting .nextthink to that.
self.animtime = self.animtime + 0.05;
self.nextthink = self.animtime;
Resetting animation timings to world time will throw it off a tiny bit all the time, eventually resulting in minor twitches or slower/faster animation than expected. In general, this applies to pretty much all timing-related issues which are done frequently, such as movement, AI thinking, rapid fire weapons, animation... One off timers such as a flag capture timer or a trigger of some sort does fine with basing on time. In some cases it's even necessary, can't think of a good example for this, but if things in the world are meant to sync somehow, I can imagine this being a good case. _________________ Look out for Twigboy |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Wed Jul 01, 2009 6:41 pm Post subject: |
|
|
Urre wrote: | Resetting animation timings to world time will throw it off a tiny bit all the time |
Actually it doesn't (evidence in SV_RunThink). The time global is set to the entity's prior nextthink value before your think function happens.
So your code does nothing that wasn't already done. :P
The only reliable way to get the actual current time is via the StartFrame event. But that's offtopic.
The viewmodel weapons are animated at the same framerate that the player model is animated at.
You have three options.
1: Change the player model animation speeds and the weapon animation speeds at the same time by adding that self.nextthink=time+0.05; line in your player.qc file.
2: As 1, but insert extra player frames which are duplicates of the original ones, changing the viewmodel frame in each one, but the player model every other function in the sequence.
3: Take the viewmodel animation code out of there entirely, and animate it yourself in PlayerPostThink, using a separate timer.
Option 1 is broken, unless you're replacing player animations too. Option 2 works fine. Option 3 is more extensible (attack speed modifiers etc are that much easier). _________________ What's a signature? |
|
Back to top |
|
 |
lukas2288
Joined: 14 Jun 2009 Posts: 42
|
Posted: Wed Jul 01, 2009 7:05 pm Post subject: |
|
|
Thanky guys i will try it tomorrow. |
|
Back to top |
|
 |
Urre

Joined: 05 Nov 2004 Posts: 1073 Location: Sweden
|
Posted: Thu Jul 02, 2009 11:41 am Post subject: |
|
|
One learns new things every day. In that case I've completely forgotten where my code applies, I know it does someplace, since it made quite the difference for me. _________________ Look out for Twigboy |
|
Back to top |
|
 |
r00k
Joined: 13 Nov 2004 Posts: 483
|
Posted: Thu Jul 02, 2009 6:02 pm Post subject: |
|
|
So, when the think code is called thinktime is sv.time + host_frametime..
Code: |
qboolean SV_RunThink (edict_t *ent)
{
float thinktime;
thinktime = ent->v.nextthink;
if (thinktime <= 0 || thinktime > sv.time + host_frametime)
return true;
|
I've used code like this in my online mods
Code: |
self.nextthink = time + sys_ticrate;
|
but this makes everything ticrate dependant. Thus that little bit of timing to world isnt effected. |
|
Back to top |
|
 |
jim

Joined: 05 Aug 2005 Posts: 400 Location: In The Sun
|
Posted: Sun Jul 05, 2009 11:38 am Post subject: |
|
|
I remember trying to do this 0.05 nextthink, but instead it looked more like skipping frames... _________________ zbang! |
|
Back to top |
|
 |
Boss429
Joined: 03 Dec 2006 Posts: 22
|
Posted: Thu Sep 17, 2009 7:05 am Post subject: |
|
|
out of curiosity, what fps rate does quake play its animations? |
|
Back to top |
|
 |
Spirit

Joined: 20 Nov 2004 Posts: 476
|
Posted: Thu Sep 17, 2009 9:06 am Post subject: |
|
|
I think it is ~10fps but that might be utterly wrong. Some engines interpolate between those frames more or less well. _________________ Quake Maps |
|
Back to top |
|
 |
metlslime
Joined: 05 Feb 2008 Posts: 177
|
Posted: Thu Sep 17, 2009 8:04 pm Post subject: |
|
|
Boss429 wrote: | out of curiosity, what fps rate does quake play its animations? |
Generally 10Hz as Spirit said, but this is entirely dependant on Quakec -- in theory you can have different entities with different framerates, by editing the quakec. Crucified zombies have a randomly varying framerate, for example. |
|
Back to top |
|
 |
Downsider

Joined: 16 Sep 2008 Posts: 478
|
Posted: Fri Sep 18, 2009 1:15 am Post subject: |
|
|
jim wrote: | I remember trying to do this 0.05 nextthink, but instead it looked more like skipping frames... |
I believe that's because of your engine of choice's animation lerping assuming an 0.1 nextthink ! |
|
Back to top |
|
 |
Electro
Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia
|
Posted: Fri Sep 18, 2009 2:24 am Post subject: |
|
|
vertex interpolation is just blending the transform of vertices over updates so that they're smooth, it shouldn't have anything to do with nextthink _________________ Unit reporting!
http://www.bendarling.net/ |
|
Back to top |
|
 |
metlslime
Joined: 05 Feb 2008 Posts: 177
|
Posted: Fri Sep 18, 2009 8:50 am Post subject: |
|
|
Electro wrote: | vertex interpolation is just blending the transform of vertices over updates so that they're smooth, it shouldn't have anything to do with nextthink |
nextthink tells you when the next frame is coming from the server. Useful to know when deciding what time interval you want to spend lerping from the last frame to the current frame. Ideally you finish one lerp right at the moment you are ready to start the next lerp. |
|
Back to top |
|
 |
Downsider

Joined: 16 Sep 2008 Posts: 478
|
Posted: Thu Sep 24, 2009 3:01 am Post subject: |
|
|
metlslime wrote: | Electro wrote: | vertex interpolation is just blending the transform of vertices over updates so that they're smooth, it shouldn't have anything to do with nextthink |
nextthink tells you when the next frame is coming from the server. Useful to know when deciding what time interval you want to spend lerping from the last frame to the current frame. Ideally you finish one lerp right at the moment you are ready to start the next lerp. |
So I was right?
Pwn't. |
|
Back to top |
|
 |
|