Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Should we wait for Unity DOTS networking in our new project? Help pls.

Discussion in 'Connected Games' started by flekoun, Dec 3, 2019.

  1. flekoun

    flekoun

    Joined:
    Jul 13, 2010
    Posts:
    43
    Hi,

    we are currently in process of making a new multiplayer game. It will be RPG card game, where multiple players can connect together and venture into the dungeon, cast skills, take loot, kill monsters and disconnect.
    Now we are deciding which multiplayer framework to use to prepare our game logic/code for multiplayer solution from the beginning. As we need a DGS solution to prevent cheating(no P2P) I originally thought that we will wait for the new Unity NetCode/Transport layer, however I am not so sure now.
    What I saw from the preview the NetCode is focused on Ghosts/prediction and is using ECS. The transport layer seems very basic.
    We do not need any fancy FPS prediction for player movement, and this kind of stuff. The game should be just sending RPC calls from time to time, like Player 1 casted Fireball on Enemy3, Enemy3 healed, Player 2 lost 3 Health etc. Simulation should be done on server, clients sends inputs, server sends them results, clients display results.
    Can someone help me to understand if new Unity networking is viable solution for this? Is is possible to easily make this with current NetCode or Transport Layer? Or will it be in foreseeable future? We also do not want to host our own dedicated servers we would like to pay for this service to Unity/Whomever who will take care of this automatically based on the game load.

    Any ideas or help will be much appreciated!

    PS: Just to clarify, the DGS will be also communicating with BAAS service like Playfab, ChillyConnect etc. , this is not that important to know, but just to clarify.
     
    Quirkeley likes this.
  2. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    153
    I am not sure what a DGS is? But it looks like you're looking for a client-server solution for your card game.
    I've posted this in other places as a suggestion, take a look at www.smartfoxserver.com. I think it is the kind of solution you might be interested in.
    You can build the game logic on the server side and you get lots of useful features for match-making, managing rooms, users, chats, banning etc. The whole thing is free for 100CCU and pretty affordable if you want to scale up. For pricing check the elastic licenses, they are the most affordable.

    Edit: also check these solutions
    https://forum.unity.com/threads/wha...of-available-network-solutions-assets.609088/
     
    Last edited: Dec 3, 2019
  3. flekoun

    flekoun

    Joined:
    Jul 13, 2010
    Posts:
    43
    Hi, yes DGS is dedicated game server , so server-client architecture. I heard of Smartfox before, but had no time check it more deeply. If the Smartfox offers Unity binary running as a server, than this could be viable solutions for us.
     
  4. Aquastar

    Aquastar

    Joined:
    Jul 17, 2013
    Posts:
    29
    I have used the preview of DOTS NetCode aka FPSSample for several months. It lacks documents and requires a lot of works. But it is usable and stable in my opinion. Since you don't use prediction/ghost features, it would be more easier to implement.
     
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    A new sample is coming within a month or so and will offer more insights - it is a netcode sample with prediction and more according to Unity at latest Unite. Quite excited to try that.
     
    Quirkeley and Ryiah like this.
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    8,538
    I'm hoping for the community's sake that the new network solution lives up to the promises, but I wouldn't make plans based on promises.

    Unity's new networking is behind their originally stated schedule (if I remember correctly it was intended to be completed and ship between 2019.1 and 2019.2 based on the earliest postings on the topic), and their previous track record is releasing network API's in a buggy state, not finishing them, and then stop supporting them when they come up with another idea which they will implement a few years later.
     
  7. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    153
    Why do you need to run Unity on the server side for a card game?
    SmartFox (or the equivalent game server) should be all you need. Your game logic and state should be handled by the game server. If you want a Unity binary to run your game server code then you probably won't need another multiplayer solution.
     
  8. flekoun

    flekoun

    Joined:
    Jul 13, 2010
    Posts:
    43
    I want a server to be a Unity binary because it is 100x times easier and faster to write your game logic , both client and server in Unity using all tools unity can offer. If I had to write my server code logic in some proprietary Javascript on other platform than the development time and whole process will be much slower. The UNET solution offers this to us but it is P2P. Also new Unity NetCode in DOTS is offering us this in DGS environment. I checked the Smartfox and it will not cut it for us as the server have to be written in javascript, this is no go for us.
     
  9. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    195
    What about scalability?
    Are you running a Unity server instance per match? Per group of players (i.e. geographical region)? Or maybe a single instance to server all players?
    This is something you should worry since the beginning of your project, to avoid bottlenecks when the game will be released.

    (By the way, in SmartFox the server logic can be written in Java too, which is not too different from C#)
     
  10. flekoun

    flekoun

    Joined:
    Jul 13, 2010
    Posts:
    43
    Scalability should be solved more than enough by the new Unity NetCode solution using ECS. They bought Multiplay and use them as a server solution provider which uses "bare metal" + cloud solution to offer dynamic scalability. In our case we will run multiple instances of Unity server on a single machine. They also solve matchmaking, geo, segment players etc. These guys run service for games like Path of Exile or Apex Legends, I think they know what they are doing :) Currently the Madfinger Games uses Unity NetCode with ECS as a solution for their new Shadowgun multiplayer game.
    What I am definitely not sure about is whether it is possible to test all of this with new NetCode preview package the Unity offers as a preview package?
     
  11. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,356
    Wouldn't you just run a DOTS headless build on some dedicated machine? As far as I know, the new system also connects Unity instances, right?
    On the server machine, you want to handle as many connections you can and run as many games as possible. Even if DOTS is very efficient to run within one process, I am not convinced this plays nice when running several instances (or lots) on a single machine. This in turn means: Yes, you are faster to write your game (once) but it's more expensive to run the dedicated instances.
     
    MrsPiggy and Joe-Censored like this.
  12. flekoun

    flekoun

    Joined:
    Jul 13, 2010
    Posts:
    43
    Honestly I have 0 experience running Unity as a server. If you can help me understand why it is inferior to run Unity as Server to other solutions I would be glad. I cant see much difference if you run Unity binary or binary of some other engine on a server.
     
  13. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    153
    There are many reasons as to why a dedicated server can be way more efficient. Fundamentally a dedicated server is what name says: a software dedicated to manage 1000s and 1000s of connections and requests per second. It's quite Unlikely that Unity was built with that as a priority, considering that it does a ton of other things. Also it's very likely that the dedicated server offers you many more tools and features than what the Unity networking API does.

    There are valid reasons for both approaches (dedicated server vs. headless Unity servers) depending on what your game does, your team size and the budget of your project. Fundamentally I think it boils down to whether or not you need the Unity state on the server side or not. In other words if your server logic heavily relies on the state of the 3D world, physics, navmeshes etc... then running multiple Unity instances is likely the way to go.
    You're trading efficiency and costs for essential features you need to make your game the way you want it. If instead the game doesn't heavily rely on Unity's state you're probably much better off with a dedicated server, which can be orders of magnitude more efficient and probably less expensive as a whole. (Imagine having to run a separate Unity executable for every game room)
     
    Joe-Censored likes this.
  14. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    31
    I do not agree. Unity is putting everything behind the development of the DOTS platform. They release updates regularly and are fairly open and transparent around development. All the source code is available and extensible as well. So if it does not work for you, you can improve it.
    As far as not supporting old technologies, it is generally ludicrous to support something you and the community have determined to be unusable and problematic. The best thing to do is learn and move on. Unity has consistently done that.
    I would advise you to take a minute and think about what they are trying to achieve before promulgating fear, uncertainty, and doubt.

    DOTS is already great, it will continue to improve. At a minimum, the netcode is something we can learn from and build our own off of.
     
  15. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,311
    unity dots is not the new networking api.
     
    Joe-Censored likes this.
  16. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    31
    What are you talking about, the new networking API is DOTS. The entire structure of the netcode is such that it uses chunks on the server, and per entity on the client. It is quite literally referred to by unity as DOTS-Netcode.
    DOTS stands for Data Oriented Technology Stack, and the new netcode is most definitely developed with DOTS methodology front and center.
     
  17. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    31
    Tobiass, I am not sure how it would be more expensive. As has been said multiple times, DOTS is not about doing more, it is about doing less. Computers today are very good and executing and interrupting processes and assigning affinity to cpu's. The best thing you can do in todays world of programming is do as little work, as much of the time as possible.

    DOTS is about organization of data. - By organizing the data we are able to iterate over it extremely fast and perform mutations without needing to do expensive context switching at the OS level.

    DOTS is about bandwidth - Because we are doing less work and we have access to mostly safe parallelism and concurrency, we can do more of that less work, in even less time, and let the OS negotiate how many resources to provide us.

    DOTS is not about faster frames - Envision you have two systems, and those two systems are locked dependent on external stuff like the graphics driver and take 16ms to complete. DOTS is about all the bandwith that is available between those two systems finishing.

    So here you have it, when running DOTS on the server, you are generally architecting for doing as little as possible as fast as you can and letting the Operating System negotiate the rest. You should see that using primitives like Docker and other container systems should provide even more control over resource allocation, while still allowing the Operating System to do what is does best, scheduling interrupts and processing time.
     
  18. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    8,538
    Developed with DOTS and "is DOTS" are entirely different things. You developed your app with Visual Studio, so your app actually is Visual Studio now, right?

    Short explanation of DOTS below, and you'll notice networking isn't even mentioned.
    https://unity.com/dots
     
    g_a_p likes this.
  19. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    31
    Joe-Censored I think you misunderstand me completely, and misunderstand the concept of stacks to some degree. When I develop code with visual studio I am just simply using a tool to create. When I develop code with python the same can be said. However, when i develop "pythonic" code, I am subscribing to a style of programming that leads to a common result. The same can be said for when I subscribe to Unix Philosophy i.e. NodeJS, or when i user ObserverPattern, I write Observer pattern code.
    DOTS is a Technology Stack, that focuses on optimizations around tightly packed linear data that can be stuff into cpu caches, to put it succinctly. When discussing networking with respect to this philosophy networking is by definition DOTS.

    If i said I am building a curl command for unix, and you said well thats not unix, and i said well sir, the curl command supports
    `cat data | curl -u json.com &> e.json`
    Then yes the curl command is unixy. Even if I do not support that, I have to justify to the unix community on why it cannot be support.

    Networking in DOTS does the same thing. It states what is and what is not in line with DOTS.

    Before trying to expand your position any further please determine whether your premise has any cause for battle, you are trying to state the most mundane position, that something is not something, and I say, if it walks like a duck, quacks like a duck, it is a duck. Then you are trying to argue nuance that is not quite there, for a point that does no-one any good.

    Hope your Holidays have been enjoyable and lets work together to try to understand this new data oriented technology stack, and how networking plays into it.

    I will tell you one other thing you and others may not be aware of, the new Networking Code is only built with FPS's in mind. It may be useable for others, but that is its main function. There will be multiple NetCode packages that serve as building blocks for a variety of types of games. They are 100% trying to not make another UNET, but the process will be slow.
     
  20. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,311
    he just mean you can use dots to make a flappy bird game, its not a networking framework.
    HOWEVER, there is a networking package based on dots. its that simple.
     
    Joe-Censored likes this.
  21. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    31
    Tiny-Tree, that is what he was trying to convey. I never stated DOTS is a networking framework. My first statement was about the DOTS platform and my confidence in Unity supporting and growing it, and I followed up that statement with this "DOTS is already great, it will continue to improve. At a minimum, the netcode is something we can learn from and build our own off of." I never said DOTS is networking API, I said the Networking API or "dots-netcode/fps-netcode" for short is a part of the DOTS ecosystem.

    Joe-Censored either completely misunderstood me, or is spreading misinformation and drawing incorrect parallels to aspects of programming that are completely unrelated.

    For the final time I will put it as straightforward as possible so that anyone reading this will not be misinformed.

    DOTS is Data Oriented Technology Stack, it is a collection of base components like ECS, Job System, and Burst that enable programming of technology with memory aligned data in mind, such that we can take advantage of fast cpu's and memory efficient caches.

    The DOTS ecosystem otherwise known that the tooling is (Dots Animation, Dots Netcode, Dots Audio, Dots Editor, ... etc ).

    The new networking API, excluding the Multiplay aspects is DOTS. It uses ECS, Burst and potentially even the Job system but I cannot remember seeing Jobs, i think it currently uses main thread .run().

    If it quacks like a duck, it is a duck.
     
  22. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    31
    In summation of the post above, the new netcode is called DOTS-Netcode, here is a link to a Unity published article on it, and a short quote extracted from the link

    https://blogs.unity3d.com/2019/06/13/navigating-unitys-multiplayer-netcode-transition/

    "As you see at the bottom of the flowchart, you have many options, ranging from continuing to use UNet as-is, to targeting our new DOTS-Netcode (efficient, high-level netcode) and Unity Transport Package (lower-level networking stack)."
     
  23. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    406
    I've no idea why people are arguing about Unity headless server and dedicated servers(Photon Server, SmartFox), as they're designed for different purposes, in general, they're not an alternative to each other.

    Regarding to the topic, when are you going to release your game? If you're going to release the game within a few months but have no idea about how to make a multiplayer game, don't wait for it as you would not have enough confidence and guides about how to build a whole game based on a not battle-proven framework. However, if you're an expert and willing to build a network stack based on a transport layer, say Enet or any alternative to it, then the brand new networking repo is ready to go.
     
    Joe-Censored likes this.
  24. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    31
    As far as the OP's question, If you are just starting to build, I would recommend to build your art assets first and prototype systems with classic unity. If you need to get going right now use an existing networking framework. Ask yourself what are your limits and what are you hoping DOTS can solve, DOTS is creating a new more modular system that will be greatly improved over previous iterations however it is not there yet. At this stage it is best used if you have experience or if you have a specific goal you are trying to solve.

    I also prefer to look at it like this, I am currently on no hard deadline, I want to future proof my development. By developing with DOTS now, I am able to grow with it, and learn the ins and outs, once it is production ready, with lots of tooling, I will be able to not only quickly build asset store packages, but will also be able to put in some serious work on my project.

    Now for the quick and dirty recommendation. DOTS-Netcode now known as the fps-netcode is build for FPS's specifically. It can be used and converted, but it is definitely specced around frequent udp updates rather than less frequent tcp updates.


    I would ask you, Does your game use any sort of 3D representation of characters interacting with a world?

    If it does then you should use unity on the server to simulate, this will increase the difficult and cost of a multiplayer solution.
    If it does not, then I would recommend writing a SocketIO or similar based webserver that handles the game logic for you. You can define all your cards etcetera using FlatBuffers or JSON, and transfer that data fast and efficiently.
     
  25. olejuer

    olejuer

    Joined:
    Dec 1, 2014
    Posts:
    130
    Hi, I figure I throw in my 2 cents

    Unity Transport package
    I am currently developing a multiplayer FPS game based on the new Unity Transport package and it is basically working fine, but the high-level functionality (RPC, state sync, networked instances, etc.) need to be built by hand. I am still working with MonoBehaviour and not with DOTS, because I was afraid to lose too much time on learning DOTS. This works and is quite stable and performant, AFAICT. You will end up with very efficient network code as you will handcraft it to your needs. But it will take quite a bit of your development time and bugs in the networking code are hard to kill.

    Smartfox Server/Photon
    I have been working with both of these and I think they are both incredible. For a card game, I think it is absolutely feasible to write the server code in a different framework like Java or JavaScript. For a card game, I figure that most functionality is either server-only or client-only, as you do not have lots of 3D-world related things. If you can get along without RayCasts, NavMesh, etc. I think it is a good idea to go this way. Also very cheap.
    I want to say that it is absolutely possible to combine these providers with Unity binary servers. There is an example in the SFS blog somewhere outlining how you can go about this. To me it does not feel quite right, because you will need a dedicated hosting provider then and it feels kinda redundant.

    Multiplay/AWS GameLift
    If you do NOT go with SFS or Photon, you will need some kind of hosting provider. Unity plans to integrate with Multiplay, but for now it seems that this is still in very early stages. You cannot get development access and there is no documentation on this. Multiplay stopped their comunity service a while ago so until this integration is done, I think Multiplay has a quite a threshold to get started. Correct me, if I am wrong here, please. Really, please correct me!
    I deploy my game (again, working with Unity Transport) to AWS GameLift which does all the scaling and matchmaking for me. I am quite satisfied with it, but have not tested it under serious load. So not sure how smooth the operation will be in the end.
     
    g_a_p likes this.
unityunity