Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Showcase SUPER NETCODE - Networking Made Simple

Discussion in 'Multiplayer' started by SVTeam, Dec 28, 2020.

  1. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10


    About
    Super Netcode is an easy-to-use networking solution for Unity for programmers and non-programmers. It comes with code examples, YouTube tutorials, and support from the developer. Entire source code is included without DLL's, it works with IL2CPP, .NETCore and can be compiled without Unity for standalone fully authoritative dedicated servers. Connections can be established across different platforms including Mobile and PC. You host your own servers, there are no hidden fees or plans, once you have the netcode you have everything you need.

    Low Level Transport
    At its core is the low level transport over UDP written from scratch which supports reliability, encryption, authentication, compression, P2P, Mirror compatibility, accurate timings, and much more. To get familiar with the API, check out the documentation and examples that come with the asset. If you're comfortable with coding, you can only use the low level transport and write your own spawning and synchronization logic, or you can use the provided network component system that was built on top of the transport.

    High Level Network Component System
    With the network component system, you can easily spawn and synchronize transforms, rigidbodies and animations with no coding required. There is no distinction between servers and clients, the system allows any kind of network architectures including mesh networks, you just need to decide which peers get authority over which objects, and the system does the rest. There are several already written components for you to use for synchronizing transforms, rigidbodies and animations. These components use smooth interpolation and only send updates when necessary to save on bandwidth. You can also extend the system by writing your own components which handle synchronization in the way you want. For a quick start guide on how to use the network component system, check out the youtube tutorial.

    Support
    Since we use the netcode in our games, we plan on maintaining it, adding features and offering support for the indefinite future. So go ahead, get the asset, try it out, and if you have any questions, suggestions, or if you just want to showcase what you've done with it, feel free to use this thread, discord, email, or add me on discord directly (Casper#8159) and i will help you out.
     
    Last edited: May 21, 2021
    blueivy, Cathair, DhiaSendi and 4 others like this.
  2. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    This looks incredible!

    How does input works? Is it server authoritative?
    Any input predictions & rollbacks?

    Is there any lag compensation, reconciliation?
     
    BetaMark likes this.
  3. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10
    Yes, you can build and run your own servers. There is no distinction between servers and clients within the netcode itself, you can do anything with the received messages, so if you're writing a server, the server would handle assigning authorities, spawning players, relaying messages, etc. It's completely up to you how you want to use it.

    If you're using a character controller to move the player locally, you can add a network transform component on it, give it authority and it will synchronize itself across the network on every peer that has the same player spawned. You can also automatically spawn players using the spawner component. If you want to send custom messages, you can either do it via the low level transport which sends global messages, or the network component system which sends messages directly between components.

    The network transform component does both interpolation and extrapolation based on the data it receives. Depending on how you configure it, it will attempt to predict future positions in cases where there are lost or delayed packets, or if the configured delay is larger than the round trip time. If too much time elapses without any updates it will rollback to the last known position and wait for updates there. This results in perfectly smooth movement even on bad network conditions both for transforms and rigidbodies.

    Because the transform component uses accurate timings, any minor lag spikes will not effect the movement of the object as extrapolation/prediction will kick in and compensate for it. This also means all peers will see the object in the same position regardless of what their RTT/ping is. So if you do hit detection on both the client and the server, the differences should be minimal.
     
  4. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10
    Version 1.5 released.
    • Stability improvements and bug fixes.
    • Arena example now uses Component System with a few physics objects players can kick around.
    • Much better compatibility between Low Level Transport and High Level Component System so both can be used together.
    For a full list of changes, see the changelog.
     
  5. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    286
    It may seem difficult, but I hope WebGL will be supported in the future.
     
  6. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10
    There are several features planned, and one of them is indeed WebGL support. It's still a while until it gets added, but once it does, Low Level Transport will use either WebSockets or WebRTC internally for WebGL builds. Out of those two, WebRTC seems like a more likely candidate as it can work via UDP.
     
    gtk2k likes this.
  7. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    286
    How many max people can be connecting at the same time?
     
  8. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10
    You can have as many connections as your machine can handle. The Low Level Transport has been tested to work with over 10k encrypted connections on a small VPS (t2.micro on AWS).
     
    Hojou and gtk2k like this.
  9. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10
    Version 1.6 released.

    Low Level Transport remains mostly the same with the biggest improvement being the calculation of timestamps of timed messages. This will now drastically reduce jitter on network transforms.

    High Level Component System internal messaging system has been completely rewritten and simplified. You can now safely connect multiple clients together into a mesh network for faster delivery of messages. Even if the network you have created contains cycles, the system will detect them and stop packets from looping forever. For example, if you have a classic server/client architecture, you can also connect several clients directly to each other via P2P which will allow the system to deliver packets much faster rather than packets going through the server.

    A new NetworkAuthority component has been added that can manage authority over several components for you. The update also includes several bug fixes and improvements. For a full list of changes, see the changelog.

    As always, if you have any questions, suggestions or feature requests let me know, i'm happy to help.
     
    Joe-Censored and gtk2k like this.
  10. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738


    Hello, I am finally thinking of getting Super Netcode for my next project, can I see a video on how accurate lag compensation is for collider hit detections on various simulated latency/packet loss? If this works nicely, it will be worth getting to cut down a lot of complications and production time on the netcode side for competitive shooters!
     
  11. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10

    Here is a video showcasing interpolation, rollback mechanisms and lag simulator. Version 1.7 with these features should be published in a couple of days.

    To make lag compensation more accurate, you can increase the send rate of your transforms which will result in more updates being sent and more accurate rollback, but your transform will consume more bandwidth as a result.
     
    elias_t, Gekigengar, zyzyx and 2 others like this.
  12. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    286
    Good Job!!
     
  13. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10
    Version 1.7 released.

    With the new lag simulator found in the NetworkHost inspector, you can simulate latency and dropped packets to test how your game performs under bad network conditions.

    NetworkManager now has a rollback mechanism which allows you to rewind time on transforms to a particular time in the past. This is useful for lag compensation on servers when resolving hits received by clients. When the server receives a hit, it can rewind time to when the hit was made, check if the hit is valid, and then continue.

    NetworkSpawner can now be optionally used by anyone on the network which allows you to spawn a player object without any code. Just place the player onto the scene under the spawner and the spawner will do the rest.

    NetworkAuthority can now resolve authority ownership in mesh networks. This allows you to connect players together via P2P and automatically resolve authority without any central servers or code. If you have physics objects such as cars or boxes or other interactive networked objects in your game, authority ownership over them can be easily transferred between players.

    Vehicles and NPC's have been added to the Arena example and players can spawn them in the escape menu. The code has been significantly simplified to make it easier to learn from. When you touch a physics object, you claim authority over it which makes the physics object react instantly without having to wait for updates from the network. Similarly when you enter a car, you instantly claim authority over it which allows you to drive it around.

    Several games are in development using the netcode, some of which the developers have shown footage and screenshots for on our discord. If you're working on a networked game, feel free to showcase it, it helps prioritize what features to add.

    For the next version I'm going to look into adding WebGL support.

    If anyone has any questions, suggestions or feature requests, you can ask here on email or discord. I'm happy to help, and it improves the netcode :)
     
    DungDajHjep, elias_t and zyzyx like this.
  14. bvonline

    bvonline

    Joined:
    Feb 27, 2021
    Posts:
    84
    I am interested in your asset. I am not familiar with multiplayer games, and I am not a programmer, but understanding logics quite well. I am searching for a solution for a multiplayer game which offers me the useage of my own server, and a tool which helps me to add multiplayer functionalities by the inspector, or maybe for example by NodeCanvas or Playmaker (I own both).

    Is there a way to use your asset without the need of coding (simple use cases), by using NodeCanvas or Playmaker? Or are there already functionalities in the asset which would that make possible or will these be integrated? (I have read your asset description and documentation partly, but wanted to ask directly in detail before buying. Thanks in advance!
     
    Last edited: Jan 17, 2022
    Lars-Steenhoff likes this.
  15. SVTeam

    SVTeam

    Joined:
    Jul 2, 2017
    Posts:
    10
    Thank you for your interest. You can already synchronize objects without any coding by using high level components such as NetworkTransform which automatically synchronizes position and rotation for you. All you have to do is establish a connection using a NetworkHost which can be done by calling NetworkHost.Connect with the address you want to connect to. That should be possible with Playmaker or NodeCanvas too so a multiplayer game where you can start a server or connect to one via its IP is relatively easy to make. If you'd like to have server/room/lobby list or matchmaking however, that might require some coding for now, but an easy solution for that which will hopefully require no coding is planned too. If you need any help with networking feel free to drop by on discord, send an email or use this thread, i'm happy help :)
     
  16. dreamhst7

    dreamhst7

    Joined:
    Mar 27, 2014
    Posts:
    13
    Hello! Great job! Is there relay support? Can you link to a video where you explain how to use your system with dedicated server? Can I use your system for MMO? if so, then how many online users can one server support? If users don't have a real IP how can they connect?
     
  17. Eros96

    Eros96

    Joined:
    Sep 26, 2019
    Posts:
    29
    Hi, can I use your system for Virtual Reality?
     
  18. alvaromagnum

    alvaromagnum

    Joined:
    Dec 3, 2017
    Posts:
    13
    When there will be a new version? Does it will support webgl?
     
    Barritico likes this.
  19. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
     
  20. Cathair

    Cathair

    Joined:
    Mar 23, 2022
    Posts:
    3
    Could you please provide more details regarding how does it compare against the "Netcode for GameObjects"? What does it do better?
     
  21. vastark13

    vastark13

    Joined:
    Mar 22, 2020
    Posts:
    5
    What's mean Per2Per ? it's mean if i have 2 laptop and 2 different internet connection with 2 different Public IP , i can send messages directly between this two laptop with Super Netcode ?
     
    Last edited: Oct 26, 2022
  22. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    p2p is a multiplayer game architecture.
    On a p2p game, instead of having a server that manages everything, every client does its own calculations (Like their movement) and tell the other clients what they made.
     
  23. vastark13

    vastark13

    Joined:
    Mar 22, 2020
    Posts:
    5
    i know this , but i mean i run p2p sample on my laptop , i am in Berlin, and my friend is in Italia and he run p2p sample on his laptop, i give him my public IP and he give his public IP to me , and we click connect together in same time , we see message connecting ..... but after 5 sec it show "Request Time Out" and we not connect together !!

    what's wrong ???

    we also set our port number same & not same but not work.
     
  24. vastark13

    vastark13

    Joined:
    Mar 22, 2020
    Posts:
    5
    i know this , but i mean i run p2p sample on my laptop , i am in Berlin, and my friend is in Italia and he run p2p sample on his laptop, i give him my public IP and he give his public IP to me , and we click connect together in same time , we see message connecting ..... but after 5 sec it show "Request Time Out" and we not connect together !!

    what's wrong ???

    we also set our port number same & not same number but not work.
     
  25. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    The host would need to port forward, but this is not suitable for a game, so a relay would be a good idea. I dont know if super netcode has a low level transport for that, but here are the most popular relays:
    -Steam relay: It requires you to pay a 100$ one time fee.
    -EOS relay: Is completely free.
    -Photon realtime: The charge you based on CCU (Concurrent users)
    -Unity Relay: I dont know anything about it.
     
  26. vastark13

    vastark13

    Joined:
    Mar 22, 2020
    Posts:
    5
    Thanks , but I need a way to send messages from my computer to my friend computer directly, I don't want to use any host or server between. I need a P2P connection ( direct client to client ) with public IP address , is that possible ?
     
  27. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Port forward.
     
  28. vastark13

    vastark13

    Joined:
    Mar 22, 2020
    Posts:
    5
    what is that ? how to do it with unity ? is there any library ?
    i think it's not possible to connect two laptop or two mobile phone together in internet , with public IP .
     
  29. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    That has to be done on the host's router, is not anything unity specific.
    Basicaly, when your friend tries to connect, the router will block it, but if you open the port your game uses, your friend can connect using your public ip.
    How to do that is very router specific, so I cant help you with that.
    Thats why I said you to use a relay, which allows you to connect with an id, much more simple.
     
  30. alvaromagnum

    alvaromagnum

    Joined:
    Dec 3, 2017
    Posts:
    13
    Hello everyone. Can you help me?

    THE CONTEXT:

    Hi, I have a multiplayer game composed of 5 Scenes.

    On scene 1, the hosts are created: one server and one client (connected to the server).

    Through scenes 2 to 4, players just have to make some configurations to be used in the game (scene 5). Only in scene 5 are network objects synchronized (transforms through network transform scripts). The objects are already in the scene, they are not spawned/instantiated through code. There are no authorities, yet.

    In scene 4, before loading scene 5, the hosts exchange messages to synchronize data and define who is going to be the authority of each object in scene 5. There are 5 objects.

    On the Start method of scene 5, the authority is configured: four objects to Host/Server and one object to Host/Client.
    Till now, everything is ok. Hosts are connected, and data is synchronized. The Host/Server receives a message saying that it has authority over 4 objects and the Host/Client receives a message showing its object. All Ids are correct and are the same on both sides.

    THE PROBLEM:

    The Host/Server can move its objects, but the movements are not synchronized over the network (on the other side).

    The Host/Client can move its object, but the movement is not being synchronized over the network (on the other side).

    All the objects are behaving like in local mode/play, just on one side.

    Do you have any idea of what is happening? Thanks for the help, in advance.
     
  31. bvonline

    bvonline

    Joined:
    Feb 27, 2021
    Posts:
    84
    i think the developer is dead...
     
  32. MrBigly

    MrBigly

    Joined:
    Oct 30, 2017
    Posts:
    221
    do you mean he died or the business closed or what exactly?

    Also, does anyone know how the UDP traffic is encrypted? There is an industry standard way, but it requires implementation. Just curious because I was thinking of this for my own netcode as well.
     
  33. bvonline

    bvonline

    Joined:
    Feb 27, 2021
    Posts:
    84
    If he doesn't respond the chance is very high that he is dead. But, I think I noticed a price change in 2022 (5$ up), which could mean that the developer is no more active or not interested in giving support. His last posts have been also in 2021 on Discord. Since then nobody heard anything anymore from this guy... only left members on the discord channel might be able to help - or you will get lost in problems if nobody can help you...
     
    Last edited: May 13, 2023
  34. pixelcardgame

    pixelcardgame

    Joined:
    Jun 11, 2023
    Posts:
    1
    I'm really upset man. There is no decent easy Unity multiplayer solution

    Everything has to be an absolute pain for multiplayer

    Either that or you PAY
     
  35. Lukeesta

    Lukeesta

    Joined:
    Jan 7, 2016
    Posts:
    78
    What's the problem with paying? You pay for Unity as well. And same as Unity, most multipayer solutions only ask you to pay when you get succesful.
     
  36. MrBigly

    MrBigly

    Joined:
    Oct 30, 2017
    Posts:
    221
    That isn't true. If I build a PvP free to play with absolutely no revenue from it, I don't pay anything for Unity, but I would have to pay for CCU with Photon's servers in one flavor or another.

    I plan to publish a title that the PvP is free and no revenue from it, while the campaign is a separate product that is purchased. This way I can come out with three or more campaigns (trilogy) while independently evolving the PvP on an entirely difference schedule.

    In addition, Unreal does not cost the same as Unity. At scale, Unreal is essentially free in comparison. That and the fact that they have so many features more advanced and built in (including netcode) from the start is leading me to lean toward moving my development to UE5.
     
  37. DetectiveJosh

    DetectiveJosh

    Joined:
    Oct 22, 2016
    Posts:
    6
    NGO is free and built into Unity. You can also look at Fish-net or mirror. They are both free too.
     
  38. MrBigly

    MrBigly

    Joined:
    Oct 30, 2017
    Posts:
    221
    Given some of the problems NGO presents, and the massive work around for both coding and 3D modeling for some of those problems, I believe rolling my own has the benefits of (1) taking less time to implement than working around NGO, and (2) the game design reflects a more correct design approach.

    Fishnet is also still in the crib. i don't think i would benefit time wise turning to it.

    Mirror is very interesting, but I feel from what I saw it is not mature and, as the others, requires me to think like the authors of Mirror think.

    At the heart of every solution or framework are assumptions about how data is to be sent across the wire and what data should go when. It makes a lot more sense to me to have total control of those decisions from the ground up rather than adopt someone else's view on the matter.