Game Development Community

Weapons Pickup/Fire delay

by Mathieu · in Torque Game Engine · 05/31/2007 (1:37 pm) · 3 replies

We encounter a weird issue on our FPS game.
When a player pickup a new weapon we automaticaly switch his current weapon with the new one he just pickup. The problem is that there is some kind of delay between the time where the weapon is mounted and the time the user can fire this new weapon. It's not a big delay, something between 500ms and 1s but for a FPS game it's still too big !

I'm pretty sure this don't come from our scripts. The weapon image is mounted in the onPickup function so the image is ready directly when you take it.

Does this come from the network code?
I noticed that we needs multiple ShapeBase::unpackUpdate before setImageState can be triggered.
I have some difficulties to understand this part of the code.
if (isProperlyAdded()) {
	// Normal processing
	if (count != image.fireCount)
	{
		image.fireCount = count;
		setImageState(i,getImageFireState(i),true);
	
		if( imageData && imageData->lightType == ShapeBaseImageData::WeaponFireLight )
		{
			mLightTime = Sim::getCurrentTime();
		}
	}
	updateImageState(i,0);
}

I can understand that the network code need some time before allowing a weapon to be fired but 1s is really too long...
Note that we have this problem on local play too.

Any idea how to reduce this delay?

#1
05/31/2007 (1:50 pm)
Ya it's called the Activate sequence, look in the weapon's image states in the weapon's *.cs file, usually the first one. You should know it when you see it.
#2
05/31/2007 (1:53 pm)
Excellent!
Thank you Chris, I was too much focused on the engine code...
#3
05/31/2007 (1:54 pm)
What does your weapon code look like. You can set delays before the weapon is able to fire using the state machine.

edit: chris beat me too it :)