I’m currently tightening up my multiplayer, but I’ve noticed that when the host crashes, all clients remain in the world but obviously stop receiving updates. When the host crashes, they don’t have time to tell the clients that the game is ending - I can’t smoothly wrap things up for the players.
Are the clients every told about this? If so, where? I’d love to hook into / override it.
No, I would’ve thought that clients would be monitoring this (‘checking in’ with the server periodically), with a timeout, already. Obviously the host can’t tell anyone
My question was more ‘what is called when this ‘timeout’ occurs’ (if such a thing exists).
The engine does perform a heartbeat internally, and clients will be notified when a timeout occurs through the UEngine::OnNetworkFailure() event. If you’d like, you can add your own handler for this event, or you can subclass UGameEngine and override the HandleNetworkFailure function. See ShooterEngine.h and ShooterEngine.cpp in the ShooterGame sample project for an example of overriding HandleNetworkFailure.
By default the built-in timeouts are 60 seconds, but you can customize them in your DefaultEngine.ini file:
[/Script/OnlineSubsystemUtils.IpNetDriver]
InitialConnectTimeout=60.0
ConnectionTimeout=60.0
The InitialConnectTimeout is used when first trying to connect to a server, the ConnectionTimeout is used after a connection to a server has been established.
(This assumes you are using the default IpNetDriver.)