XorTag is tag like you used to play in school. But instead of you running around and getting sweaty, you write a program to do the running for you. It is meant as an exercise in programming, not as a definitive tag experience.
The term "xor" has nothing to do with the game. It's just a programming term that sounds cool.
So how do you play this game anyway? Good question. You'll need to have a few skills, including basic programming skills, the ability to make HTTP requests, and the ability to deal with JSON results you get from those requests.
You interact with the game by making HTTP requests. Every request you make will return a JSON object that looks like this:
{
"isIt" : true,
"mapHeight" : 30,
"mapWidth" : 50,
"name" : "Player 1000",
"players" : [
{
"isIt" : false,
"x" : 27,
"y" : 11
}],
"x" : 23,
"y" : 14
"id" : "1000",
}
Here is what the different fields on that JSON object mean:
id: The id for your player. You'll use it to make all your other requests to the game. That's how the game knows it's you, rather than that shady looking guy over there in the corner.
isIt: Let's you know if you are it or not. True means you're it, false means run for your life.
mapHeight: How many tiles wide the map is.
mapWidth: How many tiles high the map is.
name: Your player's name. Everyone's got to have a name.
players: An array of other players that are close enough for you to see. Each player has an X position, a Y position and whether or not they are it. If they aren't it and you are, get 'em! If they are it, run for it.
x: The X (horizontal) position of your player. The left-most column on the map is position 0. The right-most column is mapWidth - 1.
y: The Y (vertical) position of your player. The top row of the map is position 0. The bottom row is mapHeight - 1.
This is the first step you'll need to do. When you register the game will create your player, assign you an id, pick a name for you and put your player on the map. When you register you'll get back a JSON object (as described above) that will let you know what your id is and where your player is. To register you need to make an HTTP request to the following url:
https://xortag.azurewebsites.net/register
Once you are registered you can start moving your player around. This is the heart of tag. If you are "it", try to move towards other players and tag them. If you move to the same space where another player is, that counts as a tag. If you aren't "it", try to run away from the player who is.
You can move in any of four directions by making HTTP requests to any of the four urls:
https://xortag.azurewebsites.net/moveup/{your player id}
https://xortag.azurewebsites.net/movedown/{your player id}
https://xortag.azurewebsites.net/moveleft/{your player id}
https://xortag.azurewebsites.net/moveright/{your player id}
After the direction (moveup, movedown, etc.), add your player's id. That will make sure it's you moving your player and not some guy in Abu Dhabi.
When you move your player, you will receive an updated JSON object as a response to your request. You can use this information to keep track of where other players are on the map.
If you try to move to a tile and there's already a player there, you won't go anywhere. No piggybacking here.
You also can't move outside the map. There's no red pill in this game.
If you want to get an update on what's going on in the world, but don't want to lose the sweet spot you have claimed, you can do that by looking. To look, make an HTTP request to the following url:
https://xortag.azurewebsites.net/look/{your player id}
As with moving, make sure to supply your user id. Also, in response to your request you'll receive back an updated JSON object.
To make sure the server doesn't explode as players submit requests as fast as possible, each player can perform an action at most once per second. Moving and looking both count as actions. Registering does not count as an action. Any actions performed more frequently than once per second will be ignored. In this case an error (specifically a 429 error) will be returned instead of a JSON object. So your code will either need to not make requests too often or handle those errors.
Also, if your player is totally inactive for 5 minutes it will be removed from the game.
You can get some sample code on how to do all this here. If you just want to download the code (as a zip file) you can do that here.