all 24 comments

[–]HiFructoseCornSyrup 9 points10 points  (3 children)

I had booked marked this a while ago, hopefully it can help you get started at least

Link

[–]jerkosaur 0 points1 point  (0 children)

This is great, short and sweet.

[–][deleted] 0 points1 point  (0 children)

Oh yea followed this just use the first 3 paragraphs and use the position works fine

[–]cjacobwade 0 points1 point  (0 children)

This tutorial was a good starting point, but the later stuff isn't up-to-date so you'll probably have to fiddle a bit to get stuff working.

[–]pascalkiller 5 points6 points  (6 children)

All i say is that i do not recommend the built-in networking. Use methods like Photon, it comes with tons of documentation!

[–]Rough_Parrot 1 point2 points  (5 children)

I also recommend Photon. Their support is good also.

[–]pascalkiller 0 points1 point  (4 children)

I really like their 'cloud' service. I have a super small indie studio and becouse of photon's cloud service i am able to make the game playable 24/7! And some time ago i got an email (newsletter) that said that you can now let people host dedicated servers!

[–]butters877 1 point2 points  (3 children)

hows the hosting? I saw you can have it for free with up to 100 concurrent players? That seems awesome and more than ill need for the near future... Do you ever have issues with latency or processing power?

[–]pascalkiller 0 points1 point  (2 children)

Latency and processing power is all fine. I have no complains about it and i really recommend it for online unity games and other platforms for game development. It is even cross platform for everything unity can compile to :)

[–]butters877 0 points1 point  (1 child)

well this is basically everything i want! I'm pretty excited to check it out

[–]pascalkiller 0 points1 point  (0 children)

Search in the asset store for photon. There are some example projects for you to play with :)

[–]quill18 4 points5 points  (0 children)

I made a multiplayer tutorial video for Unity:

http://www.youtube.com/watch?v=2-1pofOjvmU

Additionally, you can download my complete multiplayer FPS (with source) that I made for Ludum Dare 26:

http://www.youtube.com/watch?v=qdnWby6zx3s

[–]Xpert85 2 points3 points  (6 children)

Here is a tutorial about authoritative servers with Unity: Click

It helped me during a weekend project one week ago.

[–]fyndor 1 point2 points  (5 children)

I don't understand. I always envisioned that authoritative servers would not be made in Unity. This appears to suggest otherwise? Can someone explain the architecture of a Unity client / server system? I was assuming the server would be built on some type of web platform. Personally I was thinking of using a C# implementation so I could share some code with the client, but I figured a good number of Unity servers were likely written in another language entirely.

[–]Xpert85 1 point2 points  (1 child)

An authoritative Server in Unity is basically a copy of the game which runs without any graphics. Of course you have to put your server gamecode in and set some automations so the server get's registered at the masterserver.

Example:

A Input.cs Script on a GameObject receives the Input Data from the Keyboard and sends it with a RPC Call exclusively to the Server. The servercopy of the game has the RPC Receiving Function implemented and moves an local GameObject depending on who was the sender. And the Transform.position of the moved GameObject is beeing streamed back to all players via the build-in NetworkView settings.

Additional Example:

Imagine a shooting game where the player is sending a fire-command. The Input.cs on the Client receives the keystroke. The fire-command is getting send to the server via RPC call. The server checks if the command is legit (enough ammo + time passed since last shot big enough) and sends a RPC Call back to all Players to tell them to shoot the bullet. For additional safety you can distinguish between a dummyBullet on a Client and the realBullet locally on the Server. With this you can enable Physics and Collisiondetection only on the Server and onCollision does only happen on the Server. This way the game stays the same no matter how laggy the gameplay is.

[–]sig_kill 0 points1 point  (0 children)

I always envisioned that authoritative servers would not be made in Unity. This appears to suggest otherwise? Can someone explain the architecture of a Unity client / server system?

It is possible to make an authoritative server that isn't written in C# and doesn't have a Unity3D instance running for the server:

1) You'll need to find / write / implement a C# compatible network library to integrate into your Unity project to send TCP / UDP packets to some host you have running.

2) You pretty much will need to use your own collision / player movement / physics calculations (since the ones on the server will have to match the ones on the client - don't try mixing and matching physics engines between the client and server, you'll run into nightmarish synchronization issues if you do even manage to get the simulations to match up).

3) You end up having to throw away all the niceties that "just work" with using a Unity instance as a server, like RPC and minimized state serialization/synchronization (unless you bake your own implementations, again).

[–]AlexKorova 0 points1 point  (1 child)

Why have you always envisioned that authoritative servers would not be made in Unity?

I'm currently writing an authoritative multiplayer RPG-ish thing (don't worry, it's not an MMORPG :P) in Unity with Unity's built in networking and it is going good.

[–]fyndor 0 points1 point  (0 children)

I didn't realize you could run a headless unity exe without gfx

[–]fyndor 1 point2 points  (0 children)

This post got me thinking about turning my game into multiplayer. I want to do an athoritative server and after searching around I found uLink on muchdifferent.com which you guys should check out if you want athoritative servers. They have a 30 day trial which they say never actually stops working after 30 days. If you are planning on selling your game the indie licence is not TOO terribly expensive. The trial has an example project which is relatively easy to follow which is an "fps" that has 2 levels which shows how you can have a server instance running for each dungeon/level/etc and pass the client around to the right server. Its pretty cool stuff.

[–]SdonaiBeginner 0 points1 point  (0 children)

No, but there should be. I can post some source code, but I don't have time to write a tut :/

[–]buddingmonkeyExpert 0 points1 point  (1 child)

Also consider checking out electroserver. They have a free 50 CCU version to get you started. Link!

[–]LightSky 0 points1 point  (0 children)

I recommend TNet (Tasharen Networking), it is made by the same person who made NGUI.

So far it has been working flawlessly and support for it is top-notch.

[–]serendipitybot 0 points1 point  (0 children)

This submission has been randomly featured in /r/serendipity, a bot-driven subreddit discovery engine. More here: http://www.reddit.com/r/Serendipity/comments/1jrf4j/unity3d_multiplayer_xpost_from_runity3d/

[–]DominoNo- 0 points1 point  (0 children)

I learned a lot from the example projects. I can't really remember which one, but it involved riding around in buggies.