Testing
A host migration closes the host's game and turns a client into a host. Test with separate game processes, one per player, rather than several players inside one editor process.
Local, Null adapter
Set Adapter Class to Null and start several standalone instances from the command line:
UnrealEditor.exe "C:/Path/YourGame.uproject" /Game/Maps/YourMap?listen -game -log -windowed -ResX=960 -ResY=540
UnrealEditor.exe "C:/Path/YourGame.uproject" 127.0.0.1 -game -log -windowed -ResX=960 -ResY=540
Start the host first, then two or more clients. Wait a few seconds (one snapshot interval), then close the host
window. Watch the clients' logs for LogHostMigration:
LogHostMigration: Host lost (ConnectionLost: ...); starting migration
LogHostMigration: State Running -> Electing
...
LogHostMigration: Restored player ... (with pawn)
The Null adapter has no presence and no announcements: clients assume the successor is up after a short delay, and lost-connection handling (rejoin, split brain) does not apply. Use Steam to test those.
Steam
Steam needs one Steam account per machine. Package a Development build, start it on two or more machines, put all players in the same Steam lobby, start the match and close or kill the host. See Steam.
Automation tests
The plugin ships with automation tests (snapshots, deltas, components, references). Run them from
Tools → Session Frontend → Automation, filter on HostMigration. From the command line: -ExecCmds="Automation RunTests HostMigration; Quit".
Tips
- Bind On State Changed and print the state to see where a migration is.
- Get Snapshot Stats shows snapshot sizes and traffic. A summary is also logged every 30 s.
HostMigration.Debug.DropEveryNthDelta N(console variable, client) drops deltas on purpose to test resyncs.