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.
Just would like to say that voting is on, so if you were able to learn a little from my project, it’d be great if you could vote for it at http://forum.unity3d.com/viewtopic.php?t=34241
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!
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.