Announcement

Collapse
No announcement yet.

Replication conditions per client

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

    Replication conditions per client

    I find it very frustrating that the replication condition block is unable to consider which client we're replicating for when deciding if variables should be replicated.

    Example: I'm implementing a overhead interactive map. I want to replicate the location of all players that are on the same team as client I'm replicating to.

    We essentially have to set the same flat rules for all clients (even if they're not on the same team, or they are very far from the player).

    What I want to be able to do is something like this:
    Code:
    replication
    {
        if (bNetDirty && WithinRangeFromClient(10000))
            Location, Rotation;
    }
    But as far as I can tell there is no way to access a reference to the player I'm replicating to in the replication block.

    Any ideas if there is a way?

    #2
    Well it's going to replicate as long as the variable it's set to a different value so, the condition goes into another block.... no?
    Some cool unreal projects you may like!


    Developer of GOTA - Survivalism Gladiatorial game Buy the game google gladiators of the arena steam https://store.steampowered.com/app/7..._Of_The_Arena/

    Download the demo Download the demo
    external link Dropbox DropBox

    Become a c++ Professional now C++ Networking Tutorial

    Comment


      #3
      when the var changes have it set a var on each player on that team. Then when that Var replicates it will be only for the ones on that team. In the replicationEvent function try something like this. This is just an example but that would play for just team 0. it would not replicate to
      any one on team 1.
      So team 1 would not run the function.

      Code:
       simulated event ReplicatedEvent(name VarName)
      {    
        if(VarName == 'PlayersTeamIndex')
        {      
          if(PlayersTeamIndex == 0)      
          {        
            SetTheTeam(PlayersTeamIndex);      
          }    
        }        
        Super.ReplicatedEvent(VarName);  
      } 

      Hope this helps

      Comment

      Working...
      X