How to send custom Launch paramater for a game session when request to create game session?

0

Hi everyone, i'm new to gamelift, and i need your help: When client request to create new game session, can I send custom launch parameters to specific game session? Thank you very much! REMOVEDUPLOAD

已提问 3 年前721 查看次数
3 回答
1
已接受的回答

I'm not sure about command line parameters but I know that when creating a game session, GameLift lets the client pass in data that can be retrieved by the server upon the start of the game session.

When you call createGameSession, you can pass optional parameters called GameSessionData and GameProperties that can both be retrieved by the game server hosting your game session, assuming it was created successfully. More about createGameSession can be found here, but keep in mind that other methods used to create a new game session also have these parameters or something similar, so you are not restricted to only using createGameSession. For example, startGameSessionPlacement takes in these two optional parameters as well.

The data would then be retrieved by your game server in the GameSession parameter passed to the onStartGameSession handler function that was defined by you in the ProcessParameters object passed to ProcessReady.

However, if you specifically need parameters to be passed at launch then I wouldn't suggest doing that through the client since the game sessions have to be hosted on server processes that are already running. You may be better off just creating separate fleets for specific server processes based on launch parameters and then have clients create a game session in the fleet that matches their request criterion.

已回答 3 年前
profile picture
专家
已审核 5 个月前
profile picture
专家
已审核 6 个月前
0

The launch parameter and game sessions are actually not directly related. Launch parameters are what launches the processes to wait for game session activation. So, when you create the game session, the processes should already be launched by your fleet's launch parameter, active, and ready to accept the game session.

Chris's suggestion in using the GameSessionData is correct; however, it does not work if you want to initialize the process with it, e.g. passing in the port to be used for calling "ProcessReady".

已回答 3 年前
0

I want to pass launch parameter to game server because my server use some parameter to decide which map should be played. But now I found another way to do that without passing launch parameter from client to server 😃 I'll check to use ProcessParameters and GameSessionData in game server as your suggession. Thank you very much!

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则