Inside3D!
     

Weapons Frames

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
lukas2288



Joined: 14 Jun 2009
Posts: 42

PostPosted: Wed Jul 01, 2009 8:34 am    Post subject: Weapons Frames Reply with quote

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
View user's profile Send private message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Wed Jul 01, 2009 3:11 pm    Post subject: Reply with quote

self.nextthink = time + 0.05;

Add that to every animation function to double the frame rate, in theory anyway.
_________________
Apathy Now!
Back to top
View user's profile Send private message
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Wed Jul 01, 2009 4:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Jul 01, 2009 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
lukas2288



Joined: 14 Jun 2009
Posts: 42

PostPosted: Wed Jul 01, 2009 7:05 pm    Post subject: Reply with quote

Thanky guys i will try it tomorrow.
Back to top
View user's profile Send private message
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Thu Jul 02, 2009 11:41 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Thu Jul 02, 2009 6:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
jim



Joined: 05 Aug 2005
Posts: 400
Location: In The Sun

PostPosted: Sun Jul 05, 2009 11:38 am    Post subject: Reply with quote

I remember trying to do this 0.05 nextthink, but instead it looked more like skipping frames...
_________________
zbang!
Back to top
View user's profile Send private message Visit poster's website
Boss429



Joined: 03 Dec 2006
Posts: 22

PostPosted: Thu Sep 17, 2009 7:05 am    Post subject: Reply with quote

out of curiosity, what fps rate does quake play its animations?
Back to top
View user's profile Send private message Visit poster's website
Spirit



Joined: 20 Nov 2004
Posts: 476

PostPosted: Thu Sep 17, 2009 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
metlslime



Joined: 05 Feb 2008
Posts: 177

PostPosted: Thu Sep 17, 2009 8:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Fri Sep 18, 2009 1:15 am    Post subject: Reply with quote

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 Very Happy!
Back to top
View user's profile Send private message
Electro



Joined: 29 Dec 2004
Posts: 241
Location: Brisbane, Australia

PostPosted: Fri Sep 18, 2009 2:24 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
metlslime



Joined: 05 Feb 2008
Posts: 177

PostPosted: Fri Sep 18, 2009 8:50 am    Post subject: Reply with quote

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
View user's profile Send private message
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Thu Sep 24, 2009 3:01 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group