I am so excited to share this with you!
JS-Space a tool/game that will generate a mostly-realistic galaxy from a seed, then let you navigate around it to view the various stars within the galaxy. It’s designed to work well on computers and mobile devices.
How to Use:
- Use the arrow keys on screen, or on your keyboard to navigate about the galaxy.
- Click/tap on a star to view it’s details.
Some Neato Features
- It’s Open Source!
- Only vanilla JS was used, no jQuery or anything else.
- Alter the config.json to change the number of sectors that are generated, min distance between generated stars, etc.
- The Sector View window is calibrated on page load, so on your phone try loading it in portrait vs landscape mode to see different layouts.
- All the star details are mostly realistic main sequence type stars, with appropriate percent chance of existing. (Class M are much more common than class A, for example.)
- You can pass in a seed via the URI. For example: https://js-space.graviton.systems/?seed=reverse_the_polarity . Otherwise it uses the default seed.
- No images are used, it’s all done via CSS and/or HTML Canvas elements
- The entire payload of this is less than 25kb! (when accounting for gzip)
Here is how it looks on a mobile device:
Why Did you build this?!
A great question. 🙂 Initially I wanted to make a MMO 2D Space game. I still want to do that, but after working on this early prototype, I am convinced I don’t want to do it in JS. Still, I learned a lot from this and definitely upgraded my JS skills.
Do you plan on developing it any farther?
I am thinking about adding the System View, so after you click on a star, you can also view the system of planets surrounding the star, click to get their info, etc.