Gamelift how to read the GameMode type from Flexmatch in GameMode.cpp Unreal?


Hi, So I have a server in Gamelift that have 3 game modes. How can I spin up the server with the game mode for which Flexmatch created the session? Lets say FlexMatch created a match for "1v1", How can I load the gamemode 1v1 for the game sessionthat's being created?

1 Answer
  1. Integrate FlexMatch with Your Game Server: Ensure that your game server is integrated with Amazon GameLift and configured to receive game sessions from FlexMatch. This typically involves setting up a listener in your game server to handle incoming connections and game sessions.

    2)Pass Metadata to Game Sessions: When setting up matchmaking requests with FlexMatch, you can include custom player attributes or matchmaker data that specify the desired game mode. For example, you can include a field like "gameMode": "1v1" in the matchmaker data.

    1. Handle Game Mode in Your Game Server: In your game server code, implement logic to handle the received matchmaker data and determine the appropriate game mode based on the provided metadata. This logic should extract the game mode information from the incoming game session details.

    4)Load Game Mode Content Dynamically: Once you have determined the game mode for the game session, load the corresponding game mode content dynamically in your game server. This may involve loading specific maps, rulesets, assets, or configurations tailored to the selected game mode.

    5)Start Game Session: After loading the appropriate game mode content, proceed to start the game session as usual. Your game server should now be running with the correct game mode for the match created by FlexMatch.

Here's a simplified example in pseudocode to illustrate the process: def handle_game_session(session_details): # Extract game mode from session details game_mode = session_details.get('gameMode')

# Load game mode content dynamically based on game mode
if game_mode == '1v1':
elif game_mode == 'TeamDeathmatch':

# Start the game session

def load_1v1_content(): # Load specific content for 1v1 mode # Load appropriate maps, rulesets, assets, etc.

def load_team_deathmatch_content(): # Load specific content for Team Deathmatch mode # Load appropriate maps, rulesets, assets, etc.

def load_default_content(): # Load default content if game mode is not specified or recognized # Load generic maps, rulesets, assets, etc.

profile picture
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions