Just tried the network starter demo and it comes up with same error. On connecting and disconnecting. If you connect again you get:
“ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary2[UnityEngine.Networking.Types.NetworkID,UnityEngine.Networking.Types.NetworkAccessToken].Add (NetworkID key, UnityEngine.Networking.Types.NetworkAccessToken value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404) UnityEngine.Networking.Utility.SetAccessTokenForNetwork (NetworkID netId, UnityEngine.Networking.Types.NetworkAccessToken accessToken) (at C:/buildslave/unity/build/Runtime/Networking/Managed/UNETTypes.cs:119) UnityEngine.Networking.NetworkManager.OnMatchJoined (UnityEngine.Networking.Match.JoinMatchResponse matchInfo) (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkManager.cs:1010) UnityEngine.Networking.Match.NetworkMatch+<ProcessMatchResponse>c__Iterator01[UnityEngine.Networking.Match.JoinMatchResponse].MoveNext () (at C:/buildslave/unity/build/Runtime/Networking/Managed/MatchMakingClient.cs:302)”
Like I said, using the built in stuff with UNET [right now] is beyond a bad idea. My sort-of code sample was for local testing yes, but I was just wondering if connecting again on localhost would give you trouble. The bug is that your client isn’t being destroyed on the server.
Easy way to confirm the bug - quit the application on the client instead of manually disconnecting. That should fire a proper disconnect so you can connect again (after booting up another client)
Using the network gui & network transforms? Probably not in a competitive game. The buggy movement and position interpolation probably wouldn’t be as much of an issue for a co-op game.
If you are only using syncvars, hooks, extend the network manager, make good use of commands and clientrpcs… then you’re fine. You just have to write really good interpolation and movement code if your game is going to be competitive in any way… besides a racing game.
Player makes an input => input differs from server syncvar => player invokes command to change syncvar => syncvar hook is called on all copies of the client that updates movement
Do that and you can make any game with UNET right now. Just don’t rely on the network transform. Matchmaker I haven’t tried, but clearly some users are having trouble with it.
Ok, I’ll do my best to see if I can get it to play well enough at this stage. It’s a mobile hunting game, the multiplayer part being able to run around the terrain together hunting… So just syncing animal and player position really, not even competing against each other.
No troubles then Just put a syncvar on your animals and players that determines how it’s moving. Like a synced vector3. When ever it changes, tell everyone. You can also send position data to snap things when they start to desync. That’s my approach.
Send input & position via commands, compare the sent position with the position on the server, if the player and server copy of the player are more than 0.5 units apart, I snap one to the other’s position. The size should depend on how large your objects are I guess or how far of a snap you want to have.
Do you think that using SyncVars and commands to sync object positions creates about the same network traffic as that method you whipped up? I’m looking for the most efficient way to do this kind of thing without resorting to the legacy multiplayer features.
Depending on where you put your [Commands] at. I only know what it will do, is it will spike up the network traffic no matter where you call your [Commands] to sync the SyncVars.
The idea is that anything you do yourself will probably be better than networktransform. Networktransform can be configured to be called 30 times per second. If you sync any less than that and with less complex data then you’re going to do much better.
I sync movement vectors instead of position when I can. And when the movement is normalized, like being only able to move in 4 or 8 directions, I send a number 0-7 instead and translate that to a direction on the client. I’ve done everything I can to minimize latency. I’ll have to try again sometime soon and see if the system is any better.
One trick I have learned is that you can reduce jittery motion by only syncing beyond a threshold. Have the client check the distance between their current position and their syncvar position. If the distance is greater than a certain amount then set the positions according to whatever you think is best.
1 Set local position to syncvar position - only the player experiences a movement bug
2 Set syncvar position to local position - the other players and server see the player jump a short distance
3 Set both positions to a point between the two - all players and server see the player take a short jump
If the connection is reliable or you’re in a competitive game, #1 is the best option. If you’re in a cooperative game or your connection is bad then #2 is the best option.
Network starter ERROR
i’m unable to connect over the network when using the android device and the error i keep receiving when trying to connect is error 6 and sometimes error 11 i can’t seam to pin point the exact problem
Please either make a new post, or file a bug report to Unity.
MatchMaker relies on Unity Multiplayer Services. Unless you are already using Unity 5 Pro, I would suggest you to focus on LAN connections, until you decide the Multiplayer services is crucial to your game.
Because I had the assumption that you aren’t using Pro, and is more like me using Personal Edition. In fact, I don’t even know if I’m using Unity 5 Education, or if Unity 5 Education is legible for Unity Services…
The only thing I can point you to is to use LobbyManager, and you may have to do a bit of research on your part for features you require. I never used LobbyManager before, and because I’m not using a Pro version, I’m not well-versed with Unity Services.