ACE3 icon indicating copy to clipboard operation
ACE3 copied to clipboard

Interact Menu: Can't interact with some players

Open havena opened this issue 11 years ago • 17 comments

Players cannot interact each other randomly.

bugged players need to disconnect/reconnect to be accessible again.

ex : http://i.imgur.com/ItjXjfb.jpg

havena avatar May 18 '15 01:05 havena

That may be caused ocassionally by one of two known bugs:

1 - If the affected player cannot interact with anyone then it should be fixed on current master. 2 - If the affected player cannot interact with some other players at random, it's actually an issue with CBA that we are trying to work around. AFA we now it happens on heavy missions, with respawn = base;, specially for players with slower pcs.

Which do you experienced?

nicolasbadano avatar May 18 '15 01:05 nicolasbadano

some players connot interaction with some others, so look like 2 and yes i use respawn = base;

havena avatar May 18 '15 01:05 havena

i made some test with bugged player on car :

_actionTrees = missionNamespace getVariable [_varName, []];

is empty for bugged player. line 26 of https://github.com/acemod/ACE3/blob/master/addons/interaction/functions/fnc_addPassengerActions.sqf

ex : http://i.imgur.com/PpVgu6S.png

havena avatar May 18 '15 02:05 havena

Yes, it's definitively (2). As I understand it, cba delays the initialization of the units under those conditions and eventually times out, leaving some of the clases unitialized.

Do you have something particularly taxing on the scheduler? (that heavily use spawn or execVM, lke ai or sound mods?)

nicolasbadano avatar May 18 '15 03:05 nicolasbadano

This is a bandAid and not a proper fix, but this should fix the problem for now and not be too taxing:

If the actions aren't defined when showing the menu, then rerun the compile for that unit.

fnc_renderActionPoints.sqf:

_actionsVarName = format [QGVAR(Act_%1), typeOf _target];
_classActions = missionNamespace getVariable [_actionsVarName, -1];
if (_classActions isEqualTo -1) then {
    ERROR("Class Actions Not Defined!");
    [_target] call FUNC(compileMenu);
    _classActions = missionNamespace getVariable [_actionsVarName, []];
};

If the

PabstMirror avatar May 18 '15 03:05 PabstMirror

I do have a couple of similar ideas, but they are also bandaids like that one.

As long as cba fails on time out, ace (and other mods) will be still randomly broken in subtle ways. In my opinion this needs to be solved at its base. Now that cba has pfh since the very beginning of the mission we should push to guarantee that init happens on sheduled space, so all init code runs completely reliably.

The interact menu issue ensures great visibility for the cba bug.

What do you think @ViperMaul, @jaynus?

nicolasbadano avatar May 18 '15 04:05 nicolasbadano

We'll have to discuss internally in CBA as this is a very core, "stable" area that no one has the faintest fucking idea how it works.

I think I'm just going to ditch the timeouts and call it a day

jaynus avatar May 18 '15 07:05 jaynus

you think this fail ? https://github.com/acemod/ACE3/blob/master/addons/interact_menu/CfgEventHandlers.hpp

havena avatar May 18 '15 10:05 havena

i think this cause shitty (cba_xeh/init_pre.sqf) :

perhaps change this waitUntil { !(isNull player) || {SLX_XEH_MACHINE select 13} }; by waitUntil { !(isNull player) };

