Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Some basic questions about Multiplayer

Discussion in 'Multiplayer' started by fredr92, Apr 14, 2014.

  1. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    Hi

    After a couple off more hours spent Reading and watching tutorials i think i finally start to understand multiplayer.

    You have the Map that are the server, that all players can see the same world.
    The players have a local view point wich normally are only hands and a item in the hands. but the server are instantiating a completly full body model wich moves in the posison that the local player moves too.

    And i cant use my spawn script from singleplayer cause then only local player see the items, so the server need to spawn items so all players see same items?

    But what about exploding buildings and stuff that are not spawning but belongs in the world but can explode or move or change in some way, is the server some kind off synching these Objects so all players see the changes in the world?

    Please correct me if im totally wrong, i have decided i really want too make my game multiplayer, thanks for any help !
     
  2. nastasache

    nastasache

    Joined:
    Jan 2, 2012
    Posts:
    74
    Server have to send the information to all players/clients, like:
    - LoadLevel(Map) => result : all players can see the same world.
    - spawn item => result : all players spawn&see same spawned item
    If a building explodes by a player action, the player send a request to the server ('I exploded a building') and the server relay info to the clients like:
    - building exploded => result : all players see the building exploding.
    Or the player send a 'network.instantiate (explosion)', with same result.

    It's depending by client/server model (authoritative server, semi-authoritative or authoritative not at all) but rules are the same on all cases, and simple:
    1) the same scene is loaded on all clients;
    2) player is spawn on all loaded scenes, on all clients, at the same location;
    3) actions of a player (ie explosions) are reproduced on all the connected players (locally, on target machines).
     
  3. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    networkview components can synch things like transformations from the host to all the clients.

    You can also send RPC messages from the host to the clients and vice versa.
     
  4. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    I heard using P2P model, so any player can act as a server is easier to implement than using dedicated servers, what do you think?
    I have checked out the photon system, but im considering buying the multiOnline system from the asset store that uses P2P system if its easier too implement + when players can act as server it will be free too host