Announcement

Collapse
No announcement yet.

How to create Rocket build that can deploy Dedicated Server of game?

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

  • How to create Rocket build that can deploy Dedicated Server of game?

    I recently compiled my own version of UE4 from GitHub (promoted branch) and created Rocket Build out of it, which is perfectly working and I am able to cook/package my game. However when it comes to creating Dedicated Server, build keeps failing.

    Here is the message:

    Any idea how can I make my custom build to support building Dedicated Server for game.
    Attached Files

  • replied
    Finally Epic added this by default to the Engine. Here is the commit: https://github.com/EpicGames/UnrealE...2258e4a786132d

    Huge thanks to Ben Marsh.

    Leave a comment:


  • replied
    So, after some tinkering I now have an inhouse distributed engine build, which works for building and packaging both Server and Client Targets. I also added an option to allow for a custom output directory.
    I only altered the default InstalledEngineBuild.xml a little bit by adding the UE4Server and UE4Client targets as follows:

    HTML Code:
    <!-- Ouput directory for the build. This was ADDED to the xml -->
    <Option Name="BuiltDirectory" DefaultValue="$(RootDir)/LocalBuilds/Engine/" Description="Directory for outputting the built engine"/>
    
    <!-- The local output directory. These were EDITED in the xml -->
    <Property Name="LocalInstalledDir" Value="$(BuiltDirectory)/Engine/Windows"/>
    <Property Name="LocalInstalledDirMac" Value="$(BuiltDirectory)/Engine/Mac"/>
    <Property Name="LocalInstalledDirLinux" Value="$(BuiltDirectory)/Engine/Linux"/>
    Later in the Target Platform Node I added:

    HTML Code:
    <ForEach Name="Configuration" Values="$(GameConfigurations)">
    <Compile Target="UE4Game" Platform="Win64" Configuration="$(Configuration)" Tag="#UE4Game Win64" Arguments="-precompile $(VSCompilerArg) $(TargetDebugInfoArg)"/>
    <Compile Target="UE4Server" Platform="Win64" Configuration="$(Configuration)" Tag="#UE4Game Win64" Arguments="-precompile $(VSCompilerArg) $(TargetDebugInfoArg)"/>
    <Compile Target="UE4Client" Platform="Win64" Configuration="$(Configuration)" Tag="#UE4Game Win64" Arguments="-precompile $(VSCompilerArg) $(TargetDebugInfoArg)"/>
    </ForEach>
    
    <!-- Some other stuff -->
    
    <!-- Tag the generated includes for this target -->
    <Tag Files="Engine/Intermediate/Build/Win64/UE4/Inc/...;Engine/Plugins/.../Intermediate/Build/Win64/UE4/Inc/..." With="#UE4Game Win64 Includes"/>
    <Tag Files="Engine/Intermediate/Build/Win64/UE4Server/Inc/...;Engine/Plugins/.../Intermediate/Build/Win64/UE4Server/Inc/..." With="#UE4Game Win64 Includes"/>
    <Tag Files="Engine/Intermediate/Build/Win64/UE4Client/Inc/...;Engine/Plugins/.../Intermediate/Build/Win64/UE4Client/Inc/..." With="#UE4Game Win64 Includes"/>
    Then I built the Engine from Commandline using this command:
    Code:
    ./RunUAT.bat BuildGraph -target="Make Installed Build Win64" -script="Engine/Build/InstalledEngineBuild.xml" -set:WithMac=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=false -set:WithHTML5=false -set:WithLumin=false -set:WithDDC=false -set:WithWin32=false -set:BuiltDirectory="PathToOutputDirectory"
    As ryanjon2040 mentioned you then have to copy over the UE4Server.Target.cs and UE4Client.Target.cs to your resulting Engine/Source/ folder.
    (Also add the corresponding targets to your Project/Source/ folder.)

    For packaging I use the BuildCookRun from commandline as follows:
    Code:
    ./RunUAT.bat BuildCookRun -project="FullPathToProjectfile.uproject" -noP4 -platform=Win64 -clientconfig=Development -serverconfig=Development -cook -allmaps -server -client -serverplatform=Win64 -stage -pak -archive -archivedirectory="FullPathToOutputDirectory"
    I think that was all I did. Of course you have to edit your Project with the UnrealVersionSelector to use the resulting Engine Binary. (Start UE4Editor.exe once so it can set the correct registry keys and is visible in the Version Selector)

    Some other tips:
    1. To get your dedicated server to run with an anonymously logged in steamcmd.exe, you have to copy the four Steam .DLL files from your Engine directory (\Engine\Binaries\ThirdParty\Steamworks\Steamv139\Win64) next to your Server binary. Otherwise you will get SteamAPI Errors. (Source)
    2. The Server and Client have a version check integrated by default. Here is a starting point on how to override it with your own stuff.
    3. My server was starting too fast sometimes and I had no time to attach my debugger. I added the following hack to my code, so now the process waits for the debugger if I use the command line parameter "-WaitForDebugger".
      Code:
      	//TODO SR: REMOVE THIS DEBUGCODE
      	if (FParse::Param(FCommandLine::Get(), TEXT("WaitForDebugger")))
      	    {
      	        UE_LOG(LogTemp, Verbose, TEXT("'WaitForDebugger' found. Waiting for Debugger."))
      	            while (!IsDebuggerPresent())
      	            {
      	                Sleep(1000);
      	            }
      	    }
    4. Use command line arguments to start your server with logging. (e.g. ProjectServer.exe -log -logcmds="logonline all, logonlinegame all")
    I hope this little summary helps anyone with the same problems. If anyone has questions, just ask in this thread or shoot me a message here or on twitter.

    My next problem: How to change the Project Version number from my builders command line. (I hoped for some .ini setting that I could override in the packaging process, but I haven't found anything yet)



    Leave a comment:


  • replied
    Thank you so much ryanjon2040! I actually have an IEB now that can build Server Targets! I was just missing the "UE4Server.Target.cs" in the Engine folder.:/

    I also glanced over your InstalledEngineBuild.xml and didn't find the earlier mentioned <Tag> for the generated Server Includes. (Also not for the default Game one.)
    Is this no longer needed?

    HTML Code:
     <!-- Tag the generated includes for this target -->
    <!-- This one is already in the default InstalledEngineBuild.xml-->
    <Tag Files="Engine/Intermediate/Build/Win64/UE4/Inc/...;Engine/Plugins/.../Intermediate/Build/Win64/UE4/Inc/..." With="#UE4Game Win64 Includes"/>
    <!-- This one is added for Server Target-->
    <Tag Files="Engine/Intermediate/Build/Win64/UE4Server/Inc/...;Engine/Plugins/.../Intermediate/Build/Win64/UE4Server/Inc/..." With="#UE4Game Win64 Includes"/>
    And if they are needed, would I have to add a UE4Client one aswell?

    Leave a comment:


  • replied
    spreiste With the recent changes I am not sure how we can build binary version with Dedicated Server and Client support. I modified the InstalledEngineBuild.xml (which I'm sharing here) to add support for server/client targets and it did build the Engine but the problem was not being able to package the game in server target.

    For the target rules not found error, the fix is easy. Simply copy UE4Server.Target.cs from your Github source (Engine\Source directory) to your binary build (Engine\Source directory).

    PS: I posted a new thread requesting this feature here: https://forums.unrealengine.com/unre...client-support

    PPS: The InstalledEngineBuild.xml I'm sharing here only supports Win64 and Win32. I've stripped out all other platforms.

    PPPS: You can check out this tool for creating binary UE4: https://forums.unrealengine.com/deve...-for-your-team
    Attached Files

    Leave a comment:


  • replied
    Bump.

    ryanjon2040 Frozenfire did you ever get a running build with BuildEditorAndTools.xml?

    Leave a comment:


  • replied
    Only after posting I saw the comments here on Page 2 and tried the BuildEditorAndTools.xml file for building with BuildGraph. This has different problems as I described in my AnswersHub Question over here. https://answers.unrealengine.com/que...0279/view.html
    I hope someone can help me.

    Leave a comment:


  • replied
    Hey folks!

    Sorry to necromance this thread, but I really need help getting the Server Target to work for my built binaries.
    At first I was building the dedicated server for my game with the Built from Source version of the Unreal Engine (4.20.3), and it works. Now I am trying to get a Local Built I can distribute inhouse, so everyone can built the Server Target, but does not need to built the engine him-/herself.
    I followed all the instructions of the previous posts here and my Local Build actually has the "Development Server" Target. But when I try to use it I get the following error:

    UnrealBuildTool : error : Couldn't find target rules file for target 'UE4Server' in rules assembly 'UE4Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
    2> Location: E:\Projects\UnrealEngineGit\LocalBuilds\Engine\Windows\Engine\Intermediate\Build\BuildRules\UE4Rules.dll
    2> Target rules found:
    2>
    2> (see ../Programs/UnrealBuildTool/Log.txt for full exception trace)


    The "Development Game" Target seems to work withouth problems.
    I attached my InstalledEngineBuild.xml file, but I didn't change anything besides the recommended changes for the Server Target. I even looked at the diff of ryanjon2040s file and mine.
    This is the command I am using to start the UAT Build:

    ./RunUAT.bat BuildGraph -target="Make Installed Build Win64" -script="Engine/Build/InstalledEngineBuild.xml" -set:WithMac=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=false -set:WithHTML5=false -set:WithLumin=false -set:WithDDC=false -set:WithWin32=false


    Anyone here had the same problem? Do I have to do something since UE 4.20.3 that I didn't hear of yet?
    Looking forward to your help!

    Kind Regards,
    Stefan
    Attached Files

    Leave a comment:


  • replied
    Hi Frozenfire That keyword has been deprecated. You have to use -set:EmbedSrcSrvInfo=true or false now.

    Creating dedicated server supported rocket no longer seems possible with these changes in this thread. I've tried to build, but server/client targets are no longer included despite the modified InstalledEngineBuild.xml. There is a new xml file called BuildEditorAndTools.xml in \Engine\Build\Graph\Examples folder that supports UE4Server and UE4Client.

    Leave a comment:


  • replied
    Hi there ryanjon2040
    this seems to be broken in 4.19 saying EnableSymStore is unknown. Exit Error 1., Any idea how to fix this? perhaps the keyword is deprecated?

    Using older version of InstalledBuilds.xml however gives me different error
    ERROR: C:\Users\User\Documents\GitHub\AmmoboxUnrealEngine\Engine\Build\InstalledEngineBuild.xml(104): The 'FromDir' attribute is not declared.
    Last edited by Frozenfire; 04-24-2018, 01:55 AM.

    Leave a comment:


  • replied
    Looks like you are missing server target for your project. Did you create YourProjectNameServer.Target.cs build file? In YourProjectFolder/Source folder you will have YourProjectName.Target.cs file. In addition to this, you will need YourProjectNameServer.Target.cs file. You can use the below code but make sure to change YourProjectName to your actual project name:
    Oh my god, of course! Feel like a complete idiot, thank you!

    Leave a comment:


  • replied
    Originally posted by Kanibel View Post
    Ahh I see I was trying to use the default options found here:


    Which is when it gives me this error:


    Unfortunately I tried your method above but still get the same issue.
    Looks like you are missing server target for your project. Did you create YourProjectNameServer.Target.cs build file? In YourProjectFolder/Source folder you will have YourProjectName.Target.cs file. In addition to this, you will need YourProjectNameServer.Target.cs file. You can use the below code but make sure to change YourProjectName to your actual project name:

    PHP Code:

    using UnrealBuildTool
    ;
    using System.Collections.Generic;


    public class 
    YourProjectNameServerTarget TargetRules
    {
        public 
    YourProjectNameServerTarget(TargetInfo Target)
        {
            
    Type TargetType.Server;
            
    bUsesSlate false;
            
    UEBuildConfiguration.bUseLoggingInShipping true// If you want logging in shipping build
        
    }


        
    //
        // TargetRules interface.
        //


        
    public override void SetupBinaries(
            
    TargetInfo Target,
            
    ref List<UEBuildBinaryConfigurationOutBuildBinaryConfigurations,
            
    ref List<stringOutExtraModuleNames
            
    )
        {
            
    OutExtraModuleNames.AddRange( new string[] { "YourProjectName" } );
        }
            
        
    // Obsolete from 4.15+
        
    public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatformOutPlatforms)
        {
            
    // It is valid for only server platforms
            
    return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatformsfalse);
        }

    See this documentation for more information: https://docs.unrealengine.com/latest...m/TargetFiles/
    Last edited by ryanjon2040; 01-04-2017, 01:56 AM. Reason: Documentation link added

    Leave a comment:


  • replied
    It should also work with 4.14. How are you building your game dedicated server? Are you using Project Launcher in editor to create dedicated server?

    You can use this app to create rocket build (with your modified InstalledEngineBuild.xml). After its done open your project in your new rocket build and from Windows -> Project Launcher you can create a new custom profile for your project. Then under cooking make sure you have WindowsServer and WindowsClient (Optional).
    Ahh I see I was trying to use the default options found here:
    Click image for larger version

Name:	WindowsServer.PNG
Views:	1
Size:	13.0 KB
ID:	1120861

    Which is when it gives me this error:
    Click image for larger version

Name:	ErrorServer.PNG
Views:	1
Size:	5.0 KB
ID:	1120862

    Unfortunately I tried your method above but still get the same issue.

    Here's my InstalledEngineBuild.xml. I've made a few adjustments but nothing that should affect this.
    InstalledEngineBuild.zip

    Leave a comment:


  • replied
    Originally posted by Kanibel View Post
    Hey Ryan I know in your post you say 4.15 however I'm trying this with a 4.14 build and its not actually letting me build (in editor) for dedicated server as it hasn't included the -server target. Did you end up making any changes to InstalledBuild.cs?
    It should also work with 4.14. How are you building your game dedicated server? Are you using Project Launcher in editor to create dedicated server?

    You can use this app to create rocket build (with your modified InstalledEngineBuild.xml). After its done open your project in your new rocket build and from Windows -> Project Launcher you can create a new custom profile for your project. Then under cooking make sure you have WindowsServer and WindowsClient (Optional).



    Here are the settings I use for my project.


    If you still have problems, could you please send me the original InstalledEngineBuild.xml from 4.14. I'll modify it and send it back to you.
    Attached Files

    Leave a comment:


  • replied
    Originally posted by ryanjon2040 View Post
    Big thanks to [MENTION=421696]Craig Downs[/MENTION]! Thanks a lot Craig. With your help I can make custom rocket builds that can deploy dedicated server game.

    For anyone else, I am uploading the InstalledEngineBuild.xml (4.15) that makes this possible. Copy this to \Engine\Build\ folder (make a backup first).
    Hey Ryan I know in your post you say 4.15 however I'm trying this with a 4.14 build and its not actually letting me build (in editor) for dedicated server as it hasn't included the -server target. Did you end up making any changes to InstalledBuild.cs?

    Leave a comment:

Working...
X