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

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!

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.

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”.

1 Like

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 :smiley:
I’ll check to use ProcessParameters and GameSessionData in game server as your suggession.
Thank you very much!