Dedicated server "editor only data" error with multiple modules

I have tried both on Linux and Windows to build a dedicated server with vscode. I am using 4.23.1.

Before I get to the error, I would like to go over my project structure in order to see if this is an adequate workflow. Inside the primary module created with the project, I want to put the code that is going to be common to both the server and the clients (game state, player state…). I have 2 other modules, one for the client code (widgets, HUD…) and one for the server (game modes…). Here’s what the modules part of the uproject looks like:


    "Modules": 
        {
            "Name": "UE4NetBS",
            "Type": "Runtime",
            "LoadingPhase": "Default",
            "AdditionalDependencies": 
                "Engine"
            ]
        },
        {
            "Name": "UE4NetBSClient",
            "Type": "Runtime",
            "LoadingPhase": "Default",
            "AdditionalDependencies": 
                "Engine"
            ]
        },
        {
            "Name": "UE4NetBSServer",
            "Type": "Runtime",
            "LoadingPhase": "Default",
            "AdditionalDependencies": 
                "Engine"
            ]
        }
    ]

I’ve had a hard time finding information about the AdditionalDependencies field so I don’t know whether the server needs it or not.

My server build target file only references the main module and the server module:


[SupportedPlatforms(UnrealPlatformClass.Server)]
public class UE4NetBSServerTarget : TargetRules
{
    public UE4NetBSServerTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Server;
        ExtraModuleNames.AddRange(new string] { "UE4NetBS", "UE4NetBSServer" });
    }
}

From start to finish, I try to build the server this way:

  • from vscode I build the editor target which contains all 3 modules
  • from the editor I cook the content (I would assume there are different cooker configs for different targets so this part might be the culprit)
  • from vscode I build the server target
  • when I try to run the server, I get this error (the full log is in attachments):

[2019.11.28-14.02.38:843]  0]LogLinker: Warning: Unable to load package (../../../UnrealEngine-release/Engine/Content/Animation/DefaultAnimCurveCompressionSettings.uasset). Package contains EditorOnly data which is not supported by the current build.
[2019.11.28-14.02.38:847]  0]LogCore: Error: appError called: Assertion failed: !GEventDrivenLoaderEnabled || LoadPhase > ELoadPhase::WaitingForHeader [File:/home/erebnyx/Documents/Dev/uecpp/UnrealEngine-release/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncLoading.cpp] [Line: 7804] 

I found these commands as well A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums. Is that the way to build the server instead of using the vscode tasks?

Another very probable cause is that I am misunderstanding how the targets work, here is the build target file for the client:


public class UE4NetBSTarget : TargetRules
{
    public UE4NetBSTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Game;
        ExtraModuleNames.AddRange(new string] { "UE4NetBS", "UE4NetBSClient" });
    }
}

When I try to run the build I get the error


The game module 'UE4NetBS' could not be found. Please ensure that this module exists and that it is compiled.

If you have any pointers that’d be a life saver.

After much searching I found this https://docs.unrealengine.com/en-US/…ype/index.html so I updated my uproject this way


"Modules": 
        {
            "Name": "UE4NetBS",
            "Type": "Runtime",
            "LoadingPhase": "Default",
            "AdditionalDependencies": 
                "Engine"
            ]
        },
        {
            "Name": "UE4NetBSClient",
            "Type": "ClientOnly",
            "LoadingPhase": "Default",
            "AdditionalDependencies": 
                "Engine"
            ]
        },
        {
            "Name": "UE4NetBSServer",
            "Type": "ServerOnly",
            "LoadingPhase": "Default",
            "AdditionalDependencies": 
                "Engine"
            ]
        }
    ]

I moved all the code to the main module as well in order to limit targets needing things that might be in an unreachable module. But now when I try to run the client I get this error (log in attachments)


LogModuleManager: Warning: ModuleManager: Module 'UE4NetBSServer' not found - its StaticallyLinkedModuleInitializers function is null.

even though the server module is marked ServerOnly (and furthermore contains no code anymore).

Edit: the server seems to work now or at least it does not crash.

If I add the module to the main target then it builds fine but what is the point of ServerOnly modules if the client ends up built with it? Is there some in depth doc about what TargetType really means? Because I have tried to change from Game to Client but then I cannot cook the content.