pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.62k stars 376 forks source link

Frame of reference changes incorrectly (including an orbit) #4988

Open gitcior opened 3 years ago

gitcior commented 3 years ago

Hello,

This is a bug report.

Observed behaviour

The frame of reference changes from the planet I'm orbiting to the main system's sun, in this case from Uracka-C to Uracka. Following the change, my orbit gets changed from a approx high circular orbit around the planet of Uracka-C to a long elliptical orbit around the Sun of Uracka. This is happening while in the manual engines mode with all engines cut off, and the trajectory planning parameters in the world view are all set to zero.

Expected behaviour

The frame of reference should not change and be kept around Uracka-C planet.

Steps to reproduce

Load the attached save and fast forward the time to reach April 12 at approx. 9:55.

Orbit view before the change: orbit_before

Orbit view after the change: orbit_after1

And the bigger picture after the change: orbit_after2

__My pioneer version (and OS): Windows 10, version 20200203 (downloaded from pioneerspacesim.net --> github.com) 2020-10-28-Bug_Uracka-C.zip

Gliese852 commented 3 years ago

@gitcior I loaded your save game and reproduced this effect. Yes, it looks strange, but in this case it is not a bug, but a feature of the physical model of the game. Your ship flew in orbit with significant eccentricity, so it moved away from the planet. The size of the planet's frame has an exact value, and when your distance to the planet exceeded it, you went out to the parent frame. And became a satellite of central body.

bszlrd commented 3 years ago

Maybe there could be an indication on the orbit, where you will leave the SOI of the given body. Not sure how tough to implement that

gitcior commented 3 years ago

If that's the case, it appears the initial circular orbit estimation (as viewed on the 'world view') was wrong in the first place, as it didn't account for the mentioned eccentricity. It was definitely misleading. BTW: I used an autopilot high-orbit functionality in order to reach the initial orbit. Maybe autopilot didn't reduce the eccentricity correctly? Just guessing.

EDIT: And how is that possible that before the orbit changed I was able to nicely move along the circular orbit of the planet for good 5.5h? No disruptions to the movement noticed. And suddenly, boom, change of direction (?) and orbit... Weird.

bszlrd commented 3 years ago

If it was a hight orbit, the orbital period can be quite long, so 5.5 hours isn't necesseraly too long in that regard.

gitcior commented 3 years ago

Agreed, probably about 5-10deg of a full 360deg round. Still, my gut feeling is that something is not right here. Regarding the physical model - is there any document/reference/guide on what assumptions have been used in its development? I'd like to have a look at it and maybe contribute.

bszlrd commented 3 years ago

Out of curiosity I overlayed the orbit around the planet and the resulting orbit: orbitoddity They line up properly (not accounting for the planet moving away a bit after the SOI change.) And I watched the speed and prograde marker relative to the sun (targeting, then the yelow ones), and there wasn't any jump of values or anything. But after leaving the SOI, the speed did not change anymore, which is apt, since it's a rather big orbit. But it does feel odd a bit that orbiting the planet should provide enough energy to stay on a somewhat similar orbit at SOI change. Maybe it's a corner case, or an odd SOI distance - hight orbit match/mismatch?

gitcior commented 3 years ago

The bottom line is that the autopilot did set me on a temporary high orbit correctly but no information was given that it's not a permanent orbit and that SOI is about to change in short distance. As suggested by nozmajner, an indication of a point where this will happen might be a good idea. Other possible solution is to simply show/draw, as an option, the SOI of a given body, so that a user is presented with more information and can plan his/her maneuver correctly.

bszlrd commented 3 years ago

I tried the high orbit setting, and the autopilot took me to a perfectly circular one.

My guess, how the SOI change might be shown the simplest is to color the orbit more faintly where it is out of the SOI.

gitcior commented 3 years ago

That's one of the solutions. It's certainly a good idea to provide some indication of SOI change or extent of SOI.

Web-eWorks commented 3 years ago

We should probably take a page out of Kerbal's book and draw the orbital patch up to SOI change, draw an icon where it will occur, and then draw the resulting orbit patch after SOI change. Additional information about the orbit would be nice (e.g. text saying ESCAPE or similar) but is less consequential. It's a bit misleading to display an escape orbit as though it were going to allow the ship to reorbit back into the SOI of the original body.

bszlrd commented 3 years ago

That would sure be nice!

Gliese852 commented 3 years ago

Then you have to check the intersection of the orbit with all the frames, calculate the entrance, inner trajectory and exit from each intersected frame, and the result can sometimes be quite intricate.

Web-eWorks commented 3 years ago

And that's why we should temporally cache orbits and update them sporadically! We only really need to calculate and display at most two orbital patches unless we're planning maneuvers, and trade ships absolutely don't need anything complicated.

Gliese852 commented 3 years ago

Trade ships never fly in orbits at all, a piece of free flight usually takes place in deep space, and almost straight, the rest of the time the engines are running, which means that the orbit changes every frame.

gitcior commented 3 years ago

Trade ships don't. But SAR mission ships do. This is when you need to plan you maneuvers carefully and this is what also makes Pioneer interesting and challenging.

Gliese852 commented 3 years ago

@gitcior I don't understand the problem, almost always you have such a monstrous power reserve that you just point your nose at the target and accelerate until the gray bar on the left rises up, then you brake (front or back) and now, the target is in front of you. orbital speeds are almost always very low, compared to the power of your engines, you can fly in a head-on orbit and turn it 180 degrees in a few minutes. (probably)

Gliese852 commented 3 years ago

not to mention the autopilot can do it all.

bszlrd commented 3 years ago

The autopilot can sometimes botch a transfer in my experience. Especially when the target is in a tight orbit, and the autopilot then needs to constantly adjust burning fuel. I once had to resort to Hohmans and a bit of scooping in a SAR mission because of that.

Gliese852 commented 3 years ago

sorry, missclick

gitcior commented 3 years ago

@Gliese852: Agreed, but say you have very little fuel left? And say, in the future, more challenging (less powerful ships/engines) are added to the game for those who want to play the game only for its maneuver planning fun?

Gliese852 commented 3 years ago

@gitcior if you are running low on fuel, you must be searched and rescued ;) besides, I think even @nozmajner would agree that for orbital flights our time acceleration is too weak. If you enjoy orbital maneuvers I would suggest Orbiter. You will have great pleasure.

bszlrd commented 3 years ago

That depends on the situation, but yeah, for longer trips, our time acceleration is rather slow, and it's quite hard to amp it up as far as I gathered, because collision detection becomes overly hectic, which would affect the Tradeships.