Announcement

Collapse
No announcement yet.

Just when i thought i knew a lot about replication...

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

    Just when i thought i knew a lot about replication...

    I have a simple actor class (extending from Actor.uc) with a mesh in my world that I'm replicating so that all clients can see it. Here's what's in it's def props:
    Code:
        bOnlyDirtyReplication=true
        NetUpdateFrequency=8
        RemoteRole=ROLE_SimulatedProxy
        bHidden = false
        NetPriority=+1.4
        bStatic=false
        bNoDelete=false
        bGameRelevant=true
    It seems to replicate fine and all clients can see it. However when I update it's location on the server, this doesn't replicate to clients. If i update the location in the same call while spawning it in, the clients receive this fine, but after that the location never replicates.

    Could anyone shed any light on why location isn't replicating after the initial spawn?

    #2
    Code:
    //-----------------------------------------------------------------------------
    // Network replication.
    
    replication
    {
        // Location
        if ( (!bSkipActorPropertyReplication || bNetInitial) && bReplicateMovement
                        && (((RemoteRole == ROLE_AutonomousProxy) && bNetInitial)
                            || ((RemoteRole == ROLE_SimulatedProxy) && (bNetInitial || bUpdateSimulatedPosition) && ((Base == None) || Base.bWorldGeometry))) )
            Location, Rotation;
    bUpdateSimulatedPosition.

    Comment


      #3
      Thanks for pointing that out @RattleSN4K3. I've just tried that and Location is still not replicating. Here is a simple version of my actor class:

      Code:
      class MyExampleActor extends Actor;
      
      var StaticMeshComponent Mesh;
      
      //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
      //Example method to move the actor in the world
      //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
      function MoveMe()
      {
          SetLocation(Location + vect(0, 100, 0));
      }
      
      
      defaultproperties
      {
          Begin Object class=StaticMeshComponent Name=StaticMeshComp
              StaticMesh=StaticMesh'Meshes.MyStaticMeshes.MyMesh'
          End Object
          CollisionComponent = StaticMeshComp
          Mesh = StaticMeshComp
          Components.Add(StaticMeshComp)
      
          bOnlyDirtyReplication=true
          NetUpdateFrequency=8
          RemoteRole=ROLE_SimulatedProxy
          bHidden = false
          NetPriority=+1.4
      
          bUpdateSimulatedPosition = true
          
          bStatic=false
          bNoDelete=false
      
          bCollideActors=true
          bBlockActors=true
          bWorldGeometry=true
          bGameRelevant=true
          bCollideWorld=false
          BlockRigidBody=true
      }
      I've verified that MoveMe() is getting called on the server, however Location doesn't replicate to the client. Any ideas on what i'm missing here?

      Thanks again for the help.

      Comment


        #4
        I figured out that if I set bOnlyDirtyReplication = false, then Location replicates fine.

        This is a little confusing though as i would think that Location would count as dirty replication, as the server would know that the value is changing from what the client has.

        Comment


          #5
          This is just a guess, but maybe bNetDirty isn't set to true when you change Location with a native function (SetLocation). It is native C++ code that actually changes the variable. And by setting bOnlyDirtyReplication to true you're telling the server to NEVER replicate unless bNetDirty is true.

          Comment


            #6
            Just out of curiosity... If you add an integer variable to your class and have it replicated with just condition bNetDirty, and then have it increased by 1 in your MoveMe(), does Location get replicated or just your new variable? With bOnlyDirtyReplication set to true, I mean.

            Comment

            Working...
            X