Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Showcase Mirror - Open Source Networking for Unity

Discussion in 'Multiplayer' started by mischa2k, Aug 11, 2016.

  1. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    ThreadedTransport early version is ready for testing! :eek::eek::eek:
    https://github.com/MirrorNetworking/Mirror/pull/3582

    ThreadedTransport can be used to elevate any of our Transports out of main thread into a worker thread.
    Starting with Threaded Kcp!

    This frees the main update loop from any transport overhead!
    Also prepares for Encryption Transport, which would be too heavy for main thread.

    2023-08-09 - Threaded Transport V1.png
     
    akuno likes this.
  3. akuno

    akuno

    Joined:
    Dec 14, 2015
    Posts:
    84
  4. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Coming up soon, before we merge.
     
    akuno likes this.
  5. tuzun

    tuzun

    Joined:
    Apr 19, 2023
    Posts:
    3
    Hello everyone,

    I try to run dedicated server with Simple Network Transport script in Mirror, in these script I enable wss and ssl, however, the server is not starting and only I disable them server starts. I also use cert.pfx and cert.json files which are included ssl certification key files. Do you have any suggestions about this issue?
     
  6. delzhand

    delzhand

    Joined:
    Jul 20, 2012
    Posts:
    26
    I have two commands on my player object:

    Code (CSharp):
    1.     [Command]
    2.     public void CmdTest(string json) {
    3.         Debug.Log("no texture2d");
    4.     }
    5.  
    6.     [Command]
    7.     public void CmdTest2(string json, Texture2D image) {
    8.         Debug.Log("yes texture2d");
    9.     }
    When the commands are invoked from a client back to back, only the version without the texture2d actually generates a log message.

    Code (CSharp):
    1.         Texture2D image = Resources.Load<Texture2D>("Textures/test");
    2.         string tokenJson = GameSystem.Current().GetTokenParams();
    3.         Debug.Log("start tests");
    4.         // Pass along to server
    5.         Player.Self().CmdTest(tokenJson);
    6.         Player.Self().CmdTest2(tokenJson, image);
    7.         Debug.Log("end tests");
    8.  
    According to https://mirror-networking.gitbook.io/docs/manual/guides/data-types, "Mirror supports a number of data types you can use with these, including... Built-in Unity types that are structs under the hood (Color, Sprite, Texture2D, Ray, etc.)"

    So how come the command with a texture2d parameter doesn't work? The test image in only 21.4kb, would that matter?
     
  7. dannypb

    dannypb

    Joined:
    May 8, 2014
    Posts:
    11
    I've been working on a space game for.... years. I am retooling using Mirror. As I set up the game, I want to have one space scene where I load objects as directed from a database on the server side and build the scene. I only want objects from that loaded scene to be visible for the current scene. Other players will be in other versions of the same Unity scene, but I want each player to only see and interact with other players and items in their version of the scene.

    I thought there was an scene or instance ID in the Network Manager, but I see now there is not. Is there a way to manage scenes like this, or do I need to use additive scenes? I would really prefer to just take the scene data from a database and load in the objects for that scene as a player jumps to another system (scene). It is how I've done it in the past.

    thanks for your help.
     
  8. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Hey everyone, for questions it's best to use #help in our Discord:
    https://discord.gg/xVW4nU4C34
    That's where the team is checking every day. The thread here is mostly just myself.
     
  9. dutarus

    dutarus

    Joined:
    Nov 23, 2013
    Posts:
    4
    I've looked everywhere on this forum and could not find any solution on this particular issue. These errors appeared after I imported 3rd party software called Hathora so I could deploy my multiplayer demo. Would anyone be to help me find a solution? I would be most grateful!:)

    I am using Unity 2022.1.7f1.

    Error code CS0103
     

    Attached Files:

  10. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Threaded Transport & Threaded KCP are live! :eek::)
    https://github.com/MirrorNetworking/Mirror/pull/3582

    Performance critical games can use this to free KCP overhead from main thread!
    The ThreadedTransport abstraction allows us to do this for any other transport too.

    This also prepares for EncryptedTransport in the future, which would otherwise slow down the main thread!

    As usual, all free & open source!
    2023-08-29 - Threaded Transport, Threaded KCP.png
     
    Last edited: Aug 29, 2023
    akuno, hopeful and mgear like this.
  11. dfaeojl

    dfaeojl

    Joined:
    Sep 5, 2023
    Posts:
    4
    love this package
     
    mischa2k likes this.
  12. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Quick progress video on Prediction for Mirror.
    - Red lines are the history
    - Green lines are the corrections

    Videos hows stepping through a recorded session for debugging.
    Not release ready yet, just showing our progress.
     
    akuno likes this.
  13. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Hey everyone, we've received a lot of questions about Godot support in the last 24 hours.
    Mirror will stay on Unity for at least another 5 years due to some larger projects coming out.
    However, we are going to take a look at Godot this week just to see how it would fit.
    You can track updates here: https://discord.gg/uQH5qG4CAZ
    2023-09-13 - Godot.png
     
    GibTreaty, no00ob, Quast and 2 others like this.
  14. MihkelT

    MihkelT

    Joined:
    Sep 18, 2014
    Posts:
    21
    Player prefab does not spawn after "Recompile and Continue playing" in Unity

    Unity is set to "Recompile and continue playing". After a recompile I host a session in Mirror using KCP transport. The player prefab is not spawned. This only happens when recompiling. If I stop the player and start it, the player prefab spawns correctly. I'm calling OnApplicationQuit and Awake of both NetworkManager and KCPTransport after recompiling so they should be in their initialized state. But when hosting a game from HUD, it says:

    StartHost: Kcp: RecvBuf = 65536=>7361536 (112x) SendBuf = 65536=>7361536 (112x)

    And then just doesn't spawn the player prefab. Normally player prefab spawns right after that log message. If I exit play mode and start play mode, it spawns correctly. This only fails with "recompile and continue playing" after code changes.
     
  15. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Recompiling at runtime was never reliable, I wouldn't use it - especially for multiplayer games.
     
  16. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Made with Mirror: UNLEASHED

    2023-10-18 - 15-00-06@2x_compressed.jpg

    From original devs of World of Warcraft, Kingdoms of Amalur, and EverQuest comes a new family friendly fantasy adventure. Fight against the forces of darkness, explore a world consumed by wild magic, and build a stronghold with your friends to increase your power in a new world.

    Lead by the legendary Brian Birmingham & Irena Pereira, Unleashed is developing their next gen adventure game with Mirror!

    X
    : https://twitter.com/UnleashingGames/
    Web: https://www.unleashedgames.io/

    Super excited to have them on board!
     
    Xaon, jesusluvsyooh, Quast and 3 others like this.
  17. akuno

    akuno

    Joined:
    Dec 14, 2015
    Posts:
    84
    That is amazing!
     
    mischa2k likes this.
  18. PixCave

    PixCave

    Joined:
    Oct 4, 2018
    Posts:
    35
    Hello, I'm making a 2D fighting game. I will publish only for WebGL. Does Mirror have WebGL support? If it runs on WebGL, how is its performance? I used Photon PUN2 and Fusion, but their WebGL performance was extremely bad.
     
  19. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    Yes Mirror works on webgl, many do webgl games, heres one picture of 500 separate connections, all moving around in browser.
     

    Attached Files:

    PixCave likes this.
  20. PixCave

    PixCave

    Joined:
    Oct 4, 2018
    Posts:
    35
    How much latency would there be in a 2D fighting game in WebGL? Photon Fusion had incredible lag. The characters were moving forward by teleporting.
     
  21. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    There is not going to be lag unless your network has lag, or your server is under too high load.
     
    PixCave likes this.
  22. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Great news: thanks to our friends at Edgegap, Mirror now ships with a built in cloud hosting plugin!
    https://mirror-networking.gitbook.io/docs/hosting/edgegap-hosting-plugin-guide

    Edgegap provides Mirror users with free 0.5 vCPU hosting, so you can launch your game into the cloud with just a few clicks.

    You don't need to deal with dedicated servers, Hetzner, Google Cloud, AWS, Virtual Machines anymore.

    Launch servers directly from Unity!



    Please beware, this is an early preview with lots of rough edges.
    If you encounter issues, please post in our Discord's #edgegap channel.
     
    akuno, Quast and hopeful like this.
  23. PixCave

    PixCave

    Joined:
    Oct 4, 2018
    Posts:
    35
    When using Photon Fusion, The reason delay is high on webgl is because webgl(websocket) cannot NAT punch through directly, it needs relay server (STUN server) for NAT (network access translations), so whats happening on webgl with dedicated server build is below:

    client <=> relay (photon cloud) <=> server/host
    and on other platforms (windows/android):
    client <=> server/host

    Is this also the case with Mirror? Will I experience severe lag like in Photon Fusion due to the intervening layers at Mirror?
    Also is there a public test server for testing?
     
    Last edited: Nov 6, 2023
  24. PixCave

    PixCave

    Joined:
    Oct 4, 2018
    Posts:
    35
    I want to test at webgl build. But i have an error as client. How can i fix?
    Unity Editor = Host
    WebGL build browser= Client
    I am clicking to Host (Server + Client) button on Unity Editor. After that, i am clicking Client button but:
    upload_2023-11-6_14-47-0.png
     
  25. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Yes and no.

    First, you have two ways to host:
    • Dedicated server (client<=>server) - this works with webgl but your server can not be webgl.
    • Player hosted (client<=>relay<=>host) - same as you do right now
    For relay, your latency is high because your player is too far away from the relay.
    For example, if I play from Germany and the next relay is in Spain, that's quite some distance for messages to travel.

    Our friends at Edgegap are solving this by having 400+ relay locations.
    In that case, not only is my nearest relay in Germany, it's also probably in Berlin which is the nearest city where I live.
    In other words, lower latency. So I'd either try this, or use dedicated servers.

    Please ask in the #webtransport channel in our discord, I didn't develop the webgl transport myself.
     
  26. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    jesusluvsyooh and akuno like this.
  27. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Friday Showcase
    Zooba recently hit 100 million downloads on Google Play.
    Made with Mirror :eek:
    2023-11-17 - 09-53-12@2x.png
     
    jesusluvsyooh and akuno like this.
  28. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
  29. pabuty

    pabuty

    Joined:
    Apr 7, 2022
    Posts:
    24
    Hi,

    When game objects are synced, are their transform synced locally or globally? I'm asking because I want to use gameobject's transform data to communicate bit-level information which may be lost in local-to-global calculations or vice versa. Is it a sensible idea to begin with?

    Cheers
     
    Last edited: Dec 8, 2023
  30. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    First Person Shooter demo is coming soon!

    2023-12-12 - 11-19-44@2x.png

    We are implementing a demo with all the features we've been working on this year:
    • Snapshot Interpolation
    • Lag Compensation
    • Client Side Prediction
    • Two-Click Hosting
    The goal is to build something super snappy that feels very responsive, similar to Quake / Counter-Strike mechanics.

    The demo will live right in the /Examples folder, no separate assets. This way we can iterate on this quickly, and always keep it up to date!

    Release: around January.
     
    Lion_C, Krull, akuno and 1 other person like this.
  31. akuno

    akuno

    Joined:
    Dec 14, 2015
    Posts:
    84
    Hyped!

    Many games today use projectile based shooting (multiple raycasts over time with projectile decay) instead of a single raycast check. Would be amazing if that could be included out of the box ;)
     
    mischa2k and Gamemakers3D like this.
  32. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    Oh I forgot to mention: we'll also test our upcoming Deterministic Physics library with this :)
    Deterministic physics will make prediction (and corrections) significantly easier.
    This is coming to open source netcode, free for all!
     
    Krull, hopeful, akuno and 1 other person like this.
  33. domsigma

    domsigma

    Joined:
    Nov 16, 2023
    Posts:
    1
    I am developing a golf game (not simulator) that is Bullseye mode, rounds have 60 seconds and 6 players only. Round time ends, the scene unloads. Players only need to see the balls that other players shoot, nothing more than it! Players avatars stays at static platforms. Have no camera movement that need to be transmitted, only the UI names above players head and the balls them shoot should be transmitted. Is Mirror the best option to it? It is Android mobile game!
     
  34. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,339
    That's a very simple multiplayer game, you shouldn't encounter any issues.