A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Multiplayer' started by vis2k, Aug 11, 2016.
Is the Asset Store version the right one?
Asset Store version is fine.
Thanks everyone for the answers!
I looked yesterday into one example that uses the NetworkLobbyManager, but it used the Standard NetworkHUD thingy. That's also a reason why I made that post. I didn't know there is one with a custom one, but I will look into it. Maybe I will visit your discord as well if I have more issues.
edit: There are 4 examples in the Asset. None of them use a custom UI. All of them use the NetworkManagerHUD.
Just so no one reading this thinks this went ignored, support was handled in Discord.
Made with Mirror: SamuTale by Royall in our Discord.
I've just started using Mirror and I'm wondering: how do you usually test/debug multiplayer games in Unity? My game will be client-server so I need at least one client and one server running to test the game.
I've searched the web, but it seems most (all?) solutions aren't working with the latest version(s) of Unity. The workaround to all of this seems to be etiher to:
Copy/paste the entire project and run two Unity instances
Build the game and run one instance with the build and the other instance you want to debug with Unity/VS
Also, as the code of the server and the client is shared, how do you pass the information of "you are the server" to the server build (I'm talking about File > Build Settings... > Server build) to basically call NetworkManager.StartServer() instead of NetworkManager.StartClient()?
Thanks for the great work and the support!
Progress: fixed some bugs in the Pong demo, and added a new Tanks demo:
Build & Run it, start server (or host) in build and connect to it as client from Editor (or vice versa)
Thank you @vis2k !
I have another question. While my game is actually working (= the client connects to the server successfully and displays the "Online Scene"), the client prints an error message when it connects to the server: "A connection has already been set as ready. There can only be one." This error comes from Mirror/Runtime/ClientScene.cs:Ready:121.
What my Unity project looks like:
Two scenes: one named "LoginScene", one named "GameScene"
A NetworkManager object with a NetworkManager script inherited from Mirror.NetworkManager, it is exactly this one: https://vis2k.github.io/Mirror/Concepts/Authentication
The NetworkManager has "Offline Scene" = LoginScene and "Online Scene" = GameScene
The NetworkManager doesn't have a "Player Prefab"
I read the relevant Mirror code and it seems pretty "normal" that this error message will be printed everytime:
When the client connects to the server, OnClientConnect() is called, which in turn calls ClientScene.Ready()
When the client has successfully connected to the server, OnClientSceneChanged() is called, which in turn also calls ClientScene.Ready(), thus producing the error message
Did I miss something? Is there a mistake in Mirror's code?
Please open an issue on github and let us know exactly how to reproduce it
Our new website https://mirror-networking.com is now live!
* All important links (Github, Asset Store, Transports, Discord, ...)
* Great showcase of projects! We are insanely happy by what you guys accomplished with Mirror!
* Prepares for additional tools & services like List Server, etc.
May I use mirror in the unity 5.6. I tried the 2018.3.9 but the unity has other bugs in my project.
We need Net 4.X for websockets and some other features, there is no good way to use 5.6, sorry
Hello, friends. I'd like to use Mirror for mobile game concept. I need to quickly place List Server on my VDS server.
You can even host your own Game Server (with the ListServer scene) and have it appear in the list server.
For documentation of this is not enough. What should I do to get quick support and results?
How quick do you need it?
We are about to release it here: https://mirror-networking.com/list-server/ as soon as possible. Setting up a payment system first.
After two weeks. Maybe Paypal?
Two weeks is doable.
Check out our discord for news if you want.
I learned everything, this is what I need. I will wait for the price. Thanks.
Spawning Improvement/Fix: Previously when a client joined the world, observers wouldn't be spawned until next ProximityChecker rebuild in most cases. With this change, spawning should happen immediately. This should make for a more seamless user experience when entering the game world.
$ 30 - wow!
Progress: we fixed the last open bug in Mirror today!
Thank you for the time and work you put in Mirror!
I just found a new bug, I'd be glad to fix it if you tell me how you want to fix it (there are multiple ways to do it). https://github.com/vis2k/Mirror/issues/639
Thanks for the excellent work for the Mirror!
A small advice:
In the NetworkManager:
public bool startOnHeadless = true;
The default true should be set to false, or just delete the function about start server codes in the Start ()
First time I didn't know it. Everything is fine in the editor. But after I build the project and start in Headless mode. It started server automatically, then in my code initialize the project and get available port for the server and start the server again. And the ignorance loged that I have already start the server and with default port 7777. At the beginning, I thought it's a bug. Then I found the problem of start automatically on headless mode. So I think it should be changed.
I would realize a little non-commercial project (for school purpose): i wanna create a game which could be played with 4 android mobile devices and a PC which will act as a central stage/monitor for all the player.
To explain, every player should be able to give answer to a quizz displayed on the PC screen (example: Kowledge Is Power on PS4 with the PlayLink concept).
I need some help to know where I am supposed to begin.(warning: I'm a big noob, i'm more a graphic designer than a real developer).
Do you have any tutorial which will help me to make this with MIRROR?
Thank you very much.
Mirror has a documentation and several smaller, easy to understand example projects come with it.
Do the examples demonstrate all the features of Mirror?
All components are used in them, yes.
I'm currently making a game and I need to decide between Mirror & Photon PUN2.
I have a few questions:
- Why should I use Mirror over Photon? How much $$ would that save me?
- First post says server-client are one, how exactly does that work? Do I need to start the game on the server?
Mirror is free no matter how many users you have. However the cost of the framework is only a minuscule portion of the cost of making a game. Your biggest cost will be how much time it takes you to build the game. Pay attention at the features offered and what kind of game you will built, then pick the one that satisfies your needs.
You have one single project. When you run it, you can decide if it is going to run as a server, client or both (host mode). In addition you can make a headless build and it will run as a server that clients can connect to.
What if my game has a 1v1 game-mode? Do I have to start A LOT of server instances manually or is there anything that will do it for me?
making some assumptions here:
You want 1v1 match making? everyone connects to the server, it matches you with someone and then you fight it out?
You can certainly do it with Mirror, when someone connects you put them in the lobby, once matched, you make them as ready. The same server could be doing many matches at the same time.
I believe PUN2 has that functionality out of the box. In my humble opinion the matchmaking will be easier in PUN2.
What else do you need?
I don't get this part, I already have Match Up asset which will do the matchmaking stuff for me, how can I possibly have multiple games running in a single mirror instance? That looks like a very hard thing to do using mirror. If you meant connecting users to each other, I have no idea how to open port programmatically for connections.
I'm having trouble implementing a SyncDictionary. Could someone check out my thread here and see what's wrong? Between UNET documentation, Mirror documentation, and random forum posts, I can't figure out how to initialize the values of a SyncDictionary for clients.
I'm experimenting some jerky/strange behaviour, not sure if it's just one bug of the version or the websocket transport, but happens on every thing on the network:
If I set an int SyncVar from 0 to 1, it appears to be 0 on some frames, making totally unrealiable/useless.
Same happens for the network transform, it interpolates reaaally bad, like laggy. Same for the network animator.
I'll try to post some gifs later.
feel free to open an issue on our github page with steps how to reproduce it
I continue to develop my game with Mirror, and I have a question about the usage of networked game objects, NetworkIdentity and authority.
I'm trying to use only RPCs (and no network messages) as it seems it is the recommended way.
What I want to achieve: call an RPC from the client to the server in a non-player GameObject.
Here is what my game looks like:
CharacterCreationManager [Empty GameObject]
NetworkIdentity [Script Component] -- "Local Player Authority" is checked
CharacterCreationManager [Script Component]
CLIENT: LoginScene shows up, the user types their username/password and click "Login" button
SERVER: checks the username/password in OnServerAddPlayer() and if they are correct, sends a SceneMessage("CharacterCreationScene") to the client
CLIENT: CharacterCreationScene shows up, the user types their nickname and click "Create" button, C.F. below
public class CharacterCreationManager : NetworkBehaviour
public InputField NicknameInputField;
public void OnCreateButtonClick()
NetworkIdentity networkIdentity = GetComponent<NetworkIdentity>();
private void CmdCreateCharacter(NetworkIdentity networkIdentity, string nickname)
However, when I click on the button, I get the following warning and the function isn't called on the server:
Trying to send command for object without authority.
So I have two questions:
Why can't I call a RPC even if the "Local Player Authority" is checked on the NetworkIdentity component of the GameObject? How can I fix this problem?
What would be the recommended way/pattern to do what I'm trying to do (if I'm not doing it the right way)?
Thank you so much guys!
Mirrors are a great asset.
I was really impressed with this asset. best!!
I am trying to put a multi into a sandbox game using a mirror.
However, I faced great difficulty.
I was not good at synchronizing the world.
The world is stored as a class type and is declared as a 2D array because it is a 2D world.
However, when I read the documentation, I could not find a way to synchronize the class types.
When you play a multiplayer game, you need advice on how to make the terrain the same.
We need advice on how to efficiently synchronize class information.
I am not a person living in an English-speaking country, so the question may be strange.
Sorry, please understand.
I will wait for your answer.
Short answer is: you don't. The correct pattern is to have all the code that communicates player actions / inputs on your player prefab. That means when you open a UI from your player you need to subscribe to the UI events in your player code.
Stop by our Discord to get faster help.
Has anyone gotten Mirror to run on 2019.2 alpha in a hybrid ECS mode?
Internal improvement: previously, UNET would send a spawn message for each entity, then afterwards one additional OwnerMessage to let the client know which of the entities is the local player. This was a huge bandwidth overhead (especially if it takes one extra TCP packet) and caused race conditions where isLocalPlayer may or may not be set in Start() already.
We fixed it by storing the owner information in the spawn message directly. No more extra packet, no more extra code path, no more race condition.
Nice find @goldbug
We highly recommend using Unity 2018.4 LTS when it's released. Even 2018 isn't stable yet, I wouldn't bother with 2019 for a game server. It needs to be stable.
Cecil Update: the Weaver originally used Unity's older custom Unity.Cecil version to replace IL code for Rpcs/Cmds/Serialization.
Today we upgraded it to the latest official Cecil 0.10.3 ( https://github.com/jbevain/cecil/ ) thanks to c6burns .
This should give us several important bug fixes for the weaver, as well as peace of mind because there is one less magical part in the chain.
We also fixed one recursion stack overflow bug in Cecil today, which allows us to further dig into yet another Weaver bug.
I started using this as an alternative to UNET
I want to use multiple clients for different purposes.
Can not use multiple clients connected to different servers?
After the client disconnects from the server and reconnects, the client receives exceptions such as:
What do you mean exactly?
Please open an issue on our github and let us know exactly how to reproduce it
What's the flow to send login credentials from client to server, then check it on the server, then send OK to login to the client? All before spawning all the network objects.
Explaining that on the docs would be interesting I think.
Thank you for your reply!
I want to use multiple clients for different purposes at the same time.
So,It is not good to reconnect after disconnecting one of the connections.
My implementation is as follows by UNET.
public NetworkClient myClient1 = new NetworkClient();
public NetworkClient myClient2 = new NetworkClient();
NetworkClient is a singleton in Mirror. There can be only one.
That said, perhaps there's a better way to accomplish what you need.
No, that will just delay the player object being spawned until authenticated. He wants to do authentication before any objects, state and other information is distributed. Essentially isolated.
Just wanted to say THANK YOU for all the development effort behind Mirror! I'm just getting up to speed with game development and made a multiplayer local co-op prototype that I wanted to transition to drop-in online/local hybrid. I have to say I felt like I was in a tough spot between the upcoming (and largely undocumented) new networking API and UNET being deprecated.
I liked what I saw of UNET but didn't want to learn an abandoned platform... so decided to get up to speed on Mirror and I'm really liking it so far! I was a bit saddened (initially) to see the drop of playerControllerID for having multiple controllers per client as I'm intending on drop-in local + online coop. I might suggest you remove the reference to that in the docs here since that tripped me up for a while: https://vis2k.github.io/Mirror/Concepts/GameObjects/SpawnPlayerCustom until I found your posts mentioning removing it.
The solution I've developed so far is to use spawn an empty as the playerPrefab (representing the client) that has a script on it that can spawn however many local player models as game objects with client authority. It seems to be working great so far. I may put together a tutorial of the process once I get the kinks ironed out if anyone else ends up in the same situation.
I'm also very interested in your List Server product once I get this project farther along and will likely give it a try. If you ever plan on adding punchthrough (or even some general guidelines on how to achieve that) that would make it even more valuable.
Anyway thanks again!