Unity 5 UNET Multiplayer Tutorials - Making a basic survival co-op

I originally started this set of tutorials so that I could get a feel of Unity’s new awesome multiplayer system UNET. I’ve decided though that the end result of this series will be a simple co-op survival sort of game because I can! I’ve already got primitive zombie AI working across the network!

I started with the Unity 5.1 beta but now that 5.1 is released anyone can follow what I’ve been doing no problem! Please note that you should be an intermediate Unity user because I don’t explain basic concepts in this set of tutorials.

There probably won’t be any particle effects, sounds, weapon animations or any of that additional stuff in this series because it is primarily about UNET. That sort of stuff will be covered in my in development Gamer To Game Developer Series 3 tutorials.

UNET Part 2 - Rotation Syncing
UNET Part 3 - Being a bit more efficient
UNET Part 4 - Latency Simulation!
UNET Part 5 - Almost Time Travel!
UNET Part 6 - Efficient Rotation Syncing
UNET Part 7 - Unique Identity
UNET Part 8 - Shooting
UNET Part 9 - Taking Damage!
UNET Part 10 - Player Destruction!
UNET Part 11 - Player Resurrection
UNET Part 12 - Zombies!
UNET Part 13 - Zombie Identity
UNET Part 14 - Shoot Those Zombies!
UNET Part 15 - Zombies Bite Back!
UNET Part 16 - Zombie Motion Sync
UNET Part 17 - Better Spawning
UNET Part 18 - Fixing my bugs 1
UNET Part 19 - Matchmaking First Attempt
UNET Project Folder
UNET Part 20 - UI & Custom Net Manager
UNET Part 21 - Network Animator
UNET Part 22 - Host & Join Game Buttons

If you’re new to game development then see my Series 3 tutorials! You’ll build the powerful FPS system that I use in my upcoming game Weekend Drive! Over 180 videos :slight_smile:
Unity forum thread for Series 3

I’ve made a set of short multiplayer tutorials that are based on Unity’s text tutorial. They cover the basics of multiplayer.

This is the new GTGD S1 on Steam, a Unity 2017 multiplayer tutorial.

33 Likes

As usual… you sir are AWESOME! Thanks, will check things out with the 5.1 beta in a day or so

omg, thanks very much

Thanks for the encouragement! Part 4 will be ready very soon.

Could you please explain how to internet -part of UNET works? I can launch internet server only on my own computer (no other device works (don’t know why)). And again, no other device can connect to it. And there isn’t very much of documentation…

2 Likes

I’ll get to that. I’ll first implement bots after I implement respawning (video 11). Then I’ll make my own UI and show how to setup server parameters manually (such as the IP address). Btw, if you are using Hamachi then take your hamachi IP address and copy it into the Network Address of the Network Manager. This is under Network Info on the Network Manager. Then build the game and distribute it. Now others will be able to connect to your game across the internet so long as you don’t change your hamachi ip address.

Thank you Sir! (I just watched your newest video, great job as usual. :slight_smile: )

Yes, an explanation of how uNet works (vs Photon) would be amazing. Also matchmaking :slight_smile: Thank you for these videos sir.

I definitely want to implement matchmaking. My understanding isn’t sufficient at this moment to implement it, but I’m sure when 5.1 is officially released it will become clear and I’ll be able to see the pricing structure for it as well, and get a cloud project ID. If I can integrate matchmaking nicely then to me I can say to myself that UNET is superior to Photon. Already in my videos I have basic AI working effortlessly across the network, and it was easy for me to implement it, and this wasn’t as easy to achieve in the old Unity networking system nor is it easy in Photon cloud which is peer to peer and so uses a master client to try and mimic central control somewhere.

Personally I can already see UNET becoming really incredible for all manner of games, and especially RTS and turn based strategy games. If the networking system proves to be reliable then I personally think this is going to be the most significant technology that the Unity engine can offer at this current time, besides all the other amazing stuff like uGUI, mecanim, etc. Hopefully we’ll see all manner of awesome multiplayer projects come to fruition.

