Dedicated Server and Console Commands (Exec, Cvars)

Can a dedicated server execute console commands at runtime (CVars and Exec UFUNCTIONs)? If so, how simple is that?

Im asking this before setting up a dedicated server and finding out I would have to rely my console commands on RPCs

Anyone? (aka bump!)

Yes, a common method is to send the commands via the deferred command list.


GEngine->DeferredCommands.Add(TEXT("SomeCommand"));

Not sure what you mean by "RPC, you are already on the server?

If you want to execute a command from a client on the dedicated server you need to send an RPC with the command.

Exactly as you said =) clients calling the exec function and being sent to Server functions.

My ideal scenario is to be able to call the methods via the Dedicated server console window or changing cvars while running. Otherwise it would be only possible through clients’ game window.

Is it possible this manner?

Edit: DeferredCommands are hardcoded, my idea is to be able to change at runtime

The dedicated server does not have a console, what you see is a window with the log printouts. So you need to send the command from the client via RPC and then “Exec” it on the server. The DeferredCommands is just a list of FStrings, you add to it in runtime, they are not hardcoded.

Got it now. Thank you!