Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperbolic Trajectories still problematic to display. #390

Open
se5a opened this issue Nov 11, 2023 · 0 comments
Open

Hyperbolic Trajectories still problematic to display. #390

se5a opened this issue Nov 11, 2023 · 0 comments

Comments

@se5a
Copy link
Contributor

se5a commented Nov 11, 2023

This is the class that does the work for drawing hyperbolic trajectories:
https://github.com/Pulsar4xDevs/Pulsar4x/blob/DevBranch/Pulsar4X/Pulsar4X.Client/OrbitalWidgets/OrbitHyperbolicIcon2.cs

Similar to how elliptical orbits are drawn,
it creates an array of points for a hyperboilc trajectory, from SOI entry to SOI exit. these points do not change throughout the objects movement.
as the object moves (each physics tick) it finds and updates _index variable to match which point in the above array is closest to the objects position.
each frame it updates an array of SDL points, from the _index to the end of the trajectory, for camera position and zoom.
it then iterates through this array drawing a line and reducing the alpha.

This has been fraught with problems, it's one of those things that on the surface should be very easy, but runs into all sorts of edge cases when dealing with angles, and I'm sick of looking at it.

  • its sometimes drawing a line to screen 0,0
  • it's sometimes not drawing to the correct length (eg end of SOI).
  • UpdateUserSettings function needs to be better so the user settings are properly handled.
  • There's probably a better way to get the closest point to the object, currently we're going to the next point or previous point so we start drawing from behind the ship, but the point may already be behind the ship meaning we're skipping a point. the way we're finding this is probably not the most efficient either.
  • it needs testing at other angles.

I suspect the first two problems are probably just array length issues.
for testing other angles you can mess around with the start position of the ship here: https://github.com/Pulsar4xDevs/Pulsar4x/blob/DevBranch/Pulsar4X/GameEngine/Engine/Factories/DefaultStartFactory.cs#L418

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant