x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Packaging and creating a dedicated server

Hello everyone!

I'm currently working on a game where several players are supposed to be able to connect to a server and then play with each others. I got everything to work while i was using the dedicated server available to launch within the editor, but as soon as i tried create a server otherwise it failed.

I've red about packaging and getting a server exe with it, but can anyone help me how to do this?

Regards

FreeSirenety

Product Version: Not Selected
Tags:
more ▼

asked Apr 10 '14 at 07:35 PM in Packaging & Deployment

avatar image

FreeSirenety
151 10 13 20

avatar image Mekrob Apr 13 '14 at 03:15 PM

I've also been struggling with figuring out how to do this. I can launch the dedicated server using UE4Editor.exe, but without the memory optimizations that exist in a shipping dedicated server I've been unable to assess the practicality of my current project in a real-world scenario.

If anyone could provide any information, it would be greatly appreciated.

avatar image Cynistyr Apr 14 '14 at 08:39 PM

Can you share the process to get this to work? I've tried several ideas posted on this forum as well as digging around on my own but either the process crashes at start-up or the client loads. I'm just looking to load a headless server process.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

5 answers: sort voted first

This is the best tutorial to use is this link: Dedicated Server Guide (Windows & Linux)

I have used this method multiple times and had a success each time.

more ▼

answered Apr 02 '15 at 09:14 AM

avatar image

qdelpeche
649 31 11 43

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

A more official answer that I hope will help out in the interim.

ShootergameServer.build.cs should be in GitHub as of the 4.1 release.

The distributed binaries for the editor that come from the launcher do not include compilation against a preprocessor define UE_SERVER which gives you the optimizations and some additional parts required to run in the server executable mode. I'm not sure at the moment what the plan is, but I would assume that this isn't supported in this fashion for the time being. There was a bug filed to make this more clear that will be in the next release (not 4.1 because that is imminent).

That being said, you have all the code to compile the full engine source in GitHub and can GenerateProjectFiles.bat to make the UE4.sln file that will have your project and all our modules included. If you compile this in as "Debug Server", "Release Server", etc you will get the server executable (MyGameServer.exe) to compile properly. In this mode you will need to cook your content via UFE so that it has data to run with.

As always, the editor can run in -game and -server modes for emulation of MyGame.exe and MyServer.exe respectively.

I hope this helps and will dig further if necessary.

more ▼

answered Apr 24 '14 at 01:04 AM

avatar image

Crzyhomer STAFF
1.3k 35 26 103

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Could you please make a short video tutorial on this? I'm really confused cause I don't have lot's of experience in compiling from source code... In was expected not to work with engine source code but only with a distributed release...

more ▼

answered Jul 14 '14 at 08:35 PM

avatar image

iShadowfax
36 4 6 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I wrote a blog post detailing the steps I took to build, run, and connect to a dedicated server. I hope this helps!

http://blog.piinecone.com/post/96800987702/building-a-dedicated-server-in-unreal-engine-4

more ▼

answered Sep 06 '14 at 05:44 PM

avatar image

piinecone
537 22 32 370

avatar image Kneebiter Sep 11 '15 at 03:47 PM

Hey, Pinecone - did you, by any chance, ever look at doing the Mac dedicated server?

avatar image piinecone Oct 31 '15 at 10:16 PM

Hey Jeff. No, I still haven't tried to build a linux dedicated server from OSX. I always package my linux/windows builds from windows and then just use Mac for Mac client packaging. I suppose I became indifferent about whether I'm packaging the linux dedicated server from windows or mac.

If you're in a bind you could rent an instance from Google or Amazon and perform linux dedicated server builds on there.

avatar image Teapot Creation Mar 02 '16 at 04:14 PM

Hi, Pinecone, I bounce on jeffs question : have you tried doing an html dedicated server ? :)

avatar image piinecone Mar 08 '16 at 09:40 AM

Hey Teapot, I don't think you'd want to run your dedicated server in the browser. That would defeat the purpose. :D

avatar image Teapot Creation Mar 09 '16 at 12:47 PM