// Schedule PostInit
// Schedule PostInit
SLX_XEH_STR spawn {
    // Warn if PostInit takes longer than 10 tickTime seconds
    SLX_XEH_STR spawn {
        private["_time2Wait"];
        _time2Wait = diag_ticktime + 10;
        waituntil {diag_ticktime > _time2Wait};
        if !(SLX_XEH_MACHINE select 8) then { 
            XEH_LOG("WARNING: PostInit did not finish in a timely fashion");
            waitUntil {time > 0};
            // Consider there will be no player if neither PostInit-Ready, nor PlayerCheck-Ready
            if !(SLX_XEH_MACHINE select 8 || {SLX_XEH_MACHINE select 5}) then { SLX_XEH_MACHINE set [13, true]; };
        };
    };

    // On Server + Non JIP Client, we are now after all objects have inited
    // and at the briefing, still time == 0
    if (isNull player) then {
        #ifdef DEBUG_MODE_FULL
        "NULL PLAYER" call SLX_XEH_LOG;
        #endif
        if !((SLX_XEH_MACHINE select 4) || {(SLX_XEH_MACHINE select 6)}) then { // only if MultiPlayer and not dedicated
            #ifdef DEBUG_MODE_FULL
            "JIP" call SLX_XEH_LOG;
            #endif

            // TEST for weird jip-is-server-issue :S
            if (!(SLX_XEH_MACHINE select 2) || {SLX_XEH_MACHINE select 3} || {SLX_XEH_MACHINE select 4}) then {
                str(["WARNING: JIP Client, yet wrong detection", SLX_XEH_MACHINE]) call SLX_XEH_LOG;
                SLX_XEH_MACHINE set [2, true]; // set Dedicated client
                SLX_XEH_MACHINE set [3, false]; // set server
                SLX_XEH_MACHINE set [4, false]; // set dedicatedserver
            };
            waitUntil { !(isNull player) || {SLX_XEH_MACHINE select 13} };
            if (SLX_XEH_MACHINE select 13) then { XEH_LOG("WARNING: TimedOut waiting for player object to be ready. Continueing PostInit without Player ready") };
        };
    };

    if !(isNull player) then {
        if (isNull (group player) && {player isKindOf "CAManBase"}) then {
            // DEBUG TEST: Crashing due to JIP, or when going from briefing
            //           into game
            #ifdef DEBUG_MODE_FULL
            "NULLGROUP" call SLX_XEH_LOG;
            #endif
            waitUntil { !(isNull (group player)) };
        };
        waitUntil { local player };
    };

    // set JIP
    SLX_XEH_MACHINE set [1, !isDedicated && getClientState in ["BRIEFING SHOWN","BRIEFING READ","GAME FINISHED","DEBRIEFING READ"]];

    GVAR(init_obj2) setDamage 1; // Schedule to run itsy bitsy later

    SLX_XEH_MACHINE set [5, true]; // set player check = complete
};

my RPT :

 3:32:31 [147855,2460.97,0,"WARNING: PostInit did not finish in a timely fashion"]
 3:32:42 [148060,2472.08,0.056,"WARNING: TimedOut waiting for player object to be ready. Continueing PostInit without Player ready"]
 3:32:42 [ACE]: Check-PBOs Module Initialized. Mode: 2.
 3:32:42 [148061,2472.1,0.056,"XEH: PostInit Started"]
 3:32:42 [148061,2472.14,0.056,"CBA_VERSIONING: cba=1.1.20.150416, ace=3.0.0.3, "]
 3:32:42 "[INF] [MOCAP_Code] XEH_post_CommonInit..."
 3:32:42 "[INF] [MOCAP_Code] XEH_post_CommonInit complete"
 3:32:42 "[INF] [MOCAP_Code] XEH_post_ClientInit..."
 3:32:42 "[INF] [MOCAP_Code] XEH_post_ClientInit complete"
 3:32:42 [ACE]: ACE is version 3.0.0.3.
 3:32:43 [148061,2472.59,0.056,"XEH: PostInit Finished. State: _isClient=true, _isJip=true, _isDedClient=true, _isServer=false, _isDedServer=false, _playerCheckDone=true, _sp=false, _startInitDone=true, _postInitDone=true, _mpRespawn=true, _machineType=2, _sessionId=2, _level=0, _timeOut=true, _game=3, BIS_functions=L Alpha 1-1:1 REMOTE, group=L Alpha 1-1, player=<NULL-object>, _playerType="", _playerGroup=<NULL-group>"]

havena avatar May 18 '15 10:05 havena

I've opened https://dev.withsix.com/issues/76260 in CBA to track my progress on fixing this.

@ViperMaul @esteldunedain @PabstMirror

I would still recommend we implement a bandaid solution for this today for the Hotfix, because a CBA release is going to be pending a few days at a minimum, and more like a week or two for a proper fix to be in place. I think we need to get the temporary bandaid on top first while this is fixed properly in CBA for the next scheduled ACE release.

jaynus avatar May 18 '15 14:05 jaynus

This has hopefully been fixed in the CBA repo; gonna try to get a dev build of CBA into this thread to see if the issue is resolved.

jaynus avatar May 18 '15 15:05 jaynus

@havena @PabstMirror @esteldunedain

Can you please test with this DEV build of CBA: http://bit.ly/1HcwXLX

jaynus avatar May 18 '15 15:05 jaynus

@ViperMaul, @jaynus: I've just read the code. I think it will work for this but:

  • When no player is present (bird, spectator mode, etc) postInit execution would now happen 5 minutes into the mission. That could be bad for some scenarios.
  • TBH modders have learnt that player is not guaranteed to exist on postInit. Many many addons start their postInits with something like waitUntil {!isNull player} for that reason. The attempt by cba to delay ALL postInits until a player exists doesn't make much sense anymore in that context. I agree that's it difficult to change something like this at this point, but imo cba needs to rethink its init thing at some point.
  • A proposal for a "better" system could be like this one:
    • a missionInit event that happens when postInit usually happens, but without waiting for the player.
    • a playerInit that happens after missionStart when the player is detected (and doesn't happen at all if there's no player.
    • postInit would then become replaceable with those events, and eventually deprecated. Anything independent of the player would go to missionStart EH, and everything depending on the player to playerInit.
  • Obviously such a system could coexist with the actual one for backward compatibility.

nicolasbadano avatar May 18 '15 16:05 nicolasbadano

So, there are two separate bugs here which I was attempting to address - the waits are separate for them, and I had the same confusion you did here. There are two different things occurring:

CBA would wait 10 seconds no matter what, and then if all PostInit handlers were not complete, it would continue execution. This is a seperate check here, where it is waiting 10 seconds and seeing if PostInit execution has completed. If it has not completed, it will continue running init handlers.

This has been changed to:

waituntil {diag_ticktime > _time2Wait || (SLX_XEH_MACHINE select 8) };
if !(SLX_XEH_MACHINE select 8) then { 
            XEH_LOG("WARNING: PostInit did not finish in a timely fashion");

SLX_XEH_MACHINE 8 is set when all object init handlers have ran and then when all post init handlers have completed. This will wait 5 minutes for that process to complete. The player object check occurs after this wait, and it will not wait for player objects at this point - it simply is waiting for object initialization to complete.

Originally, the player object check occured after PFH, and then would error on the player object. This will still occur, as the object initializers do not wait for player.

The error of "Timed out waiting for player" is actually a misnomer, as it occurs from this check:

waitUntil { !(isNull player) || {SLX_XEH_MACHINE select 13} };

The error is not actually occuring waiting for the player object, as the error states. It is erroring because PostInit handlers took longer than 10 seconds (reference SLX_XEH_MACHINE 13 is set by the 10 second wait error).

The second bug, was that all object initializations were being spawned. This caused them to lag into scheduled space, and cause them to generally occur for over 10 seconds because of scheduled space stacking and sharing. This was caused by the _isDelayed check being backwards; if it was delayed it should have spawned, and if it was not delayed it should call. It was doing the opposite, so by default all object inits were spawned, instead of called.

So, in summary, this means the XEH process changed as such:

  • PostInit completion will not fail unless all object init handlers and the PostInit handlers take more than 5 minutes. This means they will all run, in order, and the init process will completely linearly as the guarantee should be.
  • Object initializers will now always occur after PostInit has completed.
  • Player check is unaffected
  • All object init handlers will be called unless specifically specified as delayed

jaynus avatar May 18 '15 16:05 jaynus

Next response:

I don't think changing the XEH system in such a fundamental way is possible; this recommendation is basically separating the XEH phases into a way that the system really never suggested, and is not designed to do.

This bug was occuring specifically due to a 10 second time limit on all PostInit handlers completing prior to object init handlers running - I believe the above correction will solve this issue, so we have established a synchronous guarantee of the following:

PreInit PostInit ObjectInit **** THIS STEP WAS SOMETIMES OCCURRING BEFORE/DURING POSTINIT PlayerInit

jaynus avatar May 18 '15 16:05 jaynus

As per discussed with @jaynus on Slack, I don't think the disorder between PostInit and init XEH is the cause of the interact menu bug. But init XEH happening in scheduled env. could very well explain what's happening (engine halting execution while compiling the menus), so the bug may get fixed by jay's switching spawns per calls.

nicolasbadano avatar May 18 '15 16:05 nicolasbadano

My fix has been reverted from CBA, as there were two edge cases not considered that this DOES cover, which breaks the entire system.

jaynus avatar May 18 '15 17:05 jaynus