ByteArena / community

Questions/help regarding the Byte Arena platform 🤖🚀
https://bytearena.com
4 stars 0 forks source link

[SDK] Create a Python SDK #3

Open xtuc opened 6 years ago

MichealGoldman commented 6 years ago

I think I would like to help with the python sdk, invite me to your slack ------@gmail.com

netgusto commented 6 years ago

@mikerah13 Done!

netgusto commented 6 years ago

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:

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

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