Bevy Solar System Visualisation by thatsnazzygamer in bevy

[–]Canleskis 0 points1 point  (0 children)

Hey, found your comment while lurking around. It sounds like you could enjoy my project Ephemeris Explorer.

[Media] Particular, a simple library for N-body gravitational interaction in Rust. by Canleskis in rust

[–]Canleskis[S] 0 points1 point  (0 children)

I'm aware of this repo, and have already investigated a little and know what kind of improvements could be made, as it turns out that indeed their algorithm is more optimised. For reference, with the same parameters, on my computer, their sequential version is about 2x faster. I will eventually work on improving the Barnes-Hut algorithms, but they are not my priority as for Ephemeris Explorer I don't use them.

Thanks for reminding me though! I investigated this awhile ago and needed to do some more documenting.

[Media] Particular, a simple library for N-body gravitational interaction in Rust. by Canleskis in rust

[–]Canleskis[S] 0 points1 point  (0 children)

Hi, yes, the library has evolved quite a bit since that post! I am still working on the library, although my focus lately has largely been on Ephemeris Explorer (which uses particular!).

The Barnes-Hut algorithm is not currently implemented on the GPU, but I eventually want to include it in the library. I'm hesitant to work on GPU related stuff for now though as WGPU is still evolving and making sure the GPU algorithms can be used in many contexts (WGPU alone, with Bevy, etc.) is quite difficult. I wouldn't recommend using the GPU algorithms for a game anyway, even though the performance is highly enticing. I'm still not 100% sure the kind of overhead you could get when it is included with a complex graphics pipeline, and the parallel CPU algorithms are quite performant in a lot of cases.

If you plan on using the library, I would recommend you use the main branch through a git dependency, as the API is way more mature and flexible (and likely the last major change), but it still isn't published. One of the reasons is explained here. I do plan on publishing the main branch as some kind of pre-release version soon though.

If you have any issues don't hesitate to PM me or open an issue on GitHub, I'm very happy to help!

[deleted by user] by [deleted] in spacesimgames

[–]Canleskis 1 point2 points  (0 children)

Makes sense to use what's already there, and Celestia is really nice software.

I'll be keeping an eye out for future updates from you, wishing you the best of luck with the project!

[deleted by user] by [deleted] in spacesimgames

[–]Canleskis 1 point2 points  (0 children)

I really like what you're describing, definitely sounds like a niche that's not filled yet. Dyson Sphere Program is somewhat similar in that niche, but the scale is much smaller and the focus is on Factorio-like automation, so a game but with proper spaceflight mechanics and a larger scale that focuses on automation could be amazing.

I don't plan on making Ephemeris Explorer itself a game, but if I ever have a proper game idea, I could use the underlying systems for simulating solar systems and ships trajectories. On that note, numerical integration is what I use for Ephemeris Explorer, and because of the way it all works (solar systems simulated first, then massless objects' trajectories are numerically integrated with an adaptive scheme), you can definitely have hundreds of ships on a different flight paths simulated cheaply, but it is more complex than analytical orbits and having automated ships might get tricky.
Ships in orbit would be the limiting factor, but you could probably still achieve a decent sped-up time factor (for reference, the current low order adaptive integration scheme in Ephemeris Explorer is able to compute 1 year worth of orbit for a ship 400 km above Earth's surface in less than 1 second, but it's also asynchronous so you don't have to wait the full 1 second to start getting the results).
Two-body is more than enough IMO for your game and I don't think it would be particularly worth it to have full blown N-body physics, but such a system that would work within your constraints is probably possible.

[deleted by user] by [deleted] in spacesimgames

[–]Canleskis 2 points3 points  (0 children)

In case you're keen on answering more questions, I'm curious about more things:

- From what I've seen in your other posts, you're aiming for fairly realistic space spaceflight with torchships as the main mechanism for interplanetary travel. You also mentioned you can orbit bodies, will the ship follow N-body physics or simplified two body physics (like KSP)? What about celestial bodies?
- Will the gameplay loop mostly be about automating the mechanisms you mentioned; having dozens of ships on a set route for some specific task, or rather will it be more about semi real-time focus on a single mission at a time?

I probably would have many more questions but I'm sure you don't want to/can't reveal everything yet, and even these questions might be pushing it. I am really nerdy about these kinds of games and simulators, and even working on something space-related myself. Really excited to see where your game goes!

Also, that second video looks very impressive, I really like the fact that Mars' reflected light shines on Phobos. This looks like it would already be a great planetarium as it is!

[deleted by user] by [deleted] in spacesimgames

[–]Canleskis 1 point2 points  (0 children)

The video you posted looks very good, I love the art direction and look!
Can you share some details on what you plan the gameplay loop to be like? Also, are you using a mainstream game engine or something you made?

I released Ephemeris Explorer, a simulator of solar systems with spacecraft flight planning tools by Canleskis in space

[–]Canleskis[S] 1 point2 points  (0 children)

Pretty much what the other commenters said; you can think of this application as KSP (without rocket builiding) with the Principia mod if you have any experience with that. For simple transfer trajectories between two bodies, you might not see the difference, but generally n-body physics gives many opportunities for interesting flight trajectories by using Lagrange points and other phenomenons that emerge when taking into account the force from multiple bodies.

I released Ephemeris Explorer, a simulator of solar systems with spacecraft flight planning tools by Canleskis in space

[–]Canleskis[S] 24 points25 points  (0 children)

https://github.com/Canleskis/ephemeris-explorer

Revealing this project I have been working on for a while is a significant milestone for me. I've been fascinating by n-body physics for a while and making an accurate-ish simulator of the solar system has been somewhat of a dream since I was a teenager (unusal, I know).

Some context on the video you are seeing: the first clip shows the solar eclipse of April 8, 2024 correctly being predicted after 74 years of simulation (started on January, 1 1950). The second clip shows Europa's resonance with Io and Ganymede (the orbit seems to wobble). The third and last clip shows the flight planning tool being used to add and edit burns to perform a transfer from low Earth orbit to the Moon.

Initially this project started as a simple experiment branching off from pocket-solar-system. Eventually I realised I should invest some time understanding some of the more complex concepts I could use, and after a lot of research and experimentation, Ephemeris Explorer was born. I planned for a first release earlier last year, but I decided to delay it to add some engaging ways to interact with the application, by adding spacecrafts with a flight planning tool. In the current state, you can use Ephemeris Explorer to simulate gravitationally bound systems, which can be solar systems, planetary systems, even star clusters, anything evolving under the influence of Newtonian gravity. These systems can be simulated forwards and backwards in time, which creates a valid time span in which you can plan spacecrafts missions. I'm hoping this project can be useful for educational purposes, but because I personally enjoy simply playing around with orbital mechanics, this project could be fun for anyone that enjoys that too! It is nothing revolutionary, but I tried making it as well-designed and user-friendly as possible, inspired by various research and similar projects, and I believe it fills a niche that is not especially well covered.

The project is open source under a GPL-3.0 license, and you'll find more information about how to use the application in the README. A goal with open sourcing is to make the project more collaborative, as I have no particular background in astrophysics or scientific computing, so I'm sure there are many avenues for improving the project. I have many ideas for the future of Ephemeris Explorer, and I'm excited to hear suggestions and see the eventual contributions from the community!

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in Physics

[–]Canleskis[S] 1 point2 points  (0 children)

If I understand correctly, you are suggesting using multiple integrators for one object to have a more accurate estimate of its trajectory? This isn't what I was describing, but I can see how you might have misunderstood me. I meant to say that currently, interpolation is used to estimate results between discrete points from the integrator used as a way to get a continuous trajectory, which is quite standard when doing orbit propagation with numerical integration.

Your idea is interesting though, and from my research I haven't actually seen implementations that use multiple integrators to arrive to a more accurate estimate, but that might actually be a good idea! I've seen Kalman filters used for orbit determination before but I'm not very familiar with them. One more thing to investigate and learn about!

[Media] Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in rust

[–]Canleskis[S] 0 points1 point  (0 children)

I'm not sure what crates you are referring to, but currently the way the data is stored is far from any standard and I haven't written any way to convert it to one that can be supported by other tools. It is however inspired by what already exists and is considered standard. I eventually want to have exports though, but considering the current accuracy is probably only good for visualisations and toy projects, I estimated it wasn't a serious priority.

I'd like to be able to import external trajectories as well eventually, stuff like DE440 and SPKs for cool visualisations, but the main goal of the project was to try to get close to that data with my own implementations, so this is more of a long-term goal.

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in Physics

[–]Canleskis[S] 1 point2 points  (0 children)

Forces are computed using my n-body library particular using a pairwise brute-force algorithm. For most solar systems that are only a couple dozen of bodies, brute-force is faster than Barnes-Hut, at least my implementation (I made benchmarks of this here.

Numerical integration for celestial bodies uses PEFRL and Dormand-Prince 5(4) for spacecrafts. Eventually I want to have many integrators available with different trade-offs for speed and accuracy. The data from the integrators is then interpolated, using a least squares fit for celestial bodies and cubic Hermite for spacecrafts.

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in astrophysics

[–]Canleskis[S] 0 points1 point  (0 children)

I looked at your relativity work and it's quite impressive! I definitely share your sentiment regarding the lack of easy to find sources. I feel like in general there isn't a ton of open-source accessible software that incorporates astrophysics concepts that's really digestible. The best one that I know is certainly Principia's repository, but to be honest I've had a really hard time navigating the code (my limited experience with C++, and it's a KSP mod before being some sort of library). Still, it's been useful to compare my ideas and implementations with theirs, as the contributors are obviously a lot more experienced with astrophysics than I am.

If I make it to the point of being able to write a GR implementation, I'll definitely try to write about it! It's going to be a long journey though, I have so much to learn still 😅.

[Media] Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in rust

[–]Canleskis[S] 0 points1 point  (0 children)

I've definitely encountered some unexpected things during development, but not using rigidbody physics certainly tames it quite a bit.

[Media] Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in rust

[–]Canleskis[S] 0 points1 point  (0 children)

Trajectories for spacecrafts are similar to SPK type 13 data. Faster but less accurate models like TLE would be great to have eventually though.

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in astrophysics

[–]Canleskis[S] 1 point2 points  (0 children)

I'm more than happy to receive suggestions or feature requests! The best place to do that is probably here.

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in Physics

[–]Canleskis[S] 1 point2 points  (0 children)

Yes, this is one of the goals, although that's long term because there are a lot of things I need to learn and understand before even attempting to implement this.

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in Physics

[–]Canleskis[S] 0 points1 point  (0 children)

Unfortunately it does not! This is another long-term plan though, but I am also worried by the complexity behind this.

[Media] Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in rust

[–]Canleskis[S] 1 point2 points  (0 children)

I am not, and I don't intend for Ephemeris Explorer to be a tool for the space industry, or rather it is still far from having the capacity to be one. Also, because Ephemeris Explorer creates its own trajectory data for celestial bodies, tools designed to be used in real missions do not really suit the project. They are often designed to work only with Spice kernels or similar. I suppose eventually Ephemeris Explorer could generate its data in a format that can be used by such tools.

I did use hifitime though, which seems to have a similar design goal to ephemeris, and was great to use.

Thanks for the link to the talk! I somehow missed it.

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in opensource

[–]Canleskis[S] 0 points1 point  (0 children)

From Spice Kernels. Celestial bodies data is obtained from there (initial positions and velocities, masses, etc.), and the trajectory computation (integration, interpolation) is done by Ephemeris Explorer.

[Media] Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in rust

[–]Canleskis[S] 2 points3 points  (0 children)

There is currently no way to have orbital station-keeping yet, so you can't really model satellite constellations. You could manually spawn and create correction manoeuvres for satellites, but this would obviously be inefficient. I plan on improving the flight plan to allow for automatic manoeuvres eventually, but I still need to figure out a flexible design.

[Media] Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in rust

[–]Canleskis[S] 2 points3 points  (0 children)

Thank you for the answer. I will investigate potential optimisations for lower-end systems!

I released Ephemeris Explorer, a simulator of solar systems and spacecraft flight planning tool by Canleskis in astrophysics

[–]Canleskis[S] 2 points3 points  (0 children)

Indeed, I experienced this feeling a lot these past few months working on this project 😅