Disclaimer: This is a more technical post than what is currently in the sub I think, so if its out of subject it can be taken down. Also, since its about development of a game project I'm working on, I'm adding the promotional flare, even though at this point I'm not really promoting with this and more asking for feedback and ideas. Finally, yes I do use some AI to write code in this, but I think I do it in a not sloppy way, i review everything, write a lot myself too. (i know how to program ive been doing it for years before AI, but i have a day job, i wouldnt have time to do all of this on my spare time at a pace high enough to keep up with my patience). I also wrote this post all by myself, and wil always write text myself btw, i dont like ai writing.
To the point: I'm working on the core orbital solver system for my game. Its external to my game, so currently I test it via data plotting, which is why what I show here is plots or orbital maneuvers.
Whats new about my approach (i think), is that I do full N body simulation. Now, people who know ball are going to think this might be a bad approach for space sim games. KSP uses patched conics, and outer wilds with its n body simulation is limited to a short game duration to avoid system unstability due to its euler integration. Essentially its the problem of numerical integration of the N body system, which requires usually small time steps and is quite costly. I totally agree with that concern, but I'm gonna say thrust me on this one: I have an simulation stepping strategy that is very precise and quick. I dont want to say my exact technique since I think its essentially the main point of my game that makes it different, but to people who know things, yes its symplectic, yes it exactly conserves two body orbital mechanics whatever the time step is. (some might figure out with this what my strategy is).
to add proof to my claims, i attached two figures. the first one shows a simulated mission profile where a craft goes from low earth orbit to a low moon orbit. it fires three instant impulse maneuvers during this, one to escape from the earth, one mid course correction burn, and one final burn to circularise around the moon. (you see moon SOI, but dont worry, its not just patched conics when close to objects, even in the moon SOI N body effects are happening, I just show the SOI visually).
now, that first example is something you could do using patched conics approach like KSP does, so second example shows something new: going to a lyapunov orbit around the lagrange 2 point of the earth sun system (similar kind of orbit to what JST uses), and staying around it with small station keeping maneuvers (i dont show the station keeping maneuvers, but they happen every 30 days, and cost only a few m/s of delta V per year). I also include the moon in the simulation to add n body effects, to make it harder for the station to stay around its orbit. the total mission time is 465 days here.
if youre wondering yes i have a game prototype alongside this that works properly, its just not ready to show i think. but it works, you can do orbital maneuvers in a solar system and stuff. You can also land on planets seemlessly even if they're rotating (i use quadtree heightmap mesh generation so it refines closer to the surface). I just dont have any UI elements or ships/vessels into it, just planets star moon and orbital mechanics. also clouds from up close look really bad, i need to rewrite the whole cloud raymarcher. I use a fake solar system, here to test I used the real one to compare, but in a game id like a smaller scale like KSP to make things not too hard and frustrating. for eye candy, i added a view of one of the planets in the prototype, a 1200 km radius greenish atmosphere terrestial planets with thick clouds.
Discussion: sorry that was long winded, i tend to write like that (as a blog i would have added the images in between the text, but cant do that here). Now, I'd like to hear your opinions on what would make a good game using this gravity engine. How arcadey should it be since this is quite hard science stuff handling n body motion? I LOVE ksp, I love how it is approachable and has a satisfying gameplay loop of build, crash, build again, succeed, repeeat. its one of the main reasons why I play it instead of other harder space sim games, and would like to capture that. (i know the scope of this project is very high for a single dev, but oh well. id like to mitigate that, but i dont want to compromise too much on the vision).
Other question, currently I neglect solar radiation pressure and cap drag at a quite low atmosphere height, like 100 km. I also neglect J2 oblateness. Do you think I should add radiation pressure effects so light sails are possible? it will also make light but large satellites more unstable. Do you also think drag should very slowly affect satellites in relatively low orbits (< 1000 km for earth), like it does in real life?