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

Client - Server - Client Issue, Creature hitted by a player

Discussion in 'Multiplayer' started by adi7b9, Feb 22, 2015.

  1. adi7b9

    adi7b9

    Joined:
    Feb 22, 2015
    Posts:
    181
    Hi,

    I'm working on a client - server game. MMO type of game.

    On the server i have the creatures spawn manager, creature movement and creature animations (for the moment). On the client side it's all ok, i see all the creature moving, animating and acting like the server wants to. Note: i use network view serialization for those actions (moving and animating). OnSerializeNetworkView event.

    I have a problem with identifying by the server, the creature that is being hit by the player.

    The player who hit the mob it's known by the server (that player will send a RPC, i think, to the server telling that he hit a creature). Then the server will do some calculation like: damage of the player, HP creature after hit, etc.. and send them back to all the server players (or to all the players around the creature).

    My question: how does the server know what creature has been hitted?

    Thanks in advance,
    Adi.
     
  2. adi7b9

    adi7b9

    Joined:
    Feb 22, 2015
    Posts:
    181
    Problem solved!

    The "creature script" need to send to the server, the info, that the player who runs the game hit it.
    So i placed the [RPC] in the creature script and shared that info with the server.
     
  3. lycanrising

    lycanrising

    Joined:
    Jan 25, 2015
    Posts:
    3
    Glad it's working. I think that an equally viable way is, on colliding with the creature you can get the information from the creature's collider. If your creature has a static variable to indicate what it is, you could send that information with the player's information to the server.