Multiplayer Questions

Hello! I’m currently developing a multiplayer game and am looking forward to find ways to make the game better. Here are the questions :

  1. How would I make animation over network? Someone said to put network view on the object with the animation and it will work. Is this true? If not, any other ways to do it? (it would be better with a test script and through and easy explanation because I’m new to networking)
  2. How would I make sound over network? Is Network.Instantiating a physical sound (empty with sound attached) and playing the audio on awake work? If so, do I need to put network view on it? If network.instantiating doesn’t work, what other ways can I make sound heard over network? (The sound will be ranged not like a sound everyone hears. People have to be in range.)
  3. Different spawn point. I would like to make a spawn point for each team and when people click “Spawn”, the don’t spawn on top of each other because there is only one spawn. How would I get to make it more than one spawn so if one spawn is occupied, you can spawn on the other?
  4. Random spawn point. How can I make people spawn in random spawn points (like FFA (Free for all))? Do I like use random number generator and if number > 0 spawn at spawnpoint 1?
  5. How would I make nickname show up on top of each characters?
  6. How would I make it so that when the match starts, the characters are already instantiated? Like how would I tell every client which character is yours? NetworkView.isMine won’t work obviously because it is not being Network.Instantiated.
  7. How do I make a “ADD SERVER” button? Like when they put the IP in, it saves it. Like Minecraft. So when they make a game, and the port for the game is port forwarded, people can join it. Is that possible for using direct connect instead of master server?

Sorry if it was too long xD I’m new to Unity 3D Networking and I would like to get better at it! :smiley:

You should ask specific questions in here, these are very general.

I can help you with some of them.

  1. You need a network view attached to the game object containing the script that will handle the animations. When you want to animate it, you will make a RPC call, and in your RPC function, play the animation.

  2. Same for the sounds, you need a network view (it can be the same as the one for the animations), make a RPC call, and in your RPC method, play the sound.

  3. You need to define specific spawn points first, or create a random function that will return a spawn position, but with this choice, it will be harder to make your point 4) happen (not impossible, just harder). Each client that needs a spawn position should ask the server what position is available, the server checks in the predefined list of spawn position one that is available (that means check if every player is at a certain distance of this point, it is valid), and then the server sends the valid spawn position to the client.

  4. It goes with point 3). The only thing to add is to choose on the server side a spawn position randomly (if you have a list of spawn positions, randomly choose the index for example).

  5. Never did this myself, I think it is an advanced thing to do. In my opinion, it needs a raycasting (to check if the player is “seeable”), make a GUI text appear on top of it (I really don’t know how to get the coordinates to place the GUI text …).

  6. In my multiplayer game, I make a Network.Instantiate, so I handle everything like that with networkView.isMine, so I advise you to open a specific question with more details on this topic.

  7. No idea :slight_smile: