Remotely start new server instance

Hey Guys

I wonder if anybody can help me. What would be the best way to start a new server instance from my game code ?

Basically I want to start a new server instance ( MyServer.exe ) and then tell clients to connect to it. I have an idea how to implement telling the clients to connect to it, I just want to know how I’m able to start an external program from within my code.

Thanks
A

Maybe not exactly what you’re asking for but this is what we did to accomplish this:

*Create a custom server host platform, running on a server with a listen URL of some kind attached to a static port.
*The client will make a network connection to request a new server session to the host platform.
*The server host platform will spin up an instance of an Unreal game server in its own process and return the connection details (port information).
*The client will then connect directly to the game server (or through the host if you want to do some fancy tunneling).

I’m not aware of any unreal-specific way to start up instances of a server aside from just doing the work on my end. This is somewhat similar to a matchmaking server but we use the access pattern for spawning up specific instances for players to connect to.

I hope that helps somewhat

Thats about exactly what I had in mind, I just hoped that there was a way to start the server instance from within the code.

Looks like i’ll have to be creative :wink:

Hey Guys

Ok so i was able to solve it with help from google

#include <string>


        STARTUPINFO si;
	PROCESS_INFORMATION pi;

	ZeroMemory(&si, sizeof(si));
	si.cb = sizeof(si);
	ZeroMemory(&pi, sizeof(pi));

	std::wstring MyProgram(L"C:\\windows\\system32\\notepad.exe");

	// start the program up
	CreateProcess(MyProgram.c_str() ,   // the path
		NULL,			// Command line
		NULL,           // Process handle not inheritable
		NULL,           // Thread handle not inheritable
		false,          // Set handle inheritance to FALSE
		0,              // No creation flags
		NULL,           // Use parent's environment block
		NULL,           // Use parent's starting directory 
		&si,            // Pointer to STARTUPINFO structure
		&pi);           // Pointer to PROCESS_INFORMATION structure

Thanks!!! Helped a lot