Open xtuc opened 6 years ago
@mikerah13 Done!
Lemme find some implementation pointers for a transport wrapper.
This is the js API wrapper: https://github.com/ByteArena/bytearena-sdk-javascript/tree/master/packages/bytearena-sdk-comm
An agent has to TCP connect to the game server at $HOST:$PORT
(env)
Each message is a single line of JSON (both ways) ended by \n
Now the protocol:
upon TCP connection, agent is expected to send a Handshake
message to the server
{ "agentid": $AGENTID, "method": "Handshake", "payload": { "version": "clear_beta" } }
($AGENTID comes from env)
Server responds with a "Welcome" message
{ "method": "welcome", "payload": { ... } }
The payload
is a specifications definition for the agent:
https://github.com/ByteArena/core/blob/193281a079227a085d65746de92da40156c6583a/game/deathmatch/deathmatch.go#L370
Structures in payload are described here: https://github.com/ByteArena/core/blob/9f327cfd67c0844537bd9f90733761947679ccb2/game/deathmatch/agentspecs.go
(note the json
annotations on properties; in Go this overrides the name of the property in the marshaled JSON, usualy to get rid of the camelCase)
In a transport wrapper it can safely be just parsed and passed to upper layers of the SDK as an opaque structure.
The agent is now in the game; when all agents have handshaked, the game begins
{ "method": "perception", "payload": { ... } }
In a transport wrapper it can safely be just parsed and passed to upper layers of the SDK as an opaque structure.
Structures within the payload are described here: https://github.com/ByteArena/core/blob/9f327cfd67c0844537bd9f90733761947679ccb2/game/deathmatch/agentperception.go
I think I would like to help with the python sdk, invite me to your slack ------@gmail.com