Skip to content

Instantly share code, notes, and snippets.

@citelao
Created March 30, 2014 18:55
Show Gist options
  • Save citelao/9877737 to your computer and use it in GitHub Desktop.
Save citelao/9877737 to your computer and use it in GitHub Desktop.
Sunstone protocol

Network Protocol

Sever acts as a "relay" of sorts (while still checking stuff is valid) All strings are UTF null terminated ("\0")

Mobs are treated by the client as differet "types" of players, types are also classes and the like (for drawing)

Action list:

  1. Join.

    • client: 1,johndoe,{type}
      1. username — player's name. We do not accept duplicate usernames on one server.
      2. type — ???
    • server: 1,johndoe,{type},124,12
      1. username — player's name.
      2. type — ???
      3. x — player's starting x co-ord.
      4. y — player's starting y co-ord.
  2. Movement.

    • client: 1,johndoe,123,12
      1. username — player to move
      2. x — new desired x position; the client should have nominal edge checking, but is verified by server.
      3. y — new desired y position
    • server: 1,johndoe,125,12
      1. username — player to move
      2. x - new x position; the server validates position and relays possible ones.
      3. y - new y position
  3. Map request.

    • client: 3
      1. N/A
    • server:
      1. x_size — size of map in x
      2. y_size — size of map in y
      3. bottom layer — see layers for explanation. layer names to be spec'd.
      4. mid layer
      5. top layer
    • layer: 4;2;1;4;1;4;1;2;6;0;0;0;0;0; ...
      1. tile — int value of tile followde by ;.
      2. repeat.
  4. Attack.

    • client:
      1. username — attacking player
      2. direction — attack direction
    • server:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment