Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Wed Jun 19, 2013 10:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 2:19 am 
Offline
fired 300 rounds
User avatar

Joined: Sun Sep 03, 2006 3:56 am
Posts: 323
Location: Београд, Србија Belgrade, Serbia
It's funny how ONLY the PC version of D3 has this stuttering during rapid fire. :?
The Xbox version however, has a smooth flow of all bullets/projectiles, be it a machinegun, chaingun and/or plasmagun.
Pick any Youtube video walkthrough for the Xbox version and pay attention to the rapid fire.
http://www.youtube.com/watch?v=XglPF1cWCuw

They probably slowed down the firerate in the scripts.

_________________
Бој се оног који је свико без голема мријет јада!
- Gunman on YouTube -
Asus Chassis Vento A8 | MSI Neo5-F 945 | Intel Core2Duo E2200 2.2GHz | Asus GeForce GTS 450 1GB DDR5 | 4GB RAM | WD 500GB SATA-II | Windows 7 Ultimate 32bit


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 7:44 am 
Offline
picked up 200 ammo

Joined: Thu Jan 28, 2010 1:17 am
Posts: 222
I've never watched any Doom 3 footage of the xbox version. It looks great, though sluggish, but you're right the weapons fire without stuttering.

I was wondering if a lot of the things I want to modify need to be done through the SDK, because somethings I try to mod just won't work with the weapons. Sadly, I haven't been able to compile it yet. It is on my to do list!

_________________
Doom 3 editor noob. Doom 3 - Day 75 [HD]
Particle editor/editing | Phrozo Weapons Mod


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 9:16 am 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8713
Location: Orlando, FL
That video is enlightening. Compare that to this...

http://www.youtube.com/watch?v=XFAYOAB4 ... re=related

Watch the muzzleflash. It's not firing slower on the PC. It's simply dropping or cutting off the occasional fire sound. I'm not sure much can be done about that. It's a sound engine problem.

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 9:45 am 
Offline
Invisibility
User avatar

Joined: Fri Aug 13, 2004 4:39 pm
Posts: 3659
Location: Right there! Look!
RangerMcFriendly wrote:
Your help is appreciated, don't get me wrong, it's just the guy and anyone else reading this (noobs like me) would like to fix the stuttering.

O.k now you're just down right annoying. Didn't I give a detailed description on several methods that you (and anyone else) could employ to do this? We have a saying in Holland, 'stench for thanks'. Time I took to help you and others.

If you have a short memory:

BloodRayne wrote:
decayed wrote:
The Happy Friar wrote:
if they're designed that way, yes. The RL fires @ a constant rate. So does the plasmagun. And the mini gun.

is it the sounds or the animations?

the plasmagun doesn't fire at a constant rate, or at least the sounds make it sound that way.

You need to realise some things about the fire animations and how things work in the D3 engine. Firing works via the 'launchProjectiles' statement. At certain keypoints a projectile is launched, these 'events' can be fired from within script or the .def files of the weapon.

The first option is to make a simple loop (pseudocode):
In this instance it will launch a projectile, every time after an anim is done playing.

Code:
WHILE (firingbuttonheld) {
   playAnim(fire);
   launchProjectiles();
   while NotAnimDone(fireAnim) {
     wait;
   }
}


The other way to do this is from the def file itself.
Code:
  anim     firing             "models/weapons/mygun/fire1.md5anim" {
     frame 8                 launchprojectiles();
  }


The sounds are defined also in the def file:
Code:
  anim     firing             "models/weapons/mygun/fire1.md5anim" {
     frame 9                 sound  fire1;
  }


In both methods, the animation itself is leading. For instance, let's say there are different fire anims, and some of them have more/less frames then this will mean that the wait period is sometimes shorter and sometimes longer, causing small delays. This was done by design. With real weaponry you will see that there are minor differences in timing as well (unless you go to the more high tech arms).

If you want the sounds to always play at the same time, make sure they are played at the same frame time.

A simple AK47 will not have a steady firing spree. In any case, if you look at firing weaponry in real life one should always maintain short, controlled bursts 'tatata.......tatata....tatata...' instead of 'tatatatatatatatatatatatata'. Simply pulling down the trigger and spreading your fire only happens in the movies and will do nothing but hurt yourself or worse, your squad mates or innocent bystanders.

If you want to bypass this kind of behavior without having to touch the anims themselves you can do something like this, instead of waiting for the anim to finish, simply define a fixed amount of waiting time:

Code:
WHILE (firingbuttonheld) {
   playAnim(fire);
   launchProjectiles();
   wait ( 0.5 );   ///wait 0.5 milliseconds.
}


Watch out: If you define the wait time as too short very strange things will happen, as the engine cannot render more than 30 frames per second. This means that if you try to fire more than 30 bullets per second the anims will fail and the results will be... interesting. :mrgreen:

_________________
Check out GRIMM Quest for the Gatherer's Key!
Grimm's Youtube Channel

Follow Grimm Quest on Twitter!


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 10:23 am 
Offline
did just hit his 750th monster
User avatar

Joined: Fri Jul 10, 2009 6:32 pm
Posts: 783
what the hell are you guys talking about, never noticed any annoying weapon lag/stuttering issues, modded or vanilla, on the contrary always felt D3/Q4 were supersmooth in that department.

_________________
BoreDooM


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 12:08 pm 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 7096
Location: Here, not there.
Every three, four or 5 shots the weapon sound on fully automatic weapons skip slightly.

I've tried things similar to what Bloodrayne said & couldn't get it to work 100% of the time. Seems no matter what, if you fire a projecticle weapon with a firerate of less then 0.4 you always get the stuttering, irregardless. The chainsaw doesn't do this but it doesn't work the same way. 1) it does everything in the script (sounds & animations) & 2) it has a different way of playing it's animations repeatedly. I think it's something related to this. All projecticle weapons do this:
1) idle
2) go to fire
3) next_attack = sys.getTime() + FIRERATE;
4) while anim not done
5) if holding button & currentTime >= next_attack & have ammo, weapon still firing
6) waitframe


Chainsaw does this:
1) idle
2) go to warmup
3) while fire
4) if holding button, next_attack = currentTime + CHAINSAW_FIRERATE;
5) waitframe

Notice how the projectile weapons set the next attack time outside the look while the chainsaw sets it inside? And the projectile weapon checks if your doing stuff while the anim is running but the chainsaw just checks to see if you're still firing?
I think the stuttering occurs because the projectile weapons are cutting off animation frames & messing up the sounds. Chainsaw can't have that happen, it doesn't care about what frame you're on, it just loops the anim until you let go of the button, doesn't matter what state the animation is in. If you change fixedtic to 1 then it doesn't stutter but everything runs extra fast. That shows me the sound system can play the sounds fine, it's a timing issue with the current setup not letting the animations run properly.

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 6:16 pm 
Offline
picked up 200 ammo

Joined: Thu Jan 28, 2010 1:17 am
Posts: 222
BloodRayne wrote:
O.k now you're just down right annoying. Didn't I give a detailed description on several methods that you (and anyone else) could employ to do this? We have a saying in Holland, 'stench for thanks'. Time I took to help you and others.

If you have a short memory:


Did you think I was being sarcastic when I said thanks? I wasn't, that was sincere, I'm just wondering if the tactical realism was necessary.

Code:
WHILE (firingbuttonheld) {
   playAnim(fire);
   launchProjectiles();
   wait ( 0.5 );   ///wait 0.5 milliseconds.
}


So with this line of code, I can just put it in say, weapons_machinegun.def? I have no idea where to put it.

Code:
model viewmodel_machinegun {
   mesh                models/md5/weapons/machinegun_view/viewmachinegun.md5mesh
   anim raise            models/md5/weapons/machinegun_view/pullup.md5anim {
      frame 1            sound_body player_machinegun_raise
   }
   anim idle             models/md5/weapons/machinegun_view/idle.md5anim
   anim fire1            models/md5/weapons/machinegun_view/fire4.md5anim {
      frame 1            sound_voice player_machinegun_fire
//      frame 1            sound_voice2  player_machinegun_mech
   }
   anim reload            models/md5/weapons/machinegun_view/reload.md5anim {
      frame 1            sound_item player_machinegun_reload
   }
   anim noammo            models/md5/weapons/machinegun_view/empty.md5anim {
      frame 1            sound_voice player_machinegun_empty   
   }
   anim putaway         models/md5/weapons/machinegun_view/putaway.md5anim
}


?

_________________
Doom 3 editor noob. Doom 3 - Day 75 [HD]
Particle editor/editing | Phrozo Weapons Mod


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Thu Jul 01, 2010 7:17 pm 
Offline
found a secret

Joined: Tue Dec 16, 2008 10:34 pm
Posts: 638
I guess that it's part of the weapon.script

check scripts/MACHINEGUN.SCRIPT
Code:
WHILE (firingbuttonheld) {
   playAnim(fire);
   launchProjectiles();
   wait ( 0.5 );   ///wait 0.5 milliseconds.
}

_________________
:D


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Fri Jul 02, 2010 3:40 am 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 7096
Location: Here, not there.
I'm betting those won't work because of the firing animation. I'd say all automatic weapons need new animations (haven't tested yet), simular to the chainsaw:
1 for startup
1 for looping
1 for ending firing.

A single shot could be a separate animation too. I'd say to get realistic weapon performance you need to have the weapons re-done "realistically".

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Fri Jul 02, 2010 10:52 am 
Offline
fired 300 rounds
User avatar

Joined: Sun Sep 03, 2006 3:56 am
Posts: 323
Location: Београд, Србија Belgrade, Serbia
The Happy Friar wrote:
I'm betting those won't work because of the firing animation. I'd say all automatic weapons need new animations (haven't tested yet), simular to the chainsaw:
1 for startup
1 for looping
1 for ending firing.

This is exactly how it works in F.E.A.R.
Sounds do the same as well, you have a single shot, and you have the loop. The single shot plays at the end when the trigger is released.

_________________
Бој се оног који је свико без голема мријет јада!
- Gunman on YouTube -
Asus Chassis Vento A8 | MSI Neo5-F 945 | Intel Core2Duo E2200 2.2GHz | Asus GeForce GTS 450 1GB DDR5 | 4GB RAM | WD 500GB SATA-II | Windows 7 Ultimate 32bit


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Mon Jul 05, 2010 12:40 pm 
Offline
has joined the game

Joined: Wed Sep 02, 2009 12:06 pm
Posts: 29
Then why Quake 1,2,3, all Half-Lifes and Counter Strikes have perfect sound timing? They have weapons animated the exact same way as in Doom 3?
I'm really starting to think that this is just some engine gimmick that ID added because it sounded cool. (it would have been fixed at least in ETQW and Wolfenstein's multiplayer?)


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Wed May 30, 2012 2:01 am 
Offline
picked up 75 health

Joined: Fri May 04, 2012 12:40 am
Posts: 88
Location: Wales
Now that the Full Source Code is released, fixing this can now be possible.

Little research, and found a solution on Splash damage, whom fixed the Issue by switching to Xaudio2.



Quote:
http://forums.warchestgames.com/showthr ... ch-5/page3

(digibob)
The old audio code used to submit buffers to DirectSound in large chunks, think it was around 90ms or so's worth of sound at a time. Since the game code tic ran at 30hz (33ms), this meant that whenever the game code submitted a new sound, there could a variable delay before the sound actually started playing. This took a lot of juggling to work around, and in the end I still wasn't hugely happy with the solution.

We have moved over to using the XAudio2 API now however, which is a much nicer API to work with, especially as a lot of the annoying fiddly bits are handled for you. Write once, compile twice (it runs on the 360 as well!) is also very handy, as it cuts down on the number of APIs we have to support, and thus, the code we have to write.


Any Coder Interested in ridding this problem


Top
 Profile E-mail  
 
 Post subject: Re: weapon firing lag
PostPosted: Sun Oct 07, 2012 10:55 am 
Offline
The first 10 posts have been the best...

Joined: Fri Jun 15, 2012 12:04 pm
Posts: 11
You have to remember though that doom 3 uses scripted weapons that are interpreted and not ran in the engines source. Carmack himself even said that he wished the weapons where done in C++ because of the latency issues.


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group