This is the repository for Space Rocks!, an entry to the Space Apps Challenge 2014. A live version of the project can be seen at http://www.spacerocksgame.org
The code for the game is in ./game_v1/
The code for the API is in ./astro_api/
The Space Rocks! API allows user to query for asteroids in a subset of the JPL Small Bodies Database (SBDB). The asteroids made available through the API are all those that have a known spectral type. In addition to the properties provided by the SBDB, we also add the total value and value per kg calculated by the Asterank library, and the calculated distance and delta-v from Earth on a given day.
The distance calculation is provided in ./astro_api/orbitcalc.py
. You can run the API locally by installing Flask
(pip install flask
) and running
python app.py
The endpoint of the API is http://server.spacerocksgame.org/get_asteroids_by_type and takes the following query parameters:
limit
: The number of asteroids to returnday
: The offset, relative to the current day, to calculate the distance and delta-v to Earthmin_dist
: A minimum distance to Earth cut (AU)max_dist
: A maximum distance to Earth cut (AU)none
: Fraction of asteroids to return which have no valuable resourceswater
: Fraction of asteroids to return which have watermetals
: Fraction of asteroids to return which have metalshydrogen
: Fraction of asteroids to return which have hydrogenplatinum
: Fraction of asteroids to return which have platinumAn example query: http://server.spacerocksgame.org/get_asteroids_by_type?limit=10&day=0&min_dist=0.5&max_dist=3.0&none=0.09&water=0.3&metals=0.3&hydrogen=0.3&platinum=0.01
This code is available under the GPL. If you'd like to use this code, or build a different version of the game using the codebase, please do!
The asteroid API has the following dependencies:
The game would not have been possible in a weekend without some amazing javascript libraries:
Thanks to our significant others for giving up weekends to drawid space ships, to NY Space Apps for hosting, to Jason Kessler and Rob Landis for asteroid advice, and to NASA for being wonderful enough to go chasing after asteroids in the first place.