A text based adventure game
The primary endpoint for the API is at /api/action.php
. This currently
accepts a url parameter called string
that should contain the URL encoded
action sent from the client. Note that this will eventually be a POST action.
API requests return a JSON string.
All requests, regardless of game state, will return a prompt
property that
should be printed to the screen. Often, an array of choices
will also be
sent.
Just some notes to remember for later.
Basic stats: Strength, Defense, Intelligence, Agility
Entities have "types" for initialization, each type correlates to a basic stat, and stats are built with modifiers based on type.
HP = (.5STR + .75DEF) * 2 + 5
MP = INT * 2 + 3
Stats are built based on: (1 + (DIFFICULTY / 20) + modifier) * LEVEL + RN(-1,1)
Attack Rate:
75 * (AGILITY / ENEMY_AGILITY) + 10
When sending data to the client, you can format it in a number of ways using a BBCode like format.
[b]Bold text goes here[/b] [i]Italic text goes here[/i] [u]Underlined text goes here[/u] [q]Quoted text goes here[/q]
You can also set colors with the same type of format.
[c1]This will be red text[/c1]
You can use 1-7 to set colors according to ANSI escape code colors.
1 - Red 2 - Green 3 - Yellow 4 - Blue 5 - Magenta 6 - Cyan 7 - Gray 8 - Orange
New lines can be sent in a number of difference ways. The recommended way is to use a "\n" to denote
a new line (which will be turned into "
" on the client). You also have the option of sending back
your prompt as an array. Each element will be turned into its own line.