Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK] Create a Python SDK #3

Open
xtuc opened this issue Dec 22, 2017 · 3 comments
Open

[SDK] Create a Python SDK #3

xtuc opened this issue Dec 22, 2017 · 3 comments

Comments

@xtuc
Copy link
Member

xtuc commented Dec 22, 2017

No description provided.

@MichealGoldman
Copy link

MichealGoldman commented Dec 22, 2017

I think I would like to help with the python sdk, invite me to your slack [email protected]

@netgusto
Copy link
Member

@mikerah13 Done!

@netgusto
Copy link
Member

netgusto commented Dec 22, 2017

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

  • Agent receives a message at each tick
    { "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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants