Ace3: ace_spectator: Unit list: virtual player appears + duplicate squads

Created on 3 Oct 2015  路  14Comments  路  Source: acemod/ACE3

ACE3 Version: 3.3.2 Stable

Mods:

  • @CBA_A3
  • @ace

Placed ACE3 Modules:

  • ace_spectator, with GVAR(filterUnits) = 3

Description:

  • On starting spectator, the player's virtual character briefly shows up in the unit list. The player can be selected and followed (usually invisible, out in the ocean).
  • After a few seconds, it disappears, and odd behaviour can happen, usually with one of the real speccable squads being duplicated.

Steps to reproduce:

  • Send the player into spectator mode through
ace_spectator_fnc_setSpectator;
[player, true] call ace_spectator_fnc_stageSpectator

(do not call it through the debug console; it will crash the game)

Where did the issue occur?
Everywhere

kinbug

All 14 comments

Can confirm I experience this issue from time to time.

:+1: Good report, will investigate

Not entirely sure what's causing this one. Looked through the code a few times and it checks out as far as I can see.

Might have to push fixing it back to the next milestone.

Just to update, can definitely reproduce this, still not sure what is causing it.

Just to clarify, is this why if a unit dies, you still have 4 people listed in a fireteam but it just repeats one name, for example:

Pre-death:
    A1 ->
        John
        Thomas
        Oliver
        Dave

Post Oliver's death:
    A1 ->
        John
        Thomas
        Dave
        Dave

Hit escape to force reload spec UI seems to clear it.

It's most likely related, in fact, your post is a little more specific with regards to reproduction and might help me to track down the cause

Fixed in #3147

Only partially fixed! :smile:

Since I'm quite busy at the moment and don't have much development time I'll write down my current thoughts on this issue in case anybody else wants to take a look:

  • Remaining issue is that there are seemingly arbitrary duplicate units/groups in the tree
  • Here is the code that updates the tree control
  • I notice that on line 348, there is no - 1 like the similar lines 340 and 341. Probably worth investigating that.
  • If Cryuz134's comment above is accurate, it seems that when a unit dies, his node in the tree is taken by the next unit in the group (I assume this wouldn't happen if his name was last) and the unit's old node is left behind.
  • I've just looked through that code again and it all seems fine except for the discrepancy I mention above. I don't think that's intentional because I would have wrote a comment to make it clear. My breakdown:

    • It first scans the existing tree structure and caches the sides/groups listed followed by their node's path number (the cache arrays should be something like this: [grp,0,grp2,1,grp3,2,...])

    • It also caches the units already in the tree, which are then subtracted from the unitList (list of all current spectatable units) to remove any unnecessary iteration and simplify the code.

    • While doing this, it's also checking that the groups/units are still listed in their respective GVAR and deleting them from the tree if they aren't.

    • Iterating through the units left to add them into the tree, it first fetches their side and group, to check if they're already in the tree (in the cache arrays). If they are then the node path number is fetched, else a new node is made and its path number cached with the respective side/group.

    • The new unit node is then created at the path which was just fetched/created.

2 notes for using the repro mission provided by @voiperr:

  • module won't work with current implementation in Eden, must use description.ext:
class ACE_Settings {
    class ace_spectator_filterUnits {
        typeName = "SCALAR";
        value = 3;
    };
};
  • ace_spectator_fnc_setSpectator must be called with empty array [], otherwise _this will carry over from spawn due to scope and be executed like 0 call ace_spectator_fnc_setSpectator, causing RPT error (since 1.54, it will still continue executing though)

Duplicates should be fixed by #3781 :hammer:

Quick test with 4 people shows https://github.com/acemod/ACE3/pull/3781 working without any side effects, will run it on Saturday with 40+ and see how it handles that.

This issue appears to be fixed and the changes have been merged to master, closing! :tada:

Worked fine with larger numbers, forgot to update this :banana:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SimichRE picture SimichRE  路  3Comments

Dyadka940 picture Dyadka940  路  3Comments

Herbiie picture Herbiie  路  3Comments

JudahHarvey picture JudahHarvey  路  4Comments

lividsubset3 picture lividsubset3  路  3Comments