Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Multiplayer System

Discussion in 'Multiplayer' started by elevenab_unity, Mar 9, 2020.

  1. elevenab_unity

    elevenab_unity

    Joined:
    Mar 9, 2020
    Posts:
    14
    Im working on a demo project, where I use Unity 3D and Photon Unity network(PUN) for a real time game.



    The person in the top panel is an enemy unit, controlled by another player who does damage to the player on the bottom left (1/3 hp left). However, the person on the bottom right is a healer who can heal the bottom left player (both controlled by the local player).

    Here's my problem! Since it isn't turn based and has to happen real time. How do I design my multiplayer system? Ive previously worked on turn based games, where I just pass the indices and mirror the events taking place locally, in the remote player as well.

    But here with latency in the picture, I do not know how to proceed! What I would like to do is, have the healer heal the player locally as well on the remote player's phone before he is attacked by the remote player or kill the player before the healer can heal his hp depending on the timestamp in which the events happen and reflect such on both the devices.
     
  2. vanesamoreno41

    vanesamoreno41

    Joined:
    Nov 29, 2020
    Posts:
    1
    hi i'm trying to make a network turn-based system. My game is a board game in which every time I press the button my object moves me, I have everything on the network except the turns. The turns in a single player works well for me through an index but in the network I am having problems and I don't know how to do it, I have tried with calls and sycnVar but I can't. Could you show me an easy code to get an idea and understand how it works in the network? Thanks
     
  3. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    In my game I have one player be the host and the others be the clients.
    When someone presses a key the commands are sent to the host. This updates the game on the host machine. Then all the positions, animations etc. are copied by the clients.
    So the game is really played only on one machine, the others are merely looking at "mirrors" of it.
    I update things about every 1/20th of a second.