Code Monkey home page Code Monkey logo

celestiary's Introduction

Celestiary

A celestial simulator inspired by Celestia (http://shatters.net/celestia), written in JS/three.js/GLSL.

A running instance of Celestiary is available at:

https://celestiary.github.io/

Features

  • Keplerian orbits (6 orbital elements)
  • Time controls, to alter rate and direction of time
  • Star colors based on surface temperatures
  • Star surface dynamics simulation (Perlin noise in black-body spectra)
  • 9 planets, 20 moons
  • Permalinks for positions
  • Howto guide for programming topics used in the app (see help/? screen in the app for the live howto guide)
  • Even kinda works on mobile! :)

Celestia datasets:

  • ~100,000 stars
  • ~3k star names
  • ~80 Asterisms/constellations

See open issues page for upcoming features.

Get

This project uses submodules, so make sure to get them when cloning:

> git clone --depth=1 --recurse-submodules https://github.com/celestiary/celestiary

This will download about 60MB, with the current directory being ~20MB, mostly in textures/. I'll probably filter most of the older versions in git soon.

Development

Celestiary is a static web app, and may be served directly out of its root.

For live editing, change the script tag that loads the app in index.html, from js/bundle.js to js/index.js.

See the following section to recreate the bundle.js.

Build (optional)

The live site uses a JS bundle efficiency. To generate and test with it:

> npm run build
js/index.js โ†’ bundle.js...
created bundle.js in 2.4s
> cd howto && npx rollup -c

The bundle.js file is referenced only in index.html in the script include. Switch that to js/index.js for live source editing.

Test

There are a few tests in files ending in: _test.js

~/celestiary/js> for f in *_test.mjs ; do echo $f ; node $f ; done
AsterismsCatalog_test.mjs
TOTAL OK: 1, FAIL: 0, ASSERTS: 2
StarsCatalog_test.mjs
TOTAL OK: 3, FAIL: 0, ASSERTS: 3

For larger changes, it's also a good idea to step through the guide pages (in /howto) to make sure they'll all working.

Run

Run a web server in the root directory and load index.html from there. The project includes https://github.com/pablo-mayrgundter/http, e.g.:

~/celestiary> java/http/net/http/serve.sh
net.http.Server.port=8080
net.http.Server.log=true
net.http.Server.index=index.html
net.http.Server.ssl=false
...

Alternatively with Node's http-server package:

~/celestiary> npx http-server -p 8080
Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://10.0.0.3:8080
Hit CTRL-C to stop the server

Now visit http://localhost:8080/index.html in your browser

Deploy

The app runs at https://celestiary.github.io/ and is in the celestiary.github.io repo. From it grab the changes from the web repo and then push them:

git pull upstream master
git push

Performance

A first-time session downloads ~3-5MB, mostly of the stars data. Planet textures are lazy-fetched as the user moves around the scene, but will bring that upwards to ~10MB in full.

Everything is highly cacheable, so subsequent visits are brief HEAD checks on root resources.

Warm load on a local server is 260B in ~300ms (mostly cache checking). Page rendering finishes by 1s.

celestiary's People

Contributors

pablo-mayrgundter avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.