Announcement

Collapse
No announcement yet.

Synching a player and a moving object.

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

    Synching a player and a moving object.

    I have a train in a multiplayer networked game that travels across the map.
    -When the players get on the train if it goes to fast the people don't stick on the train, and slide around over time, instead of sticking where they are placed.

    -Is there any way to make players stay on a moving object in multiplayer, so they won't slide around?

    Other Details
    -The Train is a moving object whose movement is done by a timeline,on event tick that is replicated back the clients.
    -The faster the train goes, the less accurate updating the position goes on between the 2 players.
    -I am running client and server on same computer
    -It works fine in single player.

    #2
    Hey, this is an interesting case. When you say it works fine in single player, do you mean that in single player you stick perfectly to the floor?

    It seems what you need to do is predict the effect of the train on players client-side. What you experience as sliding may be actually the players teleporting from a client-side perspective, but this appearing as sliding due to the interpolation that is used to hide lag. For your train I would make sure to:
    - Server-side, apply and replicate the train's movement and make sure the train's movement direction is known client-side
    - Client-side, apply the train's movement as well, so that it approximates the train's position even between network updates

    For players:
    - Server-side, detect which players are in the train (for example using box colliders) and add them to a replicated list, apply the train's movement to the player
    - Client-side, using the replicated list of players on the train, apply the train's movement to the player
    Journeyman's Minimap - Available on Marketplace - Forum topic - Video

    Comment


      #3
      Gotcha, I'm going see what i can do using your tip, just...How exactly would you add selected players to any list? is there a node that does this?

      Comment


        #4
        Are you familiar with array variables? If you have a blueprint for your train, make an Actor array variable by selecting Actor as variable type and clicking the button next to the drop down menu to make it an array (list). You can add and remove actors to that list. The node for this appears in the context sensitive menu if you have that variable as target.
        Journeyman's Minimap - Available on Marketplace - Forum topic - Video

        Comment

        Working...
        X