GameLift Sample Code


Does a collection of GameLift service samples exist? I'm developing a Battle Royale game in Unity using the Unity Plugin for GameLift and I have the basics functioning.. starting with CloudFormation template deployment, FlexMatch with game session queue, and automatic backfill. Now I'm starting to build a Lobby system, where a player can create/join/apply to join/invite to join other online clients.

This seems like something that should exist in sample code (CloudFormation template, Lambda files, DynamoDB tables, SNS Topic Event Handlers, etc.). Does it?

I may have it built and working by the time I get a response here, but here's what I'm thinking.

LobbyTable LobbyId PlayerId # lobby owner TicketId # matchmaking ticket id

PlayerLobbyTable PlayerId LobbyId

Lambda functions to handle setting up a table items when a player: creates a lobby # creates LobbyTable item for PlayerId as owner application/invitation is accepted # creates PlayerLobbyTable item for PlayerId leaves/booted from lobby # deletes PlayerLobbyTable item of leaving PlayerId, picks new lobby owner and assigns if anyone remains in lobby or deletes LobbyTable for LobbyId if no players remain change lobby owner # changes LobbyTable PlayerId to new lobby owner update matchmaking ticket id # when FlexMatch MatchmakingSucceeded event, add IpAddress, Port, DnsName, etc. attributes to LobbyTable item, send message to all players in lobby that the matchmaking succeeded.

Thank you.

asked 2 years ago691 views
1 Answer

We have a great example of an serverless backend with AWS Gamelift that uses FlexMatch. The example has been written for Unity and also contains a C++ example aswell. In this sample you can view the Cloudformation templates used to deploy the backend and game servers.

You can see find the Multiplayer Session-based Game Hosting on AWS sample on Github.

Just leave a comment below or post a new question if you need more help.

profile pictureAWS
answered 2 years ago
  • I already have a FlexMatch game system working. I'm specifically asking about a Lobby system. Is a lobby system part of this example you've referenced?

  • Is there any sample with UDP?

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