What is the best approach to make an Editor running in one PC (server) receive commands from other PCs and process them? The Editor opened in server won’t have any game running so this example is not really what we want. Is there a way to set a Web Service? Maybe with JsonRPC?
Thanks in advance.
UE4 don’t have HTTP server, you need to use something external and sync it with other medium like text files or MySQL (but Ue4 does not support that eithe, you could need to code support on your own)
Thank your very much. I will check all this information.
You can use the Messaging system.
The Editor would host a service that is able to receive command messages. Other applications could then discover this service and send command messages to it. Take a look at how FEngineService is implemented, in particular for the FEngineServiceExecuteCommand message. This is what we currently use in Unreal Frontend to send console commands to instances of games and servers.
If you simply want to execute console commands remotely, you could probably reuse the existing FEngineService service. Discovery of this service is handled through the FEngineServicePing and FEngineServicePong messages.
Please note that the we currently disable the Messaging system in Shipping builds of games. It will work fine in Debug and Development though.
Messaging is a rather large topic. There is some initial documentation here: IMessageBus | Unreal Engine Documentation
I finally could get this done by reusing FEngineService as you suggested. I am modifying code in Unreal Frontend in order to parse commandline arguments and get a valid ISessionInstanceInfoPtr with which I can run ExecuteCommand function.
I am again facing a new problem. When I launch UFE having Unreal Editor already opened and this code gets executed:
ISessionServicesModule& SessionServicesModule = FModuleManager::GetModuleChecked<ISessionServicesModule>("SessionServices");
ISessionManagerPtr SessionManager = SessionServicesModule.GetSessionManager();
for (int32 Index = 0; Index < Sessions.Num(); ++Index)
for (int32 Jndex = 0; Jndex < SelectedInstances.Num(); ++Jndex)
SelectedInstances[Index]->ExecuteCommand(ConsoleCommand + " " + Params);
CurrentState = Started;
The Session Instance we are finding is, SOMETIMES, not the correct one (some data is not properly filled) and “ExecuteCommand” method is called but not achieving communication with editor.
Would this work for game instances, too? I would like to remotely control my game (on the server) from my PC (client).
Also, the link is dead.
Yes, this also works for game instances, but we currently disable the UDP transport in games by default. You’ll have to pass -messaging on the command line to enable it.
Also, keep in mind the the UDP transport only works on the same physical subnet. If you want to use it across different subnets or over the internet, you’ll have to configure a TCP tunnel. This can be done in the project settings for the UDP Messaging plug-in. There is currently no documentation for this feature, but you can probably figure it out. If not, come back here.
Thanks, I fixed the link.
The session details are populated using different messages. It is possible that not all information has been received yet when the session is first discovered.
There is some basic security checking for ExecuteCommand. The remote user has to be the same as the local user. If the user name differs, you’ll have to session auth it on the server. Check the session console command on the server for details.