Page MenuHomeFeedback Tracker

Using setUnitLoadout on Multiplayer produces silent bullets and incorrect weapon reference
Feedback, NormalPublic

Description

Running setUnitLoadout on a player that is in the middle of switching weapons, creates a potential that their weapon will be considered "Throw" or similar for every client that is not local to the player, even while shooting.
This makes the bullets they shoot silent for everyone except themselves..

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Engine
Steps To Reproduce
  1. Load a server
  2. Log in 2 clients (Doesn't matter if its on the same computer or not)
  3. Run this script on one client
[]spawn{
     _clothing = getUnitLoadout player;
     player action ["SwitchWeapon", player, player, 100]; 
     player switchCamera cameraView;
     uiSleep 0.5;
     player setUnitLoadout _clothing;
   };
  1. The other client will see the player that set the loadout with the proper loadout, however their bullets will be silent and their weapons will return as follows;

(Current weapon in hands is a Mk-1 ("srifle_DMR_03_tan_F"), while standing still)

getUnitLoadout _player select 0 select 0
"srifle_DMR_03_tan_F"

currentWeapon _player
"Throw"

weaponState _player
["Throw","HandGrenadeMuzzle","HandGrenadeMuzzle","",0,-1,0]

Additional Information

It seems that the issue sometimes will resolve itself after a few minutes, but not confirmed that it will all the time.

Video of bug and supplied mission
https://www.dropbox.com/s/0g1tg15elsdxi7t/Silent_Bullet_Test.Altis.pbo?dl=0

https://youtu.be/O7klLSCi3LY

Event Timeline

Fraali created this task.Aug 8 2022, 3:22 AM
Fraali edited Steps To Reproduce. (Show Details)

I'll investigate, no promises

BIS_fnc_KK added a comment.EditedAug 8 2022, 10:34 PM

Cannot repro. What game version do you test it on?

BIS_fnc_KK changed the task status from New to Need More Info.Aug 8 2022, 10:35 PM
Fraali edited Additional Information. (Show Details)Aug 9 2022, 12:19 AM
Fraali added a comment.EditedAug 9 2022, 12:24 AM

I've added a video of the issue (with timestamps) as well as a mission that the bug happens on. I couldn't reproduce on a brand new empty mission made in editor, so I found a random mission and removed a bunch of scripts that weren't required for the mission to start.

I've tried on
Current stable branch (2.08.149102)
Current profiling build (2.08.149743)

could you try it on dev please? It could have been fixed indirectly

Can confirm that it also happens on the current dev branch (2.11.149760)

This issue is still present it seems. However, I can't' provide proper steps to replicate, as the server where it occurred is modded. All I know is that upon exiting the ACE Arsenal, some code (written by me, not ACE) which boils down to player setUnitLoadout getUnitLoadout player is run, which I believe causes the desync issue.

I'm running the latest profiling branch (2.12.150954).


However, what I believe is a variation of this issue is present and I have the steps to reproduce:

  • Create mission with 2 playable characters. Units should have loadouts assigned to them.
  • 1 client is the host, the other connects to the mission.
  • Run these commands
// In the case of where the client is of type "B_Soldier_A_F":
currentWeapon cursorTarget // returns "arifle_MX_ACO_pointer_F"
weaponState cursorTarget // returns ["arifle_MX_ACO_pointer_F","arifle_MX_ACO_pointer_F","Single","30Rnd_65x39_caseless_mag",30,0,0]
cursorTarget ammo currentWeapon cursorTarget // returns 30

// all returns are ok and expected
  • Once in mission, have client fire weapon once.
// In the case of where the client is of type "B_Soldier_A_F":
currentWeapon cursorTarget // returns "arifle_MX_ACO_pointer_F"
weaponState cursorTarget // returns ["arifle_MX_ACO_pointer_F","arifle_MX_ACO_pointer_F","Single","30Rnd_65x39_caseless_mag",29,0,0]
cursorTarget ammo currentWeapon cursorTarget // returns 29

// all returns are ok and expected
  • Run the following on the server whilst looking at the client:
cursorTarget setUnitLoadout getUnitLoadout cursorTarget

However, you could also run the following code on the client:

player setUnitLoadout getUnitLoadout player
  • On the client, fire the weapon once again
// In the case of where the client is of type "B_Soldier_A_F":
currentWeapon cursorTarget // returns "arifle_MX_ACO_pointer_F"
weaponState cursorTarget // returns ["arifle_MX_ACO_pointer_F","arifle_MX_ACO_pointer_F","Single","30Rnd_65x39_caseless_mag",29,0,0]
cursorTarget ammo currentWeapon cursorTarget // returns 29

// all ammo counts are out of sync
// interestingly, the round reloadphase from `weaponState` seems to return properly, despite the ammo count being wrong
  • See that is takes a considerable amount of time for the ammo count to synchronize. If you change firemodes on the client, it forces a sync.
Hungry added a subscriber: Hungry.Aug 24 2023, 2:27 PM
Fraali added a comment.Nov 2 2024, 9:23 AM

Confirmed this still happens as of 2.18 stable and profiling

BIS_fnc_KK added a comment.EditedNov 2 2024, 9:17 PM

I cannot reproduce this bug. Does the repro in description run with a mod?

BIS_fnc_KK added a comment.EditedNov 2 2024, 11:36 PM

Revision: 152363

setUnitLoadout will now fail if unit is switching weapon
isSwitchingWeapon command added

while I could not repro it, replacing loadout during weapon switching should not be possible as it could theoretically lead to desync

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Nov 2 2024, 11:37 PM
BIS_fnc_KK changed the task status from Need More Info to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.