This is Goblin War! This is a RESTful engine to build simple but strongly scalable roguelike games.
Installation is a classical one!
- Clone project
git clone git@github.com:enrike1983/goblin_war.git
- Install vendors (ensure to have Composer installed globally: )
composer install
-
Setup the database with your parameters.
-
Update the database with the schema
php bin/console doctrine:schema:update --force
- Load fixtures ( if you wanna try the app with an existing user )
php bin/console doctrine:fixture:load
- Run the server
php bin/console server:run
If everything went ok, you should be able to start doing all the stuffs written below
The game rules are very easy and very common for a roguelike:
- The World is a "chessboard" m x n ( configurable )
- Once the player is born he is free to explore the world using 4 simple commands ( forward, left, right, back )
- During the exploration the player could meet monsters with a certain probability.
- If the player begin fighting with a monster the battle starts and the user is not able to move until the fight has finished
- The Battle is a simple comparison of the attack skill of the player and the monster. The higher wins! :)
- If the player wins gains the experience "shipped" by the monster and is added to the current experience.
- If the player loses does not gain any experience and takes 5 points of damage
- If the energy of the player reaches 0 he dies and is not able to move any more! You need to create a new character
- The user can escape but with a certain probability it can fails! :D If you fail escaping... you will lose a bit of life
- Player attack value is auto generated when the player is created.
- Monster's attack value, experience and name are auto generated at runtime when the monster spawns.
- The world is a YAML file m x n where every "room" has its own properties ( to be implemented in future )
goblin_war/src/AppBundle/Resources/config/dungeon.yml
- Autosave! Every interaction your player does is directly persisted on the db, like a real MUD :)
This is a RESTful engine, there is not any working client developed at the moment.
Every interaction is supposed to be done using something like postman or another rest client.
To interact with the app you need to have a valid user and its X-AUTH-TOKEN for every request, authentication is stateless.
X-AUTH-TOKEN: ce7b96be7cf9dda41450b99af5a3eb3885aa8a1af442
Creates a new player
{
"player_profile": {
"name": "player@player.com",
"attack": 41,
"life": 0,
"x_auth_token": "123123123123"
}
}
Get the current position in the World.
{
"player_status": 3,
"message": "Loser :(",
"navigation": {
"forward": false,
"left": {
"name": "Forge",
"id": 1
},
"right": {
"name": "Jail",
"id": 3
},
"back": {
"name": "Laboratory",
"id": 5
},
"current": {
"name": "Summoning Room",
"id": 2
}
},
"player_profile": {
"name": "cicciz",
"attack": 30,
"life": 30
}
}
Make the player move forward and return the new position in the World
Similar to /api/movement/current-position
Make the player move back and return the new position in the World
Similar to /api/movement/current-position
Make the player move right and return the new position in the World
Similar to /api/movement/current-position
Make the player move left and return the new position in the World
Similar to /api/movement/current-position
Fight with the current monster
{
"player_status": 3,
"message": "Loser :(",
"navigation": {
"forward": false,
"left": {
"name": "Forge",
"id": 1
},
"right": {
"name": "Jail",
"id": 3
},
"back": {
"name": "Laboratory",
"id": 5
},
"current": {
"name": "Summoning Room",
"id": 2
}
},
"player_profile": {
"name": "cicciz",
"attack": 30,
"life": 30
}
}
Except for the common HTTP codes ( 4xx, 5xx ) Goblin War uses a set of custom codes shipped with the response to tell the client what happens:
const BATTLE_ERROR = 0;
const BATTLE_IN_FIGHT_STATUS = 1;
const BATTLE_USER_WINS = 2;
const BATTLE_USER_LOSES = 3;
const BATTLE_USER_ESCAPES = 4;
const PLAYER_IS_DEAD = 6;
const ESCAPE_SUCCESS = 7;
const ESCAPE_FAIL = 8;