Forum

Weapons Frames

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Weapons Frames

Postby lukas2288 » Wed Jul 01, 2009 8:34 am

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)?
________
mflb
Last edited by lukas2288 on Thu Feb 03, 2011 6:18 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby MauveBib » Wed Jul 01, 2009 3:11 pm

self.nextthink = time + 0.05;

Add that to every animation function to double the frame rate, in theory anyway.
Apathy Now!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Postby Urre » Wed Jul 01, 2009 4:55 pm

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.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Spike » Wed Jul 01, 2009 6:41 pm

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).
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby lukas2288 » Wed Jul 01, 2009 7:05 pm

Thanky guys i will try it tomorrow.
________
Saratoga
Last edited by lukas2288 on Thu Feb 03, 2011 6:19 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby Urre » Thu Jul 02, 2009 11:41 am

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.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby r00k » Thu Jul 02, 2009 6:02 pm

So, when the think code is called thinktime is sv.time + host_frametime..
Code: Select all
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: Select all
      self.nextthink = time + sys_ticrate;


but this makes everything ticrate dependant. Thus that little bit of timing to world isnt effected.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby jim » Sun Jul 05, 2009 11:38 am

I remember trying to do this 0.05 nextthink, but instead it looked more like skipping frames...
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby Boss429 » Thu Sep 17, 2009 7:05 am

out of curiosity, what fps rate does quake play its animations?
Boss429
 
Posts: 39
Joined: Sun Dec 03, 2006 7:29 pm

Postby Spirit » Thu Sep 17, 2009 9:06 am

I think it is ~10fps but that might be utterly wrong. Some engines interpolate between those frames more or less well.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Spirit
 
Posts: 1031
Joined: Sat Nov 20, 2004 9:00 pm

Postby metlslime » Thu Sep 17, 2009 8:04 pm

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.
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby Downsider » Fri Sep 18, 2009 1:15 am

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 :D!
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Electro » Fri Sep 18, 2009 2:24 am

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
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Postby metlslime » Fri Sep 18, 2009 8:50 am

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.
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby Downsider » Thu Sep 24, 2009 3:01 am

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.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest