Announcement

Collapse
No announcement yet.

Dedicated Servers, Jitter, Matchmaking

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dedicated Servers, Jitter, Matchmaking

    Hello fellow UE developers.

    I'm currently trying to setup network for an online racing game. However I stumbled upon a variety of problems. I would appreciate If someone could share their wisdom and shed some light.
    All questions below are related to Dedicated Servers.

    I) I would like to implement a matchmaking system similar to how Dota2/CS:GO work.

    It goes like:
    1) Player choses settings for a game he wants to play
    2) Starts the search
    3) Search matches up with other players (looking for similar game and other criteria)
    4) Master server allocates dedicated server
    5) Everyone load into this server
    6) Game starts

    How would one implement similar behaviour in UE4, using IOnlineSubsystem and other interfaces? I've been digging into ShooterGame example, but it seems that dedicated server is not fully implemented there. I can host the server on client and have a server list of current sessions, all good, but it seems to not have a matchmaking mechanism that utilize dedicated servers.

    So far I found:
    1) FShooterOnlineSearchSettingsEmptyDedicated, which allows to find an empty dedicated server on which to host the game.
    2) AGameSession::RegisterServer() function which can be overridden to register server with an online subsystem. (probably that way I can register with Master Server of Steam for example?)
    3) AGameSession is reponsible for creating sessions, finding them and joining them. This class is created through AGameMode::GetGameSessionClass().

    II) Problem related to camera/vehicle jitter, that seems to be present only on Dedicated Servers - https://issues.unrealengine.com/issue/UE-34580 marked as backlogged, does it mean it won't be fixed anytime soon? Any success on resolving this issue? Some say it is related to how physics are applied with ApplyRigidBodyState, others that is the SpringArmComponent problem.

    To reproduce the problem:
    You don't need to setup anything special to experience jitter, go for Vehicle Advance Blueprint template, set camera location and rotation lag, and run it with 1 Dedicated Server and 1 Client.
    Click image for larger version

