Search Unity

[SOLVED] Beginner architecture question on syncing

Discussion in 'Multiplayer' started by Palimon, Jul 2, 2015.

  1. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
    I have a two questions as I try to get all my current gameplay features operating correctly during multiplayer.

    1) In my game, multiple people can control a single spaceship. How do I deal with local player authority when multiple sources can control it? Do I have to make the ship a server only object? To lower lag, is there a way to use local player authority for whoever is piloting it, change who that is when they switch, and make it server only when no one is piloting? Does that even make sense to do?

    2) I'm using rigidbody bullets - do I spawn those as local to who fired them or on the server? My understanding is that on creation by the gun controller I'll want to send a command to the server which spawns the bullets there, and the server runs them.
     
    Last edited: Jul 2, 2015
  2. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
    Still having problems. After poking around more on the bullets, I found that I need to have neither "server only" or "local player authority" checked. With this setup, if I fire on the host, I only see bullets in the host and scene. If I fire on the client, I see bullets in the client, host and scene. My bullets seem to be syncing from host and client to the server, but only from client to host, not host to client. This is using the NetworkTransform component.

    I am getting an error "Did not find target for sync message for [#]" in the console log, but there's no other information provided. If I remove the syncing on the bullets this message goes away. One other note is that I do have the bullet prefab registered in the NetworkManager as a spawnable prefab.
     
  3. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
    Ah here we go, switched the host to the editor copy and I see an error "Failed to spawn server object..."
     
  4. sondun2001

    sondun2001

    Joined:
    Aug 20, 2013
    Posts:
    7
    Did you find out why it is failing to spawn the server objects?
     
  5. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
    I did, although I haven't finished fixing it yet (1 week vacation :). After digging deeper, I found that it was failing to spawn due to a non-player object running a command. I'm changing around my whole game architecture so all commands are run through players.