Search Unity

UniKnowledge Networking Tutorial: Bubble Burster

Discussion in 'Multiplayer' started by Lab013, Aug 26, 2009.

  1. Lab013

    Lab013

    Joined:
    Oct 22, 2008
    Posts:
    405
    Ok so I have made a Networked game for my UniKnowledge entry. Here is a demo video of my game, Bubble Burster: http://www.youtube.com/watch?v=c42GdVO42Pk
    (FPS/quality is of course higher in real life.)

    I made this for anyone who wants to learn how to do networking, although a large amount of the content is meant for intermediate Unity-users to advanced Unity-users, I have tried to put things in that most beginners will be able to follow up on. Assuming you have a basic understanding of scripting, you should be able to learn something.

    Contained in this project is a Multiplayer Networked Game with items, scoring, a chat system, missiles, a custom controller for our player, and a master server list for connecting to different servers. The learning material consists of:
    2 PDF's (A outline of all components in Bubble Burster, and an introduction to networking.)
    Well commented code.
    Youtube videos covering every component (you can find the channel at http://www.youtube.com/BubbleBurster101).

    I wrote all but 2 scripts here, the MouseLook, and the Shield shader, I would like to give special thanks to the folks at Unity for the great engine and standard assets, also I would like to give thanks to Omar Rojo who wrote the Shield shader.

    Feel free to use the code contained in this project in any way you would like.

    Also if you have any questions, you can contact me at iphone.MDMstudios@gmail.com

    You can download my project by going to http://forum.unity3d.com/viewtopic.php?t=28307&start=30 (My entry is somewhere near the bottom.)

    Enjoy!
     
  2. Lab013

    Lab013

    Joined:
    Oct 22, 2008
    Posts:
    405
  3. hai_ok

    hai_ok

    Joined:
    Jun 20, 2007
    Posts:
    193
    Just wanted to say this is a great tutorial!
    Very useful stuff!
    I have been getting great results a learning a lot from this.

    Unity's networking is abstracted very intelligently. I have made changes to this and I'm using it to develop my understanding of how all this works. I had a few questions about adding functionality to it.

    I removed the visuals from the player and I'm planning to let the user choose their player model, team and team color. Any advice on how to sync this so everyone sees what color and model I chose?

    I am studying more about RPCs so thanks for your patience!
     
  4. Lab013

    Lab013

    Joined:
    Oct 22, 2008
    Posts:
    405
    Very glad you have been able to learn a bit from this!

    What I'd do is edit the PlayerData script so that you get either 1 or 2 ints that would represent the team that the person is playing on, and the model that that person chose. Then you would sync those two ints (or 1 int) in OnSerializeNetworkView().

    You could also have it so that when the player enters a game he sends out a specialized init RPC method to everyone that would include the model and team data. The problem that is, it'd take a bit more programming (and leave more room open for error) if you wanted to have it so the player could switch teams/models in-game.
     
  5. hai_ok

    hai_ok

    Joined:
    Jun 20, 2007
    Posts:
    193
    thanks for the reply, I'll do my best!