Download

Dedicated server & Network questions :)

Hello !

I have few questions about Dedicated Server & Network.
First of all, I created a simple batch file to run client or server or both (you can find it here) because Editor start server and client in the same Level, and it’s hard to test some network stuff when your server start in your Main Menu :smiley:
If you have any idea to do the same in the Unreal Editor, I’ll be happy to learn that.

Now, I’m surprised to see that if I close my dedicated server console, clients are not disconnect, for him it’s a simple ping issue from PlayerMovement:
[SPOILER]

[/SPOILER]
Well, how to disconnect all players when server shutdown ? I think I need to override some function before GameMode was destroyed (like Rama suggested in this post).
I also find the “Return Main Menu” Node, and I don’t really understand how to use it :frowning:

Finally, I would like to know if it’s possible to input some command in my dedicated server console (this can be useful :)) and how to add custom commands.

Thank you in advance !

Cordially, Jackblue

Custom console commands is pretty easy.
Just add UFUNCTION(Exec) to the function



UFUNCTION(Exec)
void FooCommand();


As for disconnecting users, take a look at ShooterGame example.
The Return to main method calls an RPC method on the player controllers, so the server tell each client to execute this method.
See: AShooterGameMode::RequestFinishAndExitToMainMenu

But u should also register network failure delegates in case of a non-clean server shutdown (server crash …)
See: UShooterGameInstance::HandleSessionFailure