2 Likes

Wow, thanks for these! Now that Bolt was purchased by Photon, UNET is looking like a better candidate, it’s just mainly been a black box thus far, going go binge watch this like some House of Cards :slight_smile:

@GTGD
Awesome, as always very detailed and informative tuts, I pretty much learned mulriplayer with unity networking from GTGD,
thank you much bro.

And now the new networking i am ready to learn again from you,

quick question:
do you know if unity added the Area of Interest to UNET already in this phase 1?

they seemed to release publicly 5.1 yesterday so i wonder if they have this feature in the new networking?

they talked about it in unitite back in 2014, and it was planned for phase 1, altho in the presentation they were not already there yet.

regards

Woah! Bolt was purchased by Photon!? Interesting news (tho’ not necessarily directly related to this thread, so apologies!)

3rd party vendors still have a lot of advantages at this point, like hosting solutions, but UNet should be a robust solution, and it’s built in.

Yup it’s there though I haven’t got to using it myself. The latest documentation describes it pretty well. In the manual it’s under the section called Object Visibility. I’ve got heaps of reading, learning, and trying out to do with this new networking system.

nice,
ill take a look at that,
if you get some chance and free time, it world be great if you include this Area of Interest feature in an upcoming tutorial.

will be much appreciated.

regards

I dont know if any1 of you guys noticed, but there is something in unity 5 that really , really bothers me and maybe be a show stopper for unity instances servers.

which is when you want to run a unity headless server ie: Server.exe -batchmode -nographics
the servers or unity instances consume 10% of my cpus resources, even when the server is on idle, no mobs spawned, no players connected, complete dead server in idle ready to take simple connection. and still consumes 10% cpu resources, whats is the deal here, this wont work for unity servers, what if you need several servers instantiated in a single machine, it will just take all cpu resources without even having players connected, this will be a complete disaster.

I dont know if this is a bug or because new unity enhanced whatever , but this is useless for unity servers, a complete no, no.

unity4 does not do this, the same server in unity4 in idle in headless mode takes no cpu usage at all around 0 to 1%

so if this is the case and small price to pay using unity 5.x then i think for me i better find a third party server ie smartfox or anything else.

unless this only happens on my end??

any have experience this? if not go ahead and give it a try ad post your results, maybe it is my setup, but am running both unity5 and unity4 headless servers same scene and unity5 eats 10% cpu resources vs unity4 takes 0-1% cpu resources. on idle both.

this is not cool, not cool at all. i hope it is just a bug or my setup, because this wont work at all.

1 Like

Can you file a bug report with repro? And get me the report number? I’ll see if I can get some traction…

If you find it’s in your setup, can you let us know?

1 Like

thanks, ill do that, lets see if GTGD or any1 here reading this will test to make sure it is not only me.

I already opened a new thread about this issue in the unity support forum 3 months ago, but i guess noone read it or cared about it.

http://forum.unity3d.com/threads/linux-headless-server-on-unity-5-idle-cpu-load.319081/

there was others too complaining about this in other threads too,

anyways hopefully people here will see this and test in their system to confirm it is not only me or not.

@GraphXCreations missed your previous thread - was only looking in the 5.1 beta thread. Because of the uNet memory leak bug #698749 which made testing uNet impossible, I did see a 2% load on my server, but because the leak was so big, I figured the load issue could be part of the same thing.

My previous lidgren server had an almost zero load whilst idle, and I’d expect the same from uNet. If this isn’t the case, it does need seriously looking at.

thanks for the input Whippets, i guess i am not the only 1, so might be a real bug and not just my setup,

hopefully more will corroborate.
thanks again for testing and helping corroborate the issue.

Get a bug filed anyway :slight_smile: I concur an idle server eats far too much cpu when it should be zero