Haha :) My 'exact' question would be : is taht possible for a html exported game to connect to a dedicated server located on the same machine where the hosting website is ?

avatar image piinecone Mar 09 '16 at 01:11 PM

I haven't tried this but technically it should be fine. For example, you could serve your HTML5 client at 123.45.678.9:80 (TCP), and serve your dedicated server at 123.45.678.9:7777 (UDP). You would run a web server and a dedicated ue4 server on the same machine.

Personally I would prefer to dedicate separate machines or containers to specific tasks, but it isn't strictly necessary and just depends on your needs.

avatar image Teapot Creation Mar 09 '16 at 01:21 PM

Hmmm ok. Thanks for your answer ! I assume it depends of the authorizations I have, too... For now I only have an ftp access to the hosting machine, so for a dedicated server it might be hard to set up. Thanks !

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

If you're referencing the ShooterGame demo (possibly others), I've found through talking with the Epic staff that there is a target file missing (possibly in other projects as well) from the GitHub that enables the building of the dedicated server .exe files.

ShooterGameServer.Target.cs: // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.

 using UnrealBuildTool;
 using System.Collections.Generic;
 
 public class ShooterGameServerTarget : TargetRules
 {
     public ShooterGameServerTarget(TargetInfo Target)
     {
         Type = TargetType.Server;
         bUsesSteam = true;
     }
 
     //
     // TargetRules interface.
     //
 
     public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
     {
         // It is valid for only server platforms
         return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
     }
 
     public override void SetupBinaries(
         TargetInfo Target,
         ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
         ref List<string> OutExtraModuleNames
         )
     {
         OutExtraModuleNames.Add("ShooterGame");
     }
     public override List<UnrealTargetPlatform> GUBP_GetPlatforms_MonolithicOnly(UnrealTargetPlatform HostPlatform)
     {
         if (HostPlatform == UnrealTargetPlatform.Mac)
         {
             return new List<UnrealTargetPlatform>();
         }
         return new List<UnrealTargetPlatform> { HostPlatform, UnrealTargetPlatform.Linux };
     }
 
     public override List<UnrealTargetConfiguration> GUBP_GetConfigs_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform Platform)
     {
         return new List<UnrealTargetConfiguration> { UnrealTargetConfiguration.Development, UnrealTargetConfiguration.Shipping };
     }
 }
 

Hope that helps somebody..

more ▼

answered Apr 15 '14 at 10:46 PM

avatar image

Cynistyr
131 5 8 11

avatar image Didstopia Apr 25 '14 at 12:56 PM

I've seen a lot of posts pointing to this bit of code for a new server target, but I'm unable to get it to compile.

I'm basically trying to get a dedicated server build target added to a minimal new project, but adding a build target will simply produce a MASSIVE amount of unresolved external symbols.

You'd think that there would be more posts about this and more solutions or even guides on how to implement a new (server) build target.

avatar image Crzyhomer STAFF Apr 25 '14 at 01:20 PM

See my post above. Running from the "binary" version of the engine will not allow you to compile dedicated server. There are many permutations for our static libs and it was decided that compiling with UE_SERVER=1 was not one of them.

You will have to get the source code from GitHub, get your project included when you GenerateProjectFiles.bat (either by setting your project next to \Engine\ or making sure your uproject files are setup correctly) and then build a Server for Win32/Win64 to generate a MyGameServer.exe file.

Additionally you will have to cook for WindowsServer target in order to have content to run with that binary. You have to use UnrealFrontend.exe (in the binaries directory or you compile) to cook the data.

Although I'm doing my best to advise, apparently this is in the "unsupported" state at the moment. It's rough but we'll get it going for you.

avatar image Didstopia Apr 25 '14 at 02:36 PM

That actually makes sense, I just thought that the necessary headers/source for this kind of functionality would've been included with the official binary, but I'm guessing you're working on adding dedicated server packaging/building to the binary at some point.

