Can't run more than one Concurrent processes (Unity,C#)

I’m using the unity game server example found : GameLiftServerCode.

I created a new fleet with this launch parameters :

"-batchmode -nographics -Port 7777"

Plus another configuration :

"-batchmode -nographics -Port 7778"

So i can run more than one server process but when creating the fleet i get an error saying :
“Server process started correctly but did not call InitSDK()”.
If i create the fleet with just one configuration then everything is working fine, but when i specify another configuration to run another server process then the error of “Server did not call InitSDK”
I also tried to create a fleet with one configuration and multiple concurrent processes where a server build checks to see if the server can’t run with the specify port then try the next one, that also didn’t work.

What do you think can cause this problem ?


using UnityEngine;
using Aws.GameLift.Server;
using System.Collections.Generic;
public class GameLiftServerExampleBehavior : MonoBehaviour
{
public void Start()
{
var listeningPort = 7777;
var initSDKOutcome = GameLiftServerAPI.InitSDK();
if (initSDKOutcome.Success)
{
ProcessParameters processParameters = new ProcessParameters(
(gameSession) => {
GameLiftServerAPI.ActivateGameSession();
},
() => {
GameLiftServerAPI.ProcessEnding();
}, () => {
return true;
},
listeningPort,
new LogParameters(new List<string>()
{
"/local/game/logs/myserver.log"
}));
var processReadyOutcome = GameLiftServerAPI.ProcessReady(processParameters);
if (processReadyOutcome.Success)
{
print("ProcessReady success.");
}
else
{
print("ProcessReady failure : " + processReadyOutcome.Error.ToString());
}
}
else
{
print("InitSDK failure : " + initSDKOutcome.Error.ToString());
}
}
void OnApplicationQuit()
{
GameLiftServerAPI.Destroy();
}
}

Hi @LnF, Sorry you’re running into this problem. As a first step can you try running multiple processes with GameLiftLocal?

What OS and EC2 Type are you using? I’ll try to reproduce your set up.

Ben

Hey @LnF,

Since GameLift will route players to specific game server processes based on both port and IP, you’ll want to configure each game server process to listen for game traffic on different ports. In this case it sounds like you want to run 3 game server processes per instance so your approach of starting at port 7777 then 7778 and 7779 looks good.

Hi @Ben, thanks for your reply here is what i did :

I tested it against GameLiftLocal which produced the same results.
In my original post i didn’t include the code for handling the System Args i’m passing to the server :

	public void Start()
{
var listeningPort = 7777;
var args = System.Environment.GetCommandLineArgs ();
for (int i = 0; i < args.Length; i++) {
if (args[i] == "-Port") {
listeningPort = int.Parse(args [i + 1]);
}
}
// ... rest of the code from above

I removed the code for handling the args then built 3 different servers with manually specifying the ports to 7777,7778,7779 after that everything worked out fine, so its defiantly related to the System Args, Although i did a test to see if this code is working and it seems that the server is getting the right port setting from the Args so i guess i need to check what’s wrong with that.

By the way can two servers run on the same port ? because i was able to run a server from the command line and then another one running in Unity with the same port and they both seem to be register fine.

Hey @MisterGameLift,

Yeah exactly that is the direction i’m going for, a multiple server processes per instances.

@Ben

I continued working on this, I built a server with the the System Args handling and tested it against GameLiftLocal.
I found out that if i build the same server build and copy paste the exe to a two different folders then it seems to be working fine. (with passing port args)
Can’t really point out what exactly is causing it…

My initial testing was on EC2 : c4.large, OS : windows 2012\Linux