Skip to content

Instantly share code, notes, and snippets.

@mtcmorris
Created November 14, 2012 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtcmorris/4071163 to your computer and use it in GitHub Desktop.
Save mtcmorris/4071163 to your computer and use it in GitHub Desktop.
Treasure war readme

Treasure War

Inspired by brains - write a bot that finds treasure, kills people and claims glory.

Game rules

  1. You spawn at your stash.
  2. You can navigate and pick up treasure which you can return to your stash for 10 points.
  3. Players can steal treasure from your stash and you lose 10 points.
  4. You earn 1 point for each player you kill.
  5. When you're carrying treasure you can't attack.
  6. You can see one tile in every direction and can move/attack to anywhere you can see.
  7. You can make an action (attack/move/pick up treasure/drop treasure) at most once per 2 seconds. Last command wins and invalid moves will be discarded.

About

Treasure War runs over websockets,

Messages

The Server

The server generates a tile based dungeon of size (errm)

The server "ticks" every two seconds in which you may make a move. When the server ticks it runs the following logic

  • Evaluate any attacks
  • Kill any players that are dead
  • Process any moves/treasure pickups
  • Respawn any dead players at their stash
  • Send tick results

On connect/tick:

{
  you: {
    name: 'unnamed coward',
    health: 100,
    score: 0,
    carrying_treasure: false,
    stash_location: {
      x: int,
      y: int
    }
    position: {
      x: int,
      y: int
    }
  }
  tiles: {
    n: " ",
    ne: "W", //Wall
    e: " ",
    se: " ",
    s:  " ",
    sw: " ",
    w:  "W",
    nw: "W"
  }
  nearby_players: [
    {
      name: "@mtcmorris",
      health: 55,
      score: 4,
      carry_treasure: false
      x: 3,
      y: 4
    }
  ],
  nearby_stashes: [{
    x: 4,
    y: 4
    name: "@mtcmorris",
    treasure: int (3)
  }],
  nearby_treasure: [{
    x: 5
    y: 6
  }]
}

Your messages

You may send the server one message in every tick interval. The server will accept the last message you send it if you send multiple messages. Each move must specify a direction

You can perform any of the following actions:

  • Attack
  • Pick up treasure
  • Throw treasure
  • Move

Attack

You cannot attack when you are carrying treasure

Event: attack

{
  dir: "n"
}

Pick up treasure

You cannot pick up treasure if you're already carrying treasure

Event: pick up

{
  dir: "n"
}

Move

Event: move

{
  dir: "n"
}

Throw treasure

You cannot throw treasure if you're not carrying treasure

Event: throw

{
  dir: "n"
}
@richo
Copy link

richo commented Nov 14, 2012

Looks awesome, shame I can't make it :(

@benhoskings
Copy link

Oh shit, I didn't realise you can't make it @richo :(

@benhoskings
Copy link

Also Mike, this looks cool.

@gabehollombe
Copy link

Spiritual successor to Brainz AND Glove, baby. You want someone to hack on some of it, I'm game, dawg.

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