AWS Architecture for a Simple Game Server to test programs, clients, etc.

Fred Damstra (Macbook 2015) 3a648f6aa3 List implemented 2 年之前
client 9a7891d9ec Stands up pretty good 2 年之前
terraform 3a648f6aa3 List implemented 2 年之前
.gitignore 9a7891d9ec Stands up pretty good 2 年之前
README.md 3a648f6aa3 List implemented 2 年之前
event.sample.json 3a648f6aa3 List implemented 2 年之前
login.sh c083e4abdc Starting to understand some things 2 年之前

README.md

Game Server

WARNING: This has been 100% done as a "let get this working and we'll tighten it down later" project. And as anybody knows, the later never happens. So be warned. Things are wide open. Like crazy open. Don't use this as a model if you care at all about security.

An API to play games. Used for researching AI clients.

Game Ideas:

  • 3D tic tac toe
  • euchre
  • ...?

Architecture

  • Cognito for user pool
  • API Gateway for web front end
  • Lambda for serverless
  • memcached for active games
  • dynamodb for persistent data

Clients

Clients can connect and wait for others to play, or they are welcome to play as more than one player.

We're on the honor system that no cheating/collusion will happen. Though maybe that makes for a fun future project. At the moment, I just want to try some strategies and AIs against each other. You do what you like. If you take pleasure in beating my software, go for it.

API Reference

Debugging

/echo: Supported Methods: GET / POST Purpose: Echoes back the event

/example: Support Methods: GET Purpose: Always returns {"a": "b"} as a simple test of functionality

From this point forward, only POST is supported unless otherwise specified

Main

/list: Supported Methods: GET / POST Purpose: Returns a list of games Returns: [ { game_id: STR, num_players: bool, tie_possible: bool, description: STR } , ... ]

TODO /join: Purpose: Request to join a game. Input: { gameid: NUM } Returns: { player_id: GUID, secret: GUID }

TODO /join/status: Purpose: Request Status of a join request Input: { player_id: GUID, secret: GUID } Returns: { status: pending/active/finished, game_id: GUID/null, recommended_refresh: NUM } recommended_refresh is a suggestion on how long to wait before another status check. Client may implement it's own backoff interval if desired.

Tic Tac Toe

TODO /ttt/state: Purpose: Returns the state of the game Input: { game_id: GUID } Returns: { current_turn: GUID(player_id)|DONE, 'X': GUID(player_id), 'O': GUID(player_id), current_board: 3x3array, winner: GUID(if done) } The 3x3array is an array of characters of either '', 'X', or 'O'.

TODO /ttt/action: Purpose: Plays a turn Input: { game_id: GUID, player_id: GUID, secret: GUID, x: NUM, y: NUM } x and y are the array positions you'd like to play Returns: { success: BOOL, win: BOOL, lose: BOOL, error: STR(only if success==false) }