Space bots [Beta]

Space Bots is a online massively multiplayer game playable through a REST API. No UI, no buttons, take out your HTTP client or the HTTP library of your favourite programming language and start playing Space Bots! The game is in beta at the moment, my goal is to create a game similar to Eve Online, with a heavy focus on player-generated economy and automatisation.

Roadmap

User area

Login with Google

API Docs

The API doc is available here: /docs

The OpenAPI file is available here: /openapi.yaml

Getting started

Login with the form above, and get your API token:

> export SPACE_BOTS_API_TOKEN=spbo_yourtoken
    

List your fleets:

> curl --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" https://space-bots.longwelwind.net/v1/fleets/my | json_pp
[
   {
      "cargo" : {
         "aluminium" : 10
      },
      "currentAction" : null,
      "id" : "00000000-0000-0000-0000-000000000001",
      "locationSystemId" : "omega",
      "owner" : {
         "type" : "user",
         "userId" : "00000000-0000-0000-0000-000000000001"
      },
      "ships" : {
         "miner" : 1
      }
   }
]
    

Get information about the current system

> curl --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
  https://space-bots.longwelwind.net/v1/systems/omega | json_pp
{
    "id" : "omega",
    "name" : "Omega",
    "neighboringSystems" : [
       {
          "systemId" : "sigma"
       },
       {
          "systemId" : "tashornia"
       },
       {
          "systemId" : "mega-torox"
       },
       {
          "systemId" : "legaka"
       }
    ],
    "station": {
        "directSell": true,
        "buyShips": true
    },
    "x" : 0,
    "y" : 0
 }
    
Notice that this system has a station where you can sell resources and buy ships.

Order you fleet to travel to a nearby system

> curl -X POST --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
  https://space-bots.longwelwind.net/v1/fleets/{fleet_id}/travel \
  -H "Content-Type: application/json" \
  --data '{"destinationSystemId": "mega-torox"}' | json_pp
{
	"status": "ok",
	"arrivalTime": "2023-11-05T12:01:22.794Z"
}
    

Get information about the current system

> curl --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
  https://space-bots.longwelwind.net/v1/systems/mega-torox | json_pp
{
    "asteroid" : {
        "miningResourceId" : "aluminium"
    },
    "id" : "mega-torox",
    "name" : "Mega Torox",
    "neighboringSystems" : [
        {
            "systemId" : "omega"
        },
        {
            "systemId" : "duovin-anaon"
        }
    ],
    "x" : 2,
    "y" : 2
 }
    

Notice that there is an asteroid that can be mined here for aluminium!

Order you fleet to start mining

> curl -X POST --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
  https://space-bots.longwelwind.net/v1/fleets/{fleet_id}/mine | json_pp
{
    "status": "ok",
    "finishTime": "2023-11-04T13:00:44.207Z",
    "duration" : 4
}
    

Check the state of your fleet (action will be filled before the mining is finished)

> curl --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
  https://space-bots.longwelwind.net/v1/fleets/{fleet_id} | json_pp
{
    "cargo" : {
        "aluminium" : 11
    },
    "currentAction" : null,
    "id" : "00000000-0000-0000-0000-000000000001",
    "locationSystemId" : "mega-torox",
    "owner" : {
        "type" : "user",
        "userId" : "00000000-0000-0000-0000-000000000001"
    },
    "ships" : {
        "miner" : 1
    }
}
    

Order you fleet to travel back to the origin system

> curl -X POST --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
  https://space-bots.longwelwind.net/v1/fleets/{fleet_id}/travel \
  -H "Content-Type: application/json" \
  --data '{"destinationSystemId": "omega"}' | json_pp
{
	"status": "ok",
	"arrivalTime": "2023-11-05T12:01:22.794Z",
    "duration": 4
}
    

Sell the product of your hard labour

> curl -X POST --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
  https://space-bots.longwelwind.net/v1/fleets/{fleet_id}/direct-sell \
  -H "Content-Type: application/json" \
  --data '{"resources": {"aluminium": 1}}' | json_pp
{
    "status" : "ok",
    "creditsGained" : 10
 }