Where/how do clients know when the host has crashed?

Hey guys,

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.


The host ends execution unexpectedly, and you want it to expect this and let the clients know?

Only real option is to send a heartbeat from the server and time the client out if the gap between heartbeats (timeout) is too long.

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 :slight_smile:

My question was more ‘what is called when this ‘timeout’ occurs’ (if such a thing exists).

Ah, okay. Sorry for the misunderstanding.

Not sure if there is one or if you’ll have to roll your own, I haven’t spent enough time with the networking system to be certain.

you could have your own crash reporter sending a msg saying client crashed.

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:

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.)