Page MenuHomeFeedback Tracker

Locking map buildings in multiplayer is not reliable
New, NormalPublic

Description

Hello.

This ticket will be related to two other tickets :
this one which looks dead : https://feedback.bistudio.com/T76478
and this one which has been closed : https://feedback.bistudio.com/T117338

As far as i know, there is only one way to lock the door of a building within a script :

_building setVariable ["bis_disabled_door_1", 1, true];

this variable is used in BIS_fnc_door to check if the door should open or not.
We can't change this behaviour on our side without reconfiguring all houses or changing BIS_fnc_door.

The problem is simple but apparently has no solution.
Because of map objects streaming, sometimes, randomly in multiplayer, a building on a specific player's machine will be deleted and created again.
Which means that this player will loose all variables (bis_disabled_door_X) set on that building, and will be able to enter freely inside.
This seems to happen more often when there are a lot of players connected on the server.

So this task would be either one of these solutions :

  • [Bug] Set the variables back when the object is created again after being deleted
  • [Feature] Or create a new way to lock doors on buildings, which doesn't use setVariable
  • [Feature] Add a config parameter serverside to disable map object streaming ? ...

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Reproducibility = always because it happens everyday on my server

just put a

_building setVariable ["bis_disabled_door_1", 1, true];

on the server at the start of the mission, then make a loop on clients to diag_log the content of

{diag_log format ["%1 : %2", _x, _building getVariable [_x, ""]]} foreach allVariables _building;

and wait for someone randomly having the issue

Additional Information

I'm available to test anything you want.
Right now the only solution for me is to make a loop serverside which reset globally all variables on all buildings every X minutes.
Which cause unnecessary traffic.

Event Timeline

reekoj created this task.Mar 13 2023, 11:59 PM
reekoj edited Steps To Reproduce. (Show Details)
reekoj edited Additional Information. (Show Details)Mar 14 2023, 12:03 AM
reekoj updated the task description. (Show Details)Mar 14 2023, 12:06 AM

Does this happen for JIP players and not players who were on the server at the moment of "setVariable" use?

This comment was removed by Geez.
Geez added a subscriber: Geez.Mar 14 2023, 10:49 AM
TRAGER added a subscriber: TRAGER.Mar 14 2023, 12:04 PM
dedmen added a subscriber: dedmen.Mar 15 2023, 10:29 AM

You could try if EntityCreated eventhandler is triggered when a building is streamed in.
That way you could set the var when the building re-appears

reekoj added a comment.EditedMar 15 2023, 3:45 PM

Does this happen for JIP players and not players who were on the server at the moment of "setVariable" use?

In my case all the variables are set when the server starts so there is nobody on the server.
When players join, every building are locked for them.
And then 1 or 2 hours later, some players (very few, like 5/100+) randomly don't have any variable set on some buildings (not all) anymore.

You could try if EntityCreated eventhandler is triggered when a building is streamed in.
That way you could set the var when the building re-appears

I will try to log this event

Please let us know how it went, I had similar issues with streaming objects, yet to make a repro and ticket so I'm very interested in your case.

reekoj added a comment.EditedMar 19 2023, 3:56 PM

So i've put a log on EntityCreated and BuildingChanged events, none of these have logged the "bugged" buildings.

I guess i will solve my problem by reconfiguring every userActions of the buildings, to use a custom script in the statement instead of BIS_fnc_door, which will check a hashmap that every player has locally instead of the bis_disabled_door variable.
The map will contain the netID of buildings as key and an array of locked doors as value
But this solution can only work on modded servers, and is a lot of work for a problem like that.

I recently had an issue where buildings failed to receive scripted (HandleDamage-returned) damage for JIP players. I chose some building far from the action, damaged it, restarted the game, rejoined and it had wrong damage numbers. My guess was that game mixes up which entity should get which damages, maybe it does it the same with variables. It was pretty reproducible last time I observed it, I'll make a ticket some time.

Out of curiosity, join your server after its well into the game with fresh Arma 3 start, then check ALL entities on the map and see if it has bis_disabled_door_1 on it? Maybe some fences or unrelated buildings got the variables instead of intended buildings? Maybe record number of buildings that should have this variable on them normally VS how much you'll get as JIP well into the round.

private _objs = nearestObjects [[worldSize/2,worldSize,2],[],worldSize*2] select {!isNil{_x getVariable "bis_disabled_door_1"}};
diag_log ["count _objs", count _objs];
{
	diag_log [typeOf _x, getPosWorld _x];
} forEach _objs;