What causes automatic projectile fire rate to be "unstable"?

Seems like it should be a solid thing however it seems to fluctuate. And at times it hits a rate I actually find really cool for what I’m doing as this weapon is supposed to be an automatic plasma based rifle with a really fast rate of fire.

The thing is I don’t know why it is doing that. But if it could be controlled and dialed in I think it would be a very interesting effect to add a great touch of realism. Any ideas? Here is a pic of the Primary Fire Blueprint inside my third person character BP.

Well, for one thing, the pressed event is always active while you presse. Your code sort of assumes it is only fired once.

Consider it a while loop, if you want the firing rate to be predictable you have to stop the input from doing anything at all for the amount of the fire rate, then fire.

technically you don’t even need the sequence system if you just loop back to the delay after it’s done.

Delay > projectile > same delay.

If I do that it just keeps firing and doesn’t stop. What do you suggest without that gate to make it stop on inout released?

To stop the loop you can gate the return node instead.
delay > projectile > gate > same delay.
Gate cose button release.
or you could leave the gate Beforehand. Doesnt really matter. Just start open should make it restart I believe.

An alternative solution for this is using timers. Forget all those horrible gate and sequence nodes it’s far to complicated and messy for quite a simple thing :slight_smile:

The way firing an automatic weapon is handled in most of the stuff I’ve gone through is through timers and it gives you alot more control.

On button press start a ‘BeginFire’ function timer with 0 as the InFirstDelay, this will make the weapon fire instantly the button is pressed.

Then you set the timer to looping = true and everytime the timer ends it fires another shot, on button release the EndFire is called and stops the timer running.

You can create a variable for the timers InRate so you can control the length of time between shots (fire rate) whilst you’re holding down the button.

Simple as that :slight_smile:

Here’s the doc page for Blueprint timers:

https://docs.unrealengine.com/en-US/…nts/index.html

Although after having just opened that page I see there seems to be no ‘InFirstDelay’ on the set timer node in blueprint…which is…erm…rubbish…and kinda makes everything I just said pointless…

Maybe on button press call the fire function manually the 1st time then start the timer to run on a loop.

I don’t really get why that Blueprint node doesn’t have the same input parameters as C++…

This works well for me and is not FPS/Tick bound.

float var “pew pew rpm” is Rounds Per Minute.

Thanks! I tried that float variable and the divider on 60 and implemented that into what I was using and that seems to have done the trick. Although if I’m going through 1000 rounds I still do hear a hiccup now and again but it seems much more solid now than it was, with stability in the high 90 percent range. I tried some of the things posted above but did not get very far. You always seem to have an answer for me, thanks again!

Oh and you see that delay in my pic? If I remove that then say if I hold down fire and jump, then the fire stops and when I land I must press fire again. However when that delay is there it works how I want it to with just hold down fire the first time and it will till the clip is empty if in a state its allowed.

I also wanna include and overheat mechanic on this plasma gun. A really pesky and quick overheat where the weapon must be fired in short burst else it becomes quickly unusable.

Projectiles are resource expensive. So you need to consider your system specs when testing and the tickrate (t.maxFPS). You should be applying a lifespan to each projectile after spawn and destroying it on collision. If you do this you’ll notice that when shooting at your feet (short life do to destroy) there’s no stuttering. The RoF is stable.

As far as adding an overheat mechanic it depends on the overall functionality. A full cooldown time (no shots until fully cooled) or incremental which allows for shots fired once its cooled just enough to allow for a single shot.

Your welcome to join my discord and I’ll help you with it over the weekend. Discord