https://github.com/dimasmith/planets
Toy simulation of planetary motion
https://github.com/dimasmith/planets
hecs piston rust
Last synced: 4 months ago
JSON representation
Toy simulation of planetary motion
- Host: GitHub
- URL: https://github.com/dimasmith/planets
- Owner: dimasmith
- Created: 2020-05-18T20:47:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T19:40:57.000Z (over 2 years ago)
- Last Synced: 2025-04-03T21:44:00.236Z (9 months ago)
- Topics: hecs, piston, rust
- Language: Rust
- Homepage:
- Size: 8.89 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Planets
A simple visualizer of planetary motion based on Newtonean mechanics.
Main intent of the project is to get some familiarity with Rust.
## Running
You can describe a simulation using [.ron](https://github.com/ron-rs/ron) files with the parameters.
See assets directory for examples.
Place compiled planets binary next to the `assets` directory and start it.
## Simulation controls
* `,` - slows simulation down;
* `.` - speeds simulation up;
* `p` - pauses/resumes simulation;
* `mouse wheel` - zooms in/out;
* `esc` - exit simulation;
## Cli parameters
See cli help for details
```shell
planets --help
```
### Control resolution
The simulation runs in the fullscreen mode by default.
You can change it to windowed mode via the `--windowed` flag.
You can control the resolution using the `--resolution=800x600` flag.
Note that when running in fullscreen mode on some systems the resolution might be igored.
The OS might start simulation in a native screen resolution.
## Internals
The project uses [piston](https://www.piston.rs/) engine for rendering.
World is built with [hecs](https://github.com/Ralith/hecs) - nice implementation of ECS pattern.
## Issues that will immediately kick you
* Paths to assets and file names inside are hardcoded.
## Good words for
* JetBrains - for CLion and JetBrains Mono font
* Kerbal Space Program - for inspiration and a ton of fun :)
## Plans
* Fix immediate usage issues;
* Use patched conics for orbit prediction (and, possibly, for simulation as well);
* Change camera focus;
* Detect collisions;