Search Unity

.

Discussion in 'Multiplayer' started by JBoy, Mar 17, 2013.

  1. JBoy

    JBoy

    Joined:
    Aug 29, 2011
    Posts:
    58
    .
     
    Last edited: May 25, 2014
  2. syrka

    syrka

    Joined:
    May 20, 2009
    Posts:
    14
    i solved it in that way, that i send the movement keys + pos/rot (using the bits of the byte as bool) to the other clients. The clients calculate then the animiation based on this infomationi solved it in that way.
     
  3. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    If you want it to get fixed you have to do it the way syrka mentioned. As far as I understand the way you want it just isn't possible yet. So you could either code a workaround or wait for a unity update and hope it gets added.
     
  4. Redz0ne

    Redz0ne

    Joined:
    Oct 19, 2010
    Posts:
    332
    Just a shot in the dark here but would it be something to consider to make a "native" and a "networked" version? because if you want to sync the variables to feed into mecanim, could you create a recieving prefab that is controlled by a remote instance of the game and then have it wired up to have the variables sent from the native/not-remote instance of the game, send them to the remote instance and then feed them in there?

    because if all you want is to just send the variables over so that the mecanim system over there knows what you want it to do and then have the remote instance of the game feed them in, it might be something... not sure if this is exactly what you're looking for but it's something that i'm thinking might work as a workaround.

    The example i have in my head is as such.

    host game instance: you control the player and the values you'd normally feed into mecanim are also sent over the network as basic scripting values...

    networked game instance: this has it's own, different (in setup only) prefab that is a sort of "networked player" prefab... it then listens for the variables that it's controlling system will send and once it gets them it just drops them into mecanim.
     
    Last edited: Jun 4, 2013
  5. Redz0ne

    Redz0ne

    Joined:
    Oct 19, 2010
    Posts:
    332
    I'm not sure i was able to really explain myself so here's another shot (and to maybe bump this.)

    So.. the way that i understand multiplayer set up is that when the player launches the game in multiplayer, essentially they are the ones controlling the character. so, with this if you wanted to have another player on a remote computer play as well, they'd have the game and the information being transferred to the other players is position and rotation and all that... the way that i've approached this is to make a prefab for the player-controlled character and another that is meant to be controlled remotely. (this means i have two of each player prefab.)

    So, the thing i think might help, if you're having a hard time passing this data over directly into mecanim could be to make a script or FSM (if you're using a visual code editor such as playmaker) whose only purpose is to take the data out from mecanim you want to have it transfer, packaging that up in it's own script and sending that information through the network to the remote game instances. once there, there's a script/fsm whose only job is to listen for that information and feed it into mecanim. I know this might be a little bit "hack-ish" in some respects and i'd be willing to bet that there's a more elegant way of doing it, but maybe this is something to consider trying? i mean, if the two instances of mecanim aren't communicating properly, why not just remove mecanim from the equation in terms of the networked information?
     
  6. neopan

    neopan

    Joined:
    Jan 15, 2013
    Posts:
    47
    please share your code.. there is STILL no multiplayer mecanim example for the public that is really decent...
     
  7. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,052
    JBoy: this isn't really a solution which is feasible, it will work locally when you test, but if you start playing online where ping goes up and down, with several players, etc. you will notice animations playing at the wrong times, delayed, not playing at all, etc.