UNet Sample Projects

Attached to this post are some sample projects for the new networking system. These projects all use the High Level networking API.

Warning, these contain programmer art and are not pretty at all.

2dshooter - is a 2d shooter game, use arrow keys and space bar, start with the “start” scene.

tanks - is a 2d tank example, use mouse and arrow keys, start with the “title” scene.

Invaders - is a 2d arcade game, use arrow keys and space bar, start with the “StartMenu” scene.

NetworkStarter - is simple 3d with boxes, it uses the multiplayer lobby and does scene changes, start with the “lobbyNewGUI” scene.

move - is a simple 3d client movement test, use arrow keys and space bar, start with the “ballz” scene.

2150377–141926–Invaders.zip (106 KB)
2150377–141932–2dshooter.zip (1.79 MB)
2150377–141933–move.zip (59.1 KB)
2150377–141934–NetworkStarter.zip (258 KB)
2150377–141935–tanks.zip (888 KB)

23 Likes

I tried the ‘tanks’ and ‘networkstarter’ projects and they only spammed error messages. Do these work for anybody else?

1 Like

That message is a bug that is fixed in the first patch release 5.1p1. The sample projects still work even with that error message.

transport layer demo:

2152760–142124–llapi.zip (23.1 KB)

3 Likes

Considering how powerful and advanced Unity is, these samples are pretty disappointing (I know unet was just released).

At a bare minimum I would like to see something like these

  • Player movement smoothing techniques (besides lerping). I’m not sure lerping is a viable smoothing technique. When I have tried using it in the past, it gives an “ice skating” effect, which isn’t good for humanoid type characters. I would like to see more about interpolate and extrapolate options (such as with PhotonTransformView).

  • Mecanim animation (and possible smoothing). I have found the NetworkAnimator component. Which has this very humorous doc page http://docs.unity3d.com/Manual/class-NetworkAnimator.html

6 Likes

well, here is one more complaint, sorry but this dont work.

i have tried NetworkStarter.zip project and i can only connect with 1 client, the second wont even connect console debug wont throw any errors,
even raising the max players setting on lobby manager still wont let you connect a secon dplayer.

I hate to say this but like erebell55 said in the post above the demos are quite disappointing, seems that it is not working for anyone, unless we are missing some steps like saying a magic word before clicking play?

1 Like

I can launch Network Starter, I built the game and launched it twice. Host with the first and join with the second. Eveything is fine, movement are the same on the two instances of the game BUT the boxes are not at the same place in each games.


Will there be any examples showing the HLAPI without using the all in one “NetworkManager”?

The MasterServer sample does not use the NetworkManager.

Is there something else you were looking for?

Well I am looking for an example where http://docs.unity3d.com/ScriptReference/Networking.NetworkServer.html and http://docs.unity3d.com/ScriptReference/Networking.NetworkClient.html are used similar to the master server sample but instead simpeler without hostlists, but more as a dedicated server setup.

1 Like

The NetworkStart projects uses the NetworkProximityChecker on the boxes. So players can only see boxes that are near them.

Invaders seems to have some pretty major bugs. Everything looks fine on the Server instance, but the client is totally broken, with the enemies scrolling off-screen and the players ship wildly flying all over the place.

1 Like

I’m having trouble using Match maker on Android (both with these example projects and otherwise).

I loaded up 2dshooter and gave it my Cloud Project Id in the PlayerSettings. If I load the start.unity, run it, click Enable Match Maker, click Create Internet Match, I get success JSON response on the log and the game begins.

However, if I switch to Android platform, build it up, run it, do the same sequence as above, after clicking Create Internet Match I end up with:

I/Unity (20567): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
I/Unity (20567): Failed to read the ID for the match maker, please set the Cloud Project ID string in the Player Settings (see https://unet.cloud.unity3d.com)
I/Unity (20567): MatchMakingClient Create :https://mm.unet.unity3d.com/json/reply/CreateMatchRequest
I/Unity (20567): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
I/Unity (20567): System.FormatException: FAILURE Returned from server: FailedCreateMatch for appId=Invalid
I/Unity (20567): at UnityEngine.Networking.Match.Response.Parse (System.Object obj) [0x00000] in :0
I/Unity (20567): at UnityEngine.Networking.Match.CreateMatchResponse.Parse (System.Object obj) [0x00000] in :0
I/Unity (20567): at UnityEngine.Networking.Match.NetworkMatch+c__Iterator0`1[UnityEngine.Networking.Match.CreateMatchResponse].MoveNext () [0x00000] in :0
I/Unity (20567): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
I/Unity (20567): JSON Response: [[UnityEngine.Networking.Match.CreateMatchResponse]-success:False-extendedInfo:Failed CreateMatch for appId=Invalid]-address:, port:0,networkId:0x0000000000000000,nodeId:0x0000,usingRelay:False
I/Unity (20567): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
E/Unity (20567): Create Failed:[[UnityEngine.Networking.Match.CreateMatchResponse]-success:False-extendedInfo:Failed CreateMatch for appId=Invalid]-address:,port:0,networkId:0x0000000000000000,nodeId:0x0000,usingRelay:False
E/Unity (20567): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

So it seems like I wouldn’t have set my Cloud Project Id… but when I added

Debug.Log("Cloud Project ID: " + Application.cloudProjectId);

to the ShooterNetManager.Start() it prints exactly correct cloud project id.

Any ideas? Anyone tested this with Android? Or iOS or WP8?

2 Likes

What’s missing is the appId. I had to manually set it. Its the UNET ID underneath the Cloud project Id

NetworkManager.singleton.matchMaker.SetProgramAppID((AppID)XXXXX);

3 Likes

Thanks, that helped with the match maker.

Has anyone got the new Unity 5.1 Multiplayer features connecting multiple computers over the Internet?

Yeah. I’m currently connecting Editor, Android and WP8 over the internet using the match maker.

Edit: take the 2dshooter project posted above, input your Cloud Project Id (Edit → project settings → player) and you should be able to connect multiple desktop clients to each other over the Match maker.

Connecting Android and WP8 with Match maker seems to currently require SetProgramAppID method call Evil Otaku mentioned.

1 Like

I’ll give that a try thanks gilead.

Hey everyone, I was wondering if anyone knows of a live-chat (IRC etc.) community where people can share their bugs and experiences with UNET? (specifically for UNET and nothing else). For example, I just discovered that upgrading from 5.1.1p1 → 5.1.1p2 was the reason my editor was crashing when trying to use the free-tier match-making system.

Thanks!

FYI there is an IRC channel now on irc.freenode.net (#unity3d-unet). Also, some shared resources are gathered here:
https://goo.gl/UmBBpM