To be honest, this wasn't trivial or ideal by any means, but here's how I managed to get it building:

  1. Get the source, build it and run the version selector

  2. Run the Editor from the built binaries

  3. Create a new, empty project

  4. Add any kind code (I just made an actor called TestActor) from the File menu

  5. Close Visual Studio if/when it opens

  6. Add Server.Target.cs and modify to match

  7. In your .Build.cs, uncomment Slate and OnlineSubsystem

  8. With Visual Studio closed, in the Editor go to File -> Refresh Visual Studio

  9. Now you see the Server target option in VS and you can actually build it, as all headers and libraries are included and pointing at the right files

It still hasn't finished building though, but at least I'm getting further than I was before.

avatar image edcolmar Jun 15 '15 at 06:00 PM

Close Visual Studio if/when it opens

Add Server.Target.cs and modify to match

How do you add the Server Target, when visual studio is closed?

avatar image Crzyhomer STAFF Jun 16 '15 at 01:48 AM

He's referring to the target.cs file you have for your game. You need to make a target.cs file for the server and change the rules/type inside to "server".

Try looking here for what I mean.

Dedicated Server Project Settings

avatar image Crzyhomer STAFF Apr 25 '14 at 02:54 PM

I really appreciate your willingness to share the steps and make the time. I'll get this feedback to our QA group to see if this it the current "best way'. It's hard sometimes to see how the other half lives. I was planning on trying some things out at home myself to see the pain points.

avatar image Didstopia Apr 25 '14 at 03:03 PM

No problem! This might be a tad off-topic, but I did notice some oddities between the binary and source-built Editor:

If I create an empty project with the binary Editor, I don't see anything related to Visual Studio in the File-menu, so I have to create a class/object manually and then the Editor will generate the project files.

If I do the same, but with the source-built Editor, I immediately see the option for refreshing the Visual Studio project etc. but clicking on it just gives me an error, as the project doesn't exist yet. So I have to manually add a class/object and it'll generate the project files, like before.

Just thought I'd share that bit too, as it does seem a bit odd to have to actually create an object before being able to create a VS project (maybe that's just me?) and the fact that the source version shows the option is a bit misleading.

avatar image Crzyhomer STAFF Apr 25 '14 at 06:13 PM

I would strongly consider starting a separate support/question thread about that issue so it isn't lost here. I'm not the best source for information on the project wizards and creation and how they differ work across "binary only" and "github source".

avatar image Didstopia Apr 26 '14 at 02:06 PM

Regarding the dedicated server target, I still haven't been able to successfully run the server, as the cooking step isn't as clear as I thought it would be. Using UnrealFrontend to Cook for just "WindowsServer" results in an error while cooking. I've created my own batch files (by studying the ShooterGame 4.1 batch files) for both the client and the server, and while that doesn't create a .pak file, it does copy the 3rd party DLL's, content etc. into separate directories and the executable in it's own directory, just like in the ShooterGame deployment batch files. Neither the client or the server run at all, they just produce a minidump or throw errors. The only way I've been able to run the client so far, is by using the editor's deployment (& cooking).

To reiterate: Unreal Frontend's cooking errors on both the client and the server. The steps that I listed above only get you as far as building the binary, but knowing where the binary is expecting to read the files from and how to properly cook the files to get it working, is really beyond me at this point.

UPDATE: Selecting plain "Windows" as the target in UFE does succesfully cook, apparently.

UPDATE 2: Packaging with the Editor and disabling .pak file generation, then copying the server binary in the binary folder seems to be working. The server runs, although it only seems to go straight to the background, I would've assumed it would have created a command line or something to interact with it or to close it with. Getting further now though, I suppose.

avatar image piinecone Sep 13 '14 at 05:25 PM

I compiled most of the things you figured out into a guide as I went through the process myself. I think there are some issues, though. Have a look if you feel so inclined: http://blog.piinecone.com/post/96800987702/building-a-dedicated-server-in-unreal-engine-4

avatar image SteeleDriver May 09 '14 at 01:38 PM

I've been looking around for information on this and ended up posting in the forums myself. To add to this, trying to Debug the Server code is even more painfull :) Localization is where my issues are occuring ... Any updates on this would be highly appreciated. The basic game setup is easy, the real work is setting up a dedicated server Once I can debug the server I can easily get it talking to my Master Server system with sockets, but I need to be able to run it in debug mode...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question