Name:	gaXq4Iz.png
Views:	1
Size:	18.2 KB
ID:	1195958

    Thanks for the help in advance.
    Last edited by SoulSharer; 10-01-2016, 10:35 AM.

    #2
    Any ideas guys?
    I believe that jitter is caused by bad client-side prediction which forces vehicle back everytime, I will look into it more closely in upcoming week.

    P.s. updating to 4.13.1 did not help with jitter
    Last edited by SoulSharer; 10-01-2016, 12:34 PM.

    Comment


      #3
      Enabling camera lag causes a lot of jitter in multiplayer. Disabling camera lag was the workaround for me while I was developing Vehicle Soccer Template.
      Unreal Issue Tracker - Desktop App for Unreal Engine Issues
      Unreal Nexus - Create Share and Experience!

      Unreal Engine 4 World-Wide User Map

      [PLUGIN] Aws Gamelift Client Plugin
      [TOOL] Create your own binary release of UE4 from GitHub source
      [Marketplace] Vehicle Soccer Template
      [Marketplace] Objective Waypoint System
      My UE4 Tutorials and Misc Tools

      Lead Programmer at YetiTech Studios
      Your Friendly Neighborhood
      Satheesh PV (a.k.a RyanJon2040) | Twitter, Instagram, Facebook, LinkedIn, YouTube, Google+

      Comment


        #4
        Hey everybody,

        The SpringArmComponent issue causing network jitter is not fixed, yet. It is backlogged because the developers have more crucial issues to fix first.

        As for dedicated servers, they are completely functional (even in the Shooter Game example). Here is a quick break-down of how to set one up:

        1) Be running source. If you do not have source, you will need to get it. You can start here: https://wiki.unrealengine.com/GitHub_Setup
        2) After building UE4, create a new C++ Project. (Remember that Template Projects aren't setup for multiplayer and if you use one, you will not see the same functionality as in a standalone game)
        2.5) This is where you'd normally start working on your game / have your game made.
        3) Close Visual Studio and find the project folder where you created your project.
        4) Open the Source folder and right-click -> Text Document.
        5) Name the Text document <MyGame>Server.Target.cs. As an example, if your game is "RTS", your file name will be, RTSServer.Target.cs.

        As a note, if you do not have the ability to change the extension on your file(s) in Windows, you will need to go to your folder options and enable that. You can do this by pressing the Start Button or clicking the Windows icon and search, "Control Panel". Open Control Panel and then search for "Folder Options". Open the "View" Tab and un-check "Hide extensions for known files types, then press "Apply" then "OK".

        6) Open your <MyGame>.Target.cs file and add the following, replacing every "Game" with your game name. Again, as an example, if your game name is "RTS", you would change "GameServerTarget" to RTSServerTarget and OutExtraModuleNames.Add("Game") to OutExtraModuleNames.Add("RTS").

        Code:
        // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
         
        using UnrealBuildTool;
        using System.Collections.Generic;
         
        public class GameServerTarget : TargetRules
        {
            public GameServerTarget(TargetInfo Target)
            {
                Type = TargetType.Server;
            }
         
            //
            // TargetRules interface.
            //
            public override void SetupBinaries(
                TargetInfo Target,
                ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
                ref List<string> OutExtraModuleNames
                )
            {
                base.SetupBinaries(Target, ref OutBuildBinaryConfigurations, ref OutExtraModuleNames);
                OutExtraModuleNames.Add("Game");
            }
         
            public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
            {
                // It is valid for only server platforms
                return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
            }
         
            public override List<UnrealTargetPlatform> GUBP_GetPlatforms_MonolithicOnly(UnrealTargetPlatform HostPlatform)
            {
                if (HostPlatform == UnrealTargetPlatform.Mac)
                {
                    return new List<UnrealTargetPlatform>();
                }
                return new List<UnrealTargetPlatform> { HostPlatform, UnrealTargetPlatform.Win32, UnrealTargetPlatform.Linux };
            }
         
            public override List<UnrealTargetConfiguration> GUBP_GetConfigs_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform Platform)
            {
                return new List<UnrealTargetConfiguration> { UnrealTargetConfiguration.Development };
            }
        }
        7) Save this file and then close it.
        8) In your project folder (without UE4 or Visual Studio running; if they are close them) right-click on the .uproject and select "Generate Visual Studio project files". This will take a second.
        9) Then, open the .sln by double-clicking on it, which will open Visual Studio.
        10) In your Solution Explorer on the right side of Visual Studio, in the Games -> MyGameName -> Source folder, you should now have the <MyGame>Server.Target.cs file.
        11) Open the .uproject for your game and package your project by choosing File-> Package Project -> Windows -> Win64. https://docs.unrealengine.com/latest...cts/Packaging/
        12) When the project is done packaging, again open the .sln for your project and change the build configuration from "Development Editor" to "Development Server".
        13) Right click on your game under "Games" and choose "Build". This will take a while, it is building your <MyGame>Server.exe
        14) When Visual Studio is done, go to your project folder -> Binaries -> Win64 and copy the <MyGame>Server.exe
        15) Go to the folder where you packaged your game and open WindowsNoEditor->Binaries->Win64 and paste <MyGame>Server.exe in this folder
        16) Right click on <MyGame>Server.exe and copy. Then right-click somewhere else and choose "Paste Shortcut"
        17) Right click on the shortcut and go to, "Properties".
        18) At the end of the "Target" line add, -log

        You can now launch the dedicated server for your project with this short cut.

        Here is more documentation:

        [Networking]
        https://docs.unrealengine.com/latest...ay/Networking/
        https://docs.unrealengine.com/latest...ng/Blueprints/
        https://docs.unrealengine.com/latest...es/Networking/
        https://www.unrealengine.com/blog/bl...king-tutorials

        [Dedicated server]
        https://wiki.unrealengine.com/Dedica...ows_%26_Linux)

        Comment


          #5
          Originally posted by ryanjon2040 View Post
          Enabling camera lag causes a lot of jitter in multiplayer. Disabling camera lag was the workaround for me while I was developing Vehicle Soccer Template.
          Thanks for answering, I did the same thing, was wondering if anyone had ideas about what causes it to jitter.
          Nice template btw, good job on that.

          Originally posted by Kyle Langley View Post
          Hey everybody,

          The SpringArmComponent issue causing network jitter is not fixed, yet. It is backlogged because the developers have more crucial issues to fix first.

          As for dedicated servers, they are completely functional (even in the Shooter Game example). Here is a quick break-down of how to set one up:

          1) Be running source. If you do not have source, you will need to get it. You can start here: https://wiki.unrealengine.com/GitHub_Setup
          2) After building UE4, create a new C++ Project. (Remember that Template Projects aren't setup for multiplayer and if you use one, you will not see the same functionality as in a standalone game)
          2.5) This is where you'd normally start working on your game / have your game made.
          3) Close Visual Studio and find the project folder where you created your project.
          4) Open the Source folder and right-click -> Text Document.
          5) Name the Text document <MyGame>Server.Target.cs. As an example, if your game is "RTS", your file name will be, RTSServer.Target.cs.

          As a note, if you do not have the ability to change the extension on your file(s) in Windows, you will need to go to your folder options and enable that. You can do this by pressing the Start Button or clicking the Windows icon and search, "Control Panel". Open Control Panel and then search for "Folder Options". Open the "View" Tab and un-check "Hide extensions for known files types, then press "Apply" then "OK".

          6) Open your <MyGame>.Target.cs file and add the following, replacing every "Game" with your game name. Again, as an example, if your game name is "RTS", you would change "GameServerTarget" to RTSServerTarget and OutExtraModuleNames.Add("Game") to OutExtraModuleNames.Add("RTS").

          Code:
          // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
           
          using UnrealBuildTool;
          using System.Collections.Generic;
           
          public class GameServerTarget : TargetRules
          {
              public GameServerTarget(TargetInfo Target)
              {
                  Type = TargetType.Server;
              }
           
              //
              // TargetRules interface.
              //
              public override void SetupBinaries(
                  TargetInfo Target,
                  ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
                  ref List<string> OutExtraModuleNames
                  )
              {
                  base.SetupBinaries(Target, ref OutBuildBinaryConfigurations, ref OutExtraModuleNames);
                  OutExtraModuleNames.Add("Game");
              }
           
              public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
              {
                  // It is valid for only server platforms
                  return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
              }
           
              public override List<UnrealTargetPlatform> GUBP_GetPlatforms_MonolithicOnly(UnrealTargetPlatform HostPlatform)
              {
                  if (HostPlatform == UnrealTargetPlatform.Mac)
                  {
                      return new List<UnrealTargetPlatform>();
                  }
                  return new List<UnrealTargetPlatform> { HostPlatform, UnrealTargetPlatform.Win32, UnrealTargetPlatform.Linux };
              }
           
              public override List<UnrealTargetConfiguration> GUBP_GetConfigs_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform Platform)
              {
                  return new List<UnrealTargetConfiguration> { UnrealTargetConfiguration.Development };
              }
          }
          7) Save this file and then close it.
          8) In your project folder (without UE4 or Visual Studio running; if they are close them) right-click on the .uproject and select "Generate Visual Studio project files". This will take a second.
          9) Then, open the .sln by double-clicking on it, which will open Visual Studio.
          10) In your Solution Explorer on the right side of Visual Studio, in the Games -> MyGameName -> Source folder, you should now have the <MyGame>Server.Target.cs file.
          11) Open the .uproject for your game and package your project by choosing File-> Package Project -> Windows -> Win64. https://docs.unrealengine.com/latest...cts/Packaging/
          12) When the project is done packaging, again open the .sln for your project and change the build configuration from "Development Editor" to "Development Server".
          13) Right click on your game under "Games" and choose "Build". This will take a while, it is building your <MyGame>Server.exe
          14) When Visual Studio is done, go to your project folder -> Binaries -> Win64 and copy the <MyGame>Server.exe
          15) Go to the folder where you packaged your game and open WindowsNoEditor->Binaries->Win64 and paste <MyGame>Server.exe in this folder
          16) Right click on <MyGame>Server.exe and copy. Then right-click somewhere else and choose "Paste Shortcut"
          17) Right click on the shortcut and go to, "Properties".
          18) At the end of the "Target" line add, -log

          You can now launch the dedicated server for your project with this short cut.

          Here is more documentation:

          [Networking]
          https://docs.unrealengine.com/latest...ay/Networking/
          https://docs.unrealengine.com/latest...ng/Blueprints/
          https://docs.unrealengine.com/latest...es/Networking/
          https://www.unrealengine.com/blog/bl...king-tutorials

          [Dedicated server]
          https://wiki.unrealengine.com/Dedica...ows_%26_Linux)
          Thanks for the help, we've done just that (following documentation above).
          What we are trying to do is to build matchmaking on top of it, meaning we want a system that gathers players into groups by game parameters (like the map they want to play) and sends them to dedicated servers when they are ready to go. Shooter example does not show that, currently I'm trying to look at Unreal Tournament sources in hopes I can find an answer, so far I found something called beacons, maybe that is the answer?
          Last edited by SoulSharer; 10-06-2016, 12:00 PM.

          Comment


            #6
            Originally posted by SoulSharer View Post
            Nice template btw, good job on that.
            Thank you


            Originally posted by SoulSharer View Post
            currently I'm trying to look at Unreal Tournament sources in hopes I can find an answer, so far I found something called beacons, maybe that is the answer?
            I am not sure if Unreal Tournament exposes everything because AFAIK Epic uses OnlineSubsytemMCP which is not available for public use. IIRC Beacons are used to register their place on the server without really connecting/traveling to it because "real connect" requires full map load. With beacons, you can poll different servers to find out which one is the best or to get information about the server etc so that you really dont have to connect to a server. But before you do all that you need actual dedicated servers hosting sessions. For my game I am using Amazon EC2 servers and for matchmaking I use GameSparks. I also wrote a small article on how I did everything using GameSparks and Amazon EC2 (I used node.js for GameSparks request and spawning dedicated servers).

            You can get article link in this thread
            https://forums.unrealengine.com/show...dicated-Server
            Unreal Issue Tracker - Desktop App for Unreal Engine Issues
            Unreal Nexus - Create Share and Experience!

            Unreal Engine 4 World-Wide User Map

            [PLUGIN] Aws Gamelift Client Plugin
            [TOOL] Create your own binary release of UE4 from GitHub source
            [Marketplace] Vehicle Soccer Template
            [Marketplace] Objective Waypoint System
            My UE4 Tutorials and Misc Tools

            Lead Programmer at YetiTech Studios
            Your Friendly Neighborhood
            Satheesh PV (a.k.a RyanJon2040) | Twitter, Instagram, Facebook, LinkedIn, YouTube, Google+

            Comment


              #7
              Originally posted by ryanjon2040 View Post
              I am not sure if Unreal Tournament exposes everything because AFAIK Epic uses OnlineSubsytemMCP which is not available for public use. IIRC Beacons are used to register their place on the server without really connecting/traveling to it because "real connect" requires full map load. With beacons, you can poll different servers to find out which one is the best or to get information about the server etc so that you really dont have to connect to a server. But before you do all that you need actual dedicated servers hosting sessions. For my game I am using Amazon EC2 servers and for matchmaking I use GameSparks. I also wrote a small article on how I did everything using GameSparks and Amazon EC2 (I used node.js for GameSparks request and spawning dedicated servers).

              You can get article link in this thread
              https://forums.unrealengine.com/show...dicated-Server
              Big thanks, it will help a lot with setting everything up. Too bad there is little documentation about the whole OnlineSubsystem thing, it is confusing as how it supposed to be working.

              Comment


                #8
                Camera Manager viewtarget interpolation seems to be the cause of jitter.

                Code:
                //Just a fast test-code to set a viewtarget to the last character
                void AMyPlayerController::NextPlayer()
                {
                	for (TActorIterator<AOnlineDedicatedTest2Character> ActorItr(GetWorld()); ActorItr; ++ActorItr)
                	{
                		AOnlineDedicatedTest2Character *character = *ActorItr;
                		SetViewTarget(character);
                	}
                
                }
                When I set ViewTarget with any kind of blending (tried Cubic, Linear, etc with different params) it always causes jitter, which is related to SpringArm component problem.
                I wonder if corrections from server could cause unstable interpolation. If you sit camera still - no evidence of such jitter can be found.

                Comment

                Working...
                X