Dedicated server console


I have a dedicated server running fine but im wondering what is the best way to execute console commands : doing stuff like changing the map, game mode, restart, or UFUNCTION(Exec) that a created.
I would like to do it on the server, i added -log as a command line and i was hoping to be able to use something like -console but it doesn’t seem to be available.
So for now the only way i found is to send a RPC from a client to the server and it works well, but it would be cool if i could use something like -console which opens a cmd window which allow me to write my commands inside it on the server.

Thx, have a good day.

You can define a UFUNCTION(Exec) to execute a console command.
Then add a Server RPC call to it.
Here is a example for you:


void MyConsoleCmd();

UFUNCTION(Server, WithValidation, reliable)
void MyServerRpc();
bool MyServerRpc_Validate();
virtual void MyServerRpc_Implementation();


void xxx::MyConsoleCmd()

bool xxx::MyServerRpc_Validate()
return true;

void xxx::MyServerRpc_Implementation()
//add your code for what you want to do on the server here

Hey, thx for the reply.
Im already using something similar, I have the client send a string to the server and the server looks at the string and execute the command that corresponds, it works fine but i would like to be able to have a console when i start the dedicated server and do it from there.

You’ll need some sort of a web-service to handle server interaction. For instance, you can create a queue of commands on your web-service to be sent to your server and have your server request this queue from time to time and execute these commands. The easiest way is to use HTTP requests. For instance, you can create a ‘change map’ command on your web-service, then you serialize it to JSON and put on a queue. Then after some time your server pokes your web-service to know if there are some commands to execute, the web-service create a response packet and then the server gets it and deserializes it to see if there are indeed some commands or is it just an arbitrary ‘empty queue’ message.

This solution is not ideal but it may work for your case.

Alright, this looks complicated, i will keep using RPCs for now. Thx for explanation Ian i might try to do it one day.

It’s really not, it may just seem so because it’s a wall of text with no code in it :slight_smile: Check out this thread, I might touch on this particular topic as well,

Oh yeah it’s you, i watched your youtube video the other day :), im subscribed to your channel waiting for your new tutorial :slight_smile: