Was struggling with this for quite some time.
Seems like the options to change game mode does work for ServerTravel after some long reading of the source code for the engine. However only if you do so via C++, as the console commands goes through UEngine::HandleServerTravelCommand which seems to not have the code to parse out the options. (I haven’t built the engine from source code so I haven’t tried editing some code out of that to verify my assumption)
To test using ServerTravel with a different game mode in C++ i did the following in Unreal Engine 4.8.2
1: I made a test project with the template C++ ThirdPerson with project name “GameModeTravel”
2: Built the project in Visual Studios so I could do the following in the Unreal Engine 4 Editor
3: Added a Action Mapping in Project Settings->Input named “Travel” to the F key
4: Added a function/method AGameModeTravelCharacter::TestTravel
in GameModeTravelCharacter.cpp
5: Added void TestTravel();
in GameModeTravelCharacter.h
6: Added InputComponent->BindAction("Travel", IE_Pressed, this, &AGameModeTravelCharacter::TestTravel);
7: In the TestTravel function/method I implemented this
void AGameModeTravelCharacter::TestTravel()
{
UE_LOG(LogTemp, Warning, TEXT("Test Travel"));
GetWorld()->ServerTravel(TEXT("/Game/ThirdPerson/Maps/TestMap?game=/Game/ThirdPerson/OtherGameMode.OtherGameMode_C?listen"));
}
8: Compiled/Built the project.
9: Added a GameMode blueprint with the name “OtherGameMode” located in Content/ThirdPerson
10: Created a New Level and saved it as TestMap and put it at Content/ThirdPerson/Maps
11: In OtherGameMode blueprint in the EventGraph’s EventBeginPlay I added a node to print a string saying “OTHER GAME MODE!”
12: Saved, Built and Compiled Everything to make sure (not sure if necessary)
13: Packaged Game for Windows 64 bit
14: Open one instance of the packaged game
15: Open console in package game and type in “open ThirdExampleMap?listen”
16: Open second instance of the packaged game
17: Open console in package game and type in “open 127.0.0.1”
18: In first instance of the package game, I press F.
19: Watch as the second instance character disappears (due to lack of seamless travel)
19: Loads in the other map, prints out OTHER GAME MODE!, and see the second instance ball being stuck on the center of the floor due to the origin 0,0,0 position.
To test seamless travel just change the TestTravel function/method to the following
void AGameModeTravelCharacter::TestTravel()
{
UE_LOG(LogTemp, Warning, TEXT("Test Travel"));
GetWorld()->GetAuthGameMode()->bUseSeamlessTravel = true;
GetWorld()->ServerTravel(TEXT("/Game/ThirdPerson/Maps/TestMap?game=/Game/ThirdPerson/OtherGameMode.OtherGameMode_C?listen"));
}
Hopefully this helps anyone who might want to change the game mode with server travel.
EDIT: So I was googling for this issue after a year long of not touching UE4 and found my own answer. Here’s a working project that is able to change game mode on seamless server travel. GitHub - Tinyted/June13UE4: Learning Project for UE4 (As of commit: be8806e364c1512c2f1c3145b604a030e53c4de0)