Map Service Technical View
warning
#
Service-oriented Functions#
Create GameworldCreate new Gameworld (size is in correlation to player_amount). This REST call is used by the game service when a new game is created.
POST
http://{defaultHost}/gameworlds
Payload
{ "gameworld": { "player_amount": 100, "round_amount": 1000 } }
Gameworld creation response is sent via event in the channel: gameworld-created
Example Event payload
{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "spacestation_ids": [ "497f6eca-6276-4993-bfeb-53cbbbba6f08" ], "status": "active"}
#
Create Space StationAutomatically another event, that is saved by the trading service, is produced by the map service. In the channel spacestation-created every planetId is published, where you can find a space station. This information is used by the trading service to double check the trade commands that can be only placed on space stations and the robot service spawns the new bought robots according to this information only on space stations.
Example Event payload
{ "planet_id": "fe9732a9-b905-4934-8835-ed5a93494397"}
#
Get Planet InformationGet a single Planet including planet_type by id including the neighbours. This REST call the robot service is using for the movement action to get the information for the new planet the robot moved to. It also includes the neighbours for the neighbours event of the robot.
GET
http://{defaultHost}/planets/{planet_id}
Example Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "movement_difficulty": 0, "recharge_multiplicator": 0, "gameworld_id": "5bd7c16e-97a9-49f5-974e-307be5fc576d", "planet_type": "default", "neighbours":
[
{ "planet_id": "fe9732a9-b905-4934-8835-ed5a93494397", "movement_difficulty": 0, "direction": "north" }],"created_at": "2019-08-24T14:15:22Z","updated_at": "2019-08-24T14:15:22Z","resource":
{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "planet_id": "fe9732a9-b905-4934-8835-ed5a93494397", "max_amount": 0, "current_amount": 0, "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "resource_type": "coal" }
}
#
MiningsThe robot service is using this REST call to translate a mining command into a mining action. the amount requested is calculated by the robot service based on the robots mining upgrade level.
POST
http://{defaultHost}/planets/{planet_id}/minings
Request Payload
{ "mining": { "amount_requested": 1 }}
#
Player Relevant EventsThe player should be listening to two events:
First the result of a mining command to a robot is produced by the map service as an event in the channel: resource-mined. It contains the mined resource (of a certain resource_type) from a given planet, for one robot (with given transaction IDs which you can link to your commands), the actual mined amount and how much of that resource left on that planet.
Example Event Payload
{ "planet_id": "fe9732a9-b905-4934-8835-ed5a93494397", "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f", "resource_type": "coal", "amount_mined": 0, "amount_left": 0}
Secondly the resources are being automatically generated by the map service on random planets. These replenish resources (of a certain resource_type) on a given planet is sent via event. There is no information on how much of a resource has been generated. You can find this in the channel: resource-replenished.
Example Event Payload
{ "planet_id": "fe9732a9-b905-4934-8835-ed5a93494397", "resource": "d008879e-b5d9-47da-af4e-3c8f40b7c9ee", "resource_type": "coal"}