How to configure Gamelift concurrent process for the server ?

0

Hi, I am trying to add concurrent server processes to my instance. I wonder how to make sure the activation succeeds for the instances with concurrent process. In my activation code for gamelfit in UE, IU hardcoded port 7777. How can I make this dynamic. I am not understanding the flow.

params->OnStartGameSession.BindLambda(onGameSession);

//OnProcessTerminate callback. GameLift invokes this before shutting down the instance 
//that is hosting this game server to give it time to gracefully shut down on its own. 
//In this example, we simply tell GameLift we are indeed going to shut down.
params->OnTerminate.BindLambda([=]() {gameLiftSdkModule->ProcessEnding(); });

//HealthCheck callback. GameLift invokes this callback about every 60 seconds. By default, 
//GameLift API automatically responds 'true'. A game can optionally perform checks on 
//dependencies and such and report status based on this info. If no response is received  
//within 60 seconds, health status is recorded as 'false'. 
//In this example, we're always healthy!
params->OnHealthCheck.BindLambda([]() {return true; });

//Here, the game server tells GameLift what port it is listening on for incoming player 
//connections. In this example, the port is hardcoded for simplicity. Since active game
//that are on the same instance must have unique ports, you may want to assign port values
//from a range, such as:
//int32 port = FURL::UrlConfig.DefaultPort;
//params->port;
params->port = 7777;

gameLiftSdkModule->ProcessReady(*params);

So how can I make sure the port I am selecting is the exact port at which matchmaking happened and the session is running?

1개 답변
0

Hello,

Thank you for reaching out.

Please note that, the port would be defined before session placement, and not the other way around. Hence, you can pass the port on the command line arguments of the fleet configuration and then use that when you call ProcessReady (instead of the hardcoded one). Each instance will have the exact processes you configure always be running and waiting for sessions, for example on ports 7777, 8888, 9999 and the backend will get info when placement is ready on which port (and process) on which instance (and IP) was allocated.

AWS
답변함 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