Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. 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

Assets [Networking] World of Snapshots

Discussion in 'Works In Progress' started by Reechy, Mar 5, 2020.

  1. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    Hello nice people,

    I'd like to present to you my new project called World of Snapshots(in search of better name maybe?). It is networking solution made to be simple and effective for unity based on some of the most popular techniques when it comes to data synchronization across the network for the games.

    I post this video so you can see it for yourself instead of reading these hard coded words.


    Well, that'd be it for now. Stay tuned much to come!

    Discord channel:
    https://discord.gg/grcUP46
    http://forum.nitugard.com/
     
    Last edited: Mar 24, 2020
    Slaghton likes this.
  2. GarbageCat

    GarbageCat

    Joined:
    Jul 31, 2012
    Posts:
    241
    neat, what backend are you using, also you should note almost no one is looking in WIP fourm
     
  3. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    I am using ENet while at the same time I abstracted some things in order to make switching between different backends easier.
    Hm, note taken.
     
  4. GarbageCat

    GarbageCat

    Joined:
    Jul 31, 2012
    Posts:
    241
    btw, why not demo how many CCU you can hold without colliders, it looks like alot of the CPU usage was from the collisions, also nice feature of the replay i think its unique to your solution (in unity networks)
     
  5. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    That's a good question. I am planning to eventually show how many CCU users can be connected but it really depends on the demo so that's why I am postponing that until proper demo is ready. Once I have that I am going to set up a live demo so everybody/ anybody that would want to test it will be able to!

    When it comes to the reply system, I personally really love it since it is simple as just changing the time in which the player wants to see the world(as long as he has a snapshot received for the given time) and switching back and forth is trivial like that. Since unity is working on a similar system right now it will probably include this feature as well.

    Anyway I wanted to post some news about what's going on right now with the development. Last week I spent quite some time working on custom physics engine that will be part of this networking system, finally this is the result:

    Why physics engine you may wonder? Since unity does not provide any easy ways to simulate world in the background, I'd decided to build custom physics engine. It will allow the server to play and host the game at the same time which should be a really nice feature.
    Why not use unity new physics engine(in preview)? No proper documentation/ in preview, depends on dots and a lot of other systems.

    So far I implemented GJK algorithm with EPA. I've been testing it with cubes and spheres for now and I got some really stable results.
    upload_2020-3-14_22-10-37.png
    upload_2020-3-14_22-12-53.png
    upload_2020-3-14_22-14-12.png


    Well that's all!
     
    Last edited: Mar 14, 2020
    GarbageCat likes this.
  6. GarbageCat

    GarbageCat

    Joined:
    Jul 31, 2012
    Posts:
    241
    amazing work, you could create sweet authoritative server (maybe standalone from unity ?)
    anyhow excited to see it in action:)
     
    Last edited: Mar 15, 2020
  7. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,078
    Looks nice! how easy it to use, or will it be easy to implement, do you need a server machine, or can a client act as server?
     
  8. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    Thanks. That is also a very nice idea. I am going to see whether it is something I would want to do right now, or some time later in the development since it would take quite some time. But again it is a major decision...

    Hopefully you will be able to understand what the code below does(under the hood spoiler), but that was all that was needed to be written in order to have position, rotation and cube hit state(red state) synchronized. I would say it is quite easy to use and extremely easy once you get used to it.

    Right now I am working on a server + client model which would allow playing and hosting at the same time thus the need for creation of custom physics engine.

    upload_2020-3-16_1-10-18.png
    upload_2020-3-16_1-11-17.png
    upload_2020-3-16_1-11-52.png

    As you can probably tell most of the magic happens in state data class.
     
    Last edited: Mar 16, 2020
    GarbageCat likes this.
  9. GarbageCat

    GarbageCat

    Joined:
    Jul 31, 2012
    Posts:
    241
    any chance your reliable events are internal and not dependent on the backend's reliability methods ?
    so it can be used anywhere even with raw socket
     
  10. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    That is not the case. I heavily rely on enet for reliable and other types of communication.
     
  11. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    This is just a friendly bump to inform all interested people in this project to join new discord channel. I've been working last week on this project, been going a little back and forth but in the last few days I made a lot of progress.

    Well, see you there!

    https://discord.gg/grcUP46
     
    Last edited: Mar 24, 2020
  12. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    Custom physics engine update:
    • Moved engine to ECS and Jobs which allows use of another unity great feature that is burst compiler!
    • GJK + EPA
    • Bruteforce broadphase
    • Capsule, Box, Sphere
    • Contact caching
    • Sequential impulse solver
    • Friction
    In the spoiler you can see two demos, both are running inside unity editor(which decreases performance a lot). First demo shows different shapes in action while the second demo shows 1000 cubes falling down under gravity influence.

    aaaa.gif
    aaa.gif

    That'd be it for now!
     
    SirTwistedStorm likes this.
  13. Reechy

    Reechy

    Joined:
    May 10, 2015
    Posts:
    329
    Physics engine update:
    I've improved broadphase using some popular algorithms related to BVH. BVH is constructed each and every frame and still I got more than 100% improvement over brute force broadphase for the ~500 dynamic collider count.

    upload_2020-4-9_5-21-33.png aaaaaaaaaaaaaaaa.gif
     
    Last edited: Apr 9, 2020
    GarbageCat likes this.
unityunity