Server Build PakFileRules?

Is there a way to specify file asset exclusions (specifically some custom .pak files) for the server build target?

I’m able to get this working for the game build by modifying DefaultPakFileRules.ini but don’t see an equivalent path for server builds. DedicatedServerEngine.ini appears to just modify project settings and does not impact the project packaging.

Thanks in advance!

[Attachment Removed]

Steps to Reproduce[Attachment Removed]

Hi!

I think a custom config file would work for this purpose. For example, in a YourProjectServer.Target.cs file, put `CustomConfig = “DedicatedServer”;`.

Then create a `YourProject/Config/Custom/DedicatedServer/DefaultPakFileRules.ini` file, where you put your server-only rules. It will have higher priority than `YourProject/Config/DefaultPakFileRules.ini`, so you could even override the project configs in the custom config file.

[Attachment Removed]

Yes, it’s cumulative, that’s on purpose. The CustomConfig parameter adds one layer to the config hierarchy:

inline FConfigLayer GConfigLayers[] =
{
	// Engine/Base.ini
	{ TEXT("AbsoluteBase"),				TEXT("{ENGINE}/Config/Base.ini"), EConfigLayerFlags::NoExpand},
	// Engine/Base*.ini
	{ TEXT("Base"),						TEXT("{ENGINE}/Config/Base{TYPE}.ini"), EConfigLayerFlags::UseGlobalConfigCache },
	// Engine/Platform/BasePlatform*.ini
	{ TEXT("BasePlatform"),				TEXT("{ENGINE}/Config/{PLATFORM}/Base{PLATFORM}{TYPE}.ini"), EConfigLayerFlags::UseGlobalConfigCache  },
	// Project/Default*.ini
	{ TEXT("ProjectDefault"),			TEXT("{PROJECT}/Config/Default{TYPE}.ini"), EConfigLayerFlags::AllowCommandLineOverride | EConfigLayerFlags::UseGlobalConfigCache },
	// Project/Generated*.ini Reserved for files generated by build process and should never be checked in 
	{ TEXT("ProjectGenerated"),			TEXT("{PROJECT}/Config/Generated{TYPE}.ini"), EConfigLayerFlags::UseGlobalConfigCache },
	// Project/Custom/CustomConfig/Default*.ini only if CustomConfig is defined
	{ TEXT("CustomConfig"),				TEXT("{PROJECT}/Config/Custom/{CUSTOMCONFIG}/Default{TYPE}.ini"), EConfigLayerFlags::RequiresCustomConfig | EConfigLayerFlags::UseGlobalConfigCache },
	// Engine/Platform/Platform*.ini
	{ TEXT("EnginePlatform"),			TEXT("{ENGINE}/Config/{PLATFORM}/{PLATFORM}{TYPE}.ini"), EConfigLayerFlags::UseGlobalConfigCache },
	// Project/Platform/Platform*.ini
	{ TEXT("ProjectPlatform"),			TEXT("{PROJECT}/Config/{PLATFORM}/{PLATFORM}{TYPE}.ini"), EConfigLayerFlags::UseGlobalConfigCache },
	// Project/Platform/GeneratedPlatform*.ini Reserved for files generated by build process and should never be checked in 
	{ TEXT("ProjectPlatformGenerated"),	TEXT("{PROJECT}/Config/{PLATFORM}/Generated{PLATFORM}{TYPE}.ini"), EConfigLayerFlags::UseGlobalConfigCache },
	// Project/Platform/Custom/CustomConfig/Platform*.ini only if CustomConfig is defined
	{ TEXT("CustomConfigPlatform"),		TEXT("{PROJECT}/Config/{PLATFORM}/Custom/{CUSTOMCONFIG}/{PLATFORM}{TYPE}.ini"), EConfigLayerFlags::RequiresCustomConfig| EConfigLayerFlags::UseGlobalConfigCache },
	// AppSettings/.../System*.ini
	{ TEXT("AppSettingsDir"),			TEXT("{APPSETTINGS}Unreal Engine/Engine/Config/System{TYPE}.ini"), EConfigLayerFlags::NoExpand },
	// UserSettings/.../User*.ini
	{ TEXT("UserSettingsDir"),			TEXT("{USERSETTINGS}Unreal Engine/Engine/Config/User{TYPE}.ini"), EConfigLayerFlags::NoExpand },
	// UserDir/.../User*.ini
	{ TEXT("UserDir"),					TEXT("{USER}Unreal Engine/Engine/Config/User{TYPE}.ini"), EConfigLayerFlags::NoExpand },
	// Project/User*.ini
	{ TEXT("GameDirUser"),				TEXT("{PROJECT}/Config/User{TYPE}.ini"), EConfigLayerFlags::NoExpand },
};

Since it’s part of the hierarchy and with a higher priority, the Custom rules can override rules in the lower layers, like with the minus operator:

-Files=“…/MaxisGame/Content/External/…/*-Client*.pak”

Or, which might be a cleaner approach, have two custom configs (one for Client and one for Server) and only use the one that’s relevant to each build.

[Attachment Removed]

Thanks Ari! Looks like this mostly works… but I’m seeing a cumulative effect with the rules defined in the DedicatedServer config

DefaultPakFileRules.ini (base game config)

  • properly excludes any Server specific pak files
[ExcludeUnusedBuildTargetPaks]
bExcludeFromPaks=true
bOverrideChunkManifest=true
+Files=".../MaxisGame/Content/External/.../*-Server*.pak"

DefaultPakFileRules.ini (server config)

  • excludes BOTH Client and Server specific pak files
  • verified that if I remove the section from the base game config, only the Client specific pak files are excluded (which is the desired result)
[ExcludeUnusedBuildTargetPaks]
bExcludeFromPaks=true
bOverrideChunkManifest=true
+Files=".../MaxisGame/Content/External/.../*-Client*.pak"

[Attachment Removed]

ah excellent, the -Files option was what I was missing for the override, but I like your suggestion for the separate custom configs to keep the settings cleaner and more explicit

thank you again for the help!

[Attachment Removed]