Announcement

Collapse
No announcement yet.

Replicating a static array on an enemy pawn is intermittent? (code example)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replicating a static array on an enemy pawn is intermittent? (code example)

    On my enemy pawn I am spawning a "Loot" class which contains a static array (containing loot objects). I'm finding that when one player removes or moves loot items from this array, it is replicating to the other players as expected. This is great, however it is not working 100% of the time, and sometimes players (that are standing right next to the enemy while another player alters the loot array) will not receive the replication for the altered array. Maybe 1 in every 3 attempts fails to replicate.

    Enemy pawn class:
    Code:
    var MyLootClass Loot;
    
    //Replication
    replication
    {
        if(bNetDirty)
            Loot;
    };
    
    simulated function PostBeginPlay()
    {
        Loot = Spawn(class'MyLootClass', self);
    }
    Loot Class:
    Code:
    var LootItem Items[6];
    
    //Replication
    replication
    {
        if(bNetDirty)
            Items;
    };
    
    defaultproperties
    {
        RemoteRole=ROLE_SimulatedProxy
    }
    When a client moves a loot item, it calls a reliable server function to notify the server of the move.

    I'm struggling to debug why this is sometimes failing to replicate to all players (but then working fine the rest of the time). Is there a setting I am missing to ensure the replication is reliable?

    Thanks in advance for any help anyone can give me

    #2
    Check, if the player is the host (listen server) does it always works but not for client or only 1 in 3 for client ... maybe you have a bug in your triggering process and the array isn't updated when you think it is? How is the replication triggered, from Kismet and a seqact cause I've had issues with that.

    Comment


      #3
      Thanks for your input @ffow. I've instead decided to take a different approach, whereby the player takes ownership of the external loot while he/she is inspecting it. This way I can simply replicate to the owner without having to replicate to all players in proximity.

      Comment

      Working...
      X