ReactiveDrop / reactivedrop_public_src

Alien Swarm: Reactive Drop game source code and issue tracker.
https://reactivedrop.com
104 stars 35 forks source link

Offhand counter may falsely show 0 #738

Open WhenTanksFly opened 4 months ago

WhenTanksFly commented 4 months ago

A long-standing issue that feels natural by this point, and yet I never tracked what exactly leads to it. This time I tried to activate eca as I walked past it, and probably pressed something wrong.

https://github.com/ReactiveDrop/reactivedrop_public_src/assets/112336094/6dcc795c-e0b6-4130-be46-2856f69fa10f

270 ping may have contributed, as it doesn't seem to break in singleplayer. d_0gren_timerstation_tick17777.zip The problem is replicated in the demo as long as not jumping past the tick where the issue has been triggered. I've disposed of the last hand grenade at the very end, tick 22222+, proving the game was wrong about 0 hand grenades remaining. Besides, had I really had 0 grenades, the icon wouldn't be there at all.

BenLubar commented 3 months ago

my guess before looking at the recording at all is that it has something to do with prediction

let's see if I'm right

BenLubar commented 3 months ago

image Alright, so what happened here is that picking up a weapon is a server-only action, but firing a weapon is predicted on the client as well.

So during that panic, from the client's perspective, Bastille started throwing a grenade, picked up the ECA, and then picked the grenades back up. From the server's perspective, Bastille picked up the ECA, activated it, and then picked up the grenades.

Other than forcing an ammo count update when a weapon is picked up, I can't really think of any way to fix this. And forcing an ammo count update seems like the wrong solution.

If you had more than one grenade left, the counter would have been corrected whenever the next actual grenade throw happened.