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

[Released] Authoritative Server - Valve Style

Discussion in 'Assets and Asset Store' started by StephanM, Mar 9, 2015.

  1. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    For those who are serious about multiplayer

    - Protect your game against cheating, keep players in sync, increase responsiveness, and reduce the load on the player’s machine with an authoritative game server. Based on Valve's developer network guides for multiplier networking, this package includes:

    · Server-Side Calculations - Keeps all players in sync with each other and reduces cheating by having the server calculate collisions and events.

    · Latency Compensation - Option to rewind the game to the state when an event took place (such as a player trying to shoot) to calculate the results.

    · Character Interpolation - Moves characters around smoothly instead of warping whenever an update is received.

    · Client-Side Prediction - Create a responsive experience by not waiting for a response from the server before moving. Client and Server both use the same code to reduce discrepancies.

    · Position Correction - Correct a player's position/direction when the client-side prediction made a mistake.

    · Bandwidth Reduction - Sends adjustable, periodic updates to avoid constant network traffic (~20x/second by default).

    · A very basic character, AI, and combat system for demonstration.

    · Code and Editor guides are under the Guides folder to help you get started

    · First or third person

    · 3D or 2D functionality. Interchangeable 2D controller.

    Save weeks or months of development with the cost of 1 developer hour!

    *** IMPORTANT NOTE for users and Asset Store testers: You must follow the setup guide to fix the build settings that the Asset stores strips out! ***

    For a high-level overview of what is involved, you can see the following guides:
    http://docs.unity3d.com/Documentation/Components/net-HighLevelOverview.html
    https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
    https://developer.valvesoftware.com...rver_In-game_Protocol_Design_and_Optimization

    Setup guide - https://docs.google.com/document/d/1p4NN5G4d6j9zc_ZKX_jxtlGVoZS2xbno0xN66j9s30g/edit
    Code walkthrough - https://docs.google.com/document/d/1tpGiN-WMo7P-uh7mL0SwGdEYP7cgu4Gt_jZngm-Dz4o/edit

    --- Update History ---
    1.1 - Added 2D, more accurate jumping, and first-person. Updated to Unity 5.
    1.07 - Fixed multiple client IDs, added toggles for each feature, and made clients disconnect cleanly
    1.04 - Removed unneeded DLLs and Updated Documentation
     
    Last edited: Apr 6, 2015
  2. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
  3. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Is there some docs on how this works?
     
  4. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    Documents are under Guides folder.
     
  5. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Yes. How do I read to assess the package without buying?
     
  6. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
  7. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    FYI, I'll be uploading a new version with 2D platformer and FPS compatibility with some Unity 5 kinks ironed out soon :)
     
  8. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    186
    You should also consider updating the package for UNET :)
     
  9. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    1,029
    This looks great. Do you have a Roadmap for features you're planning on adding soon?
     
  10. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    The version I mentioned earlier is live, and since then, I've been trying to finish up a game since I recruited some people, but that'll be done in December. I'll likely have simple FPS functionality and a UNet update in January. After that, master server registration (if it's still relevant), a headless server version, and a player-hosted server.
     
  11. Astrobyte_

    Astrobyte_

    Joined:
    Jun 30, 2015
    Posts:
    6
    I'm interested in your package, however i'm not quite sure how it works. What kind of networking is used? Is it unity networking, photon, or do I need to host my own server?
     
    KuPAfoo likes this.
  12. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    I'm glad you're interested :) It uses the original Unity networking with RPCs. I don't have Photon/Bolt, so I'm not sure how well they'd work together. I've emailed the dev to work together, but no response. I'm currently working on updating it to the new version of Unet, and add in Unity Master Server integration. Let me know if you have any more questions :)
     
  13. digitalzombie

    digitalzombie

    Joined:
    Dec 10, 2007
    Posts:
    82
    Hi Stephan,

    Do you have an ETA on when the update will be available? Support for 5.3 / 5.4 beta?

    Thanks.
     
  14. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    Hello Mr. Zombie, I was hoping to have it done by now, but I got a new job in December and have been trying to catch up. I'm not exactly sure when it'll be done at this point, but I'd guess some time between May and July, depending on if I do it in little or big releases.
     
  15. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    It works as-is though with the current version of Unity from what I've seen lately - just deprecated.
     
  16. spectre1989

    spectre1989

    Joined:
    Oct 6, 2009
    Posts:
    120
    I'm curious, how do you replay the client inputs after a server correction, without the ability to step the physics simulation multiple times in a frame?
     
  17. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    The built-in Unity physics is too random to get the clients/server to match to a desirable level. If you're talking about your own physics, then the ControlCommands that have occurred between when the server sent you the correction, up to your most recent command, get applied. There's a "Move" method that processes these ControlCommands by applying your forward/lateral movement, along with any physics. The ControlCommand contains a duration for each, so it knows how far to move the physics for each one.

    Let me know if you have any more questions :)
     
  18. assertivist

    assertivist

    Joined:
    Aug 21, 2016
    Posts:
    3
    Hi Stephan,

    I'm looking at trying to add a slow-projectile type attack to your server code. The projectile motions are deterministic based on the input state. Whats the best way to make sure there's latency compensation when checking the collisions of these projectiles against other players?

    Thanks
     
  19. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    Like all important events, the server should be the one deciding. What do you mean by deterministic by input state? If the outcome is determined when the player fires it, then the server can calculate the result and send it out to everyone (like CharacterHits). You would want to rewind to compensate for lag so that it appears completely accurate to the attacker (like RequestAttack). If The server needs to move it every round, then send out a new position every round (like UpdateCharacter). In this case, you would probably want everyone to have an equal amount of lag and not favor the attacker, so you wouldn't rewind.
     
  20. assertivist

    assertivist

    Joined:
    Aug 21, 2016
    Posts:
    3
    The server would move it every round after it was "fired". I think I understand what you're saying. Thanks for the tip, it's becoming more obvious how to do certain things the longer I look at the code :)
     
  21. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    Great :) Most parts of the code just do their own thing. The tutorial docs have suggestions for where to add your own custom functionality. This will all change soon for those who feel like working with the newest version of Unet. Maybe I'll include both old and new versions since they each have their own pros/cons. I miss the old RPC's :(
     
  22. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    281
    Hiya Stephan!

    I just wanted to find out if this asset is still in development, and whether or not it would work with Xbox One? Additionally is UNET implementation added?

    Thanks!
     
  23. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    Yep, still going at it. Unet doesn't use manual RPCs at all, so it's requiring me to redo the entire thing :/ It's doable though. Just taking longer than I had hoped. Next release should have Unet and Unity's matchmaking service integrated.
     
  24. Mathieu

    Mathieu

    Joined:
    Jun 13, 2005
    Posts:
    103
    I'm also interested in an update version of your Asset. Please keep us informed about your progress!
     
  25. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    Thanks :). Still chugging along, but slowly now that I have to drive in for work. I should be switching 1/2 time soon and that should speed things up. I currently have it all converted and compiling, but working out the functionality. There should be a lot fewer lines of code in the end, but I think the original RPC's were more logically clear.
     
    iddqd likes this.
  26. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    387
    Also interested in this
     
  27. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    Getting pretty close to done! Just trying to stop the characters from spinning wildly out of control when there is more than one client... As long as there's some way of preventing automatic dissemination of the transforms by the server, it'll stil be possible to make the new Unet work correctly.
     
    punk likes this.
  28. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    188
    Stephan, Your product sounds very interesting.
    Have you used it in a FPS sample project that implements the rewinding, interpolation, etc?
    If so, it would be good for your sales, likely mine, if you published an EXE showcasing those features.
     
  29. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    I've used it in my own FPS before, but haven't put it out to the public yet. It would be easy to add, but currently doing Unet, since that seems to be the most desired update. Really hating Unet, but I think it can still work. Still working on it, but slowly. I'm very sorry for the delays to the Unet update, but I'm moving to a new country soon, and there's so much going on right now. It's working for 1 Client currently, but there are some bugs with multiple Clients. The server camera spins around wildly for some reason :D If anyone would like to see the current state so you can get a feel for what the finished code will be like, send me your invoice # if you've purchased it already, and I'll send you the most recent code.
     
  30. yohami

    yohami

    Joined:
    Apr 19, 2009
    Posts:
    124
    Is the UNET version coming?
     
  31. StephanM

    StephanM

    Joined:
    Aug 20, 2013
    Posts:
    25
    That's what all the headache is about :D Unet wasn't made for detailed networking, but I'm twisting its arm to work like a proper server.
     
  32. Krambolage

    Krambolage

    Joined:
    Jan 22, 2013
    Posts:
    23
    Hi @StephanM and everybody,

    Sorry for necro posting but are there any news of the Unet upgrade ?
    I'm stuck with latency compensation on my own project, this asset would save my project :cool:
     
unityunity