Skip to content

mtcmorris/treasurewar

Repository files navigation

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 two tiles in every direction.
  7. You can can attack or move one tile per tick
  8. 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.
  9. You can't move to a location where another player is standing.

About

Treasure War runs over websockets,

Developing

Requires coffesscript

Messages

The Server

The server generates a tile based dungeon of configurable size

The server "ticks" every second 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

IMPORTANT: the tiles key in the json response is really what you want to look at, not the nearby_* keys

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: [{x: 1, y: 1, type: "wall"}, {x: 2, y: 1, type: "wall"}, {x: 2, y: 3, type: "floor"}, {x: 2, y: 4, type: "player"}, {x: 2, y: 3, type: "treasure"}, {x: 2, y: 3, type: "stash"}, ]

  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_items: [{
    x: 5
    y: 6
    is_treasure: true
  }]
}

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 item (treasure)

You cannot pick up treasure if you're already carrying treasure. Stand on top of treasure to pick it up.

Event: pick up

{ }

Move

Event: move

{
  dir: "n"
}

Drop item (treasure)

You cannot drop an item if you're not carrying an item

Event: drop

{ }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published