AWS Architecture for a Simple Game Server to test programs, clients, etc.
|
2 年之前 | |
---|---|---|
client | 2 年之前 | |
terraform | 2 年之前 | |
.gitignore | 2 年之前 | |
README.md | 2 年之前 | |
event.sample.json | 2 年之前 | |
login.sh | 2 年之前 |
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:
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.
/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
/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.
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) }