Gameplay abilities and Weapon Firing

Honestly, i wouldn’t use the Target Actors as they are, they are too expensive for weapon fire. Now it depends on what system you want to go for. Client produces shot data, or server and client produces shot data or just server produces the data. Truthfully, batching the shots should not be something you should do to start of with. i would get the system working. The most simplest way is :

A: Activate ability, which fires the first shot.
B: Have a task which is repeated after X delay (X being firerate of weapon). This task will do the line trace.
C: Depending if its client or server producing the target data, if its client producing data you would need to setup a scoped prediction window before sending the target data. This should be via CallServerSetReplicatedTargetData. If its server, then there is no need to call this as server can just produce and act on the target data itself.
D: Once firing is finished (out of ammo, trigger relased, etc), end the ability.

I mean my system is quite complex, as i don’t use any tasks in the ability, instead my weapon has native firemodes, which calls CurrentFireAbility->FireShot(). But the principle is the same. I am planning to do a bit of a write up on a more simpler system than mine, which will work, and makes use of the batched RPC calls in the ability system. Possibly also release a sample project showing it in action.

One thing to note, i don’t use ability input bindings for my weapons. Input is handled natively and forwarded to the current equipped weapon. Pressing fire, calls TryFireWeapon on the actual weapon itself.

One thing to note, you don’t want to grant the ability on equip, the ability should be granted when the weapon is given to the player. This reduces potential delay in firing when equipping as you have to wait for a onrep back from the server before client can fire.