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

Some escorts get stuck after going through a wormhole. #5541

Open
oo13 opened this issue Dec 10, 2020 · 13 comments · Fixed by #7379
Open

Some escorts get stuck after going through a wormhole. #5541

oo13 opened this issue Dec 10, 2020 · 13 comments · Fixed by #7379
Labels
bug Something in the game is not behaving as intended
Milestone

Comments

@oo13
Copy link
Contributor

oo13 commented Dec 10, 2020

Describe the bug
Some escorts get stuck after going through a wormhole in the opposite direction of the flagship at the same time.

The escorts is set a directly unreachable system as the target system and its JumpsRemaining() returns 0 forever. I think the escorts got in the wormhole at the same time when the flagship exited from the wormhole.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Waypoint and hold many escorts.
  2. Go to the Ultima Thule.
  3. Create a route to the Heia Due system.
  4. Cancel the hold command.
  5. Press 'J' after escorts start to pop up from the wormhole.
  6. Go through the wormhole and to the Heia Due system.
  7. Some escorts don't follow the flagship.
  8. You can see escorts wait to get refueled in the Ultima Thule forever.

Expected behavior
All escorts follow the flagship.

Screenshots
get_stuck

Note: I created it from a modified code for debugging.
The label "Target System:" of a ship shows the return value of ship.GetTargetSystem().
"Fuel:" shows the return value of ship.Fuel().
"Jump Remaining:" shows the return value of ship.JumpsRemaining().
The first word of "Route:" is the current system when AI::MoveEscort() calls ship.SetTargetSystem(dest), the second word is its dest.

The current system is not equal to the first word of "Route:" of the escorts. It means ship.SetTargetSystem(dest) was called when the ship was in the different system, and then the target system of the ship was not cleared after going through a wormhole.

System (please complete the following information):

  • OS: Debian GNU/Linux Testing
  • Game Source: Github
  • Version: 671f9b6

Link to save file
NA

Additional context
This behavior is similar to #5011, #4582, and #3608, and also possibly #4362, but this issue is caused after going through a wormhole.

@oo13
Copy link
Contributor Author

oo13 commented Dec 10, 2020

A variant:

  1. Install a jump drive to the flagship.
  2. Go to the Waypoint with many escorts.
  3. Create a route to the Heia Due system.
  4. Land to the wormhole in the Waypoint system.
  5. Press 'J' while entering the wormhole.
  6. The flagship jumps to the Heia Due.
  7. The escorts that went to the Ultima Thule get stuck.

@Amazinite Amazinite added the bug Something in the game is not behaving as intended label Dec 10, 2020
@oo13
Copy link
Contributor Author

oo13 commented Dec 12, 2020

Another variant:

  1. Uninstall any jump drives on the flagship.
  2. Go to the Waypoint with many escorts.
  3. Create a route to the Heia Due system.
  4. Press 'J' and cancel autopilot immediately.
  5. Press 'L' to land to the wormhole in the Waypoint system.
  6. Press 'J' while going through the wormhole.
  7. The flagship goes through the wormhole.
  8. Some escorts get stuck in the Ultima Thule.

@eternal-sorrow
Copy link

eternal-sorrow commented Oct 20, 2022

This just happened to me on 0.9.16 (steam) even though this is supposed to be fixed.

@quyykk quyykk modified the milestones: 0.9.16, 0.9.x Oct 20, 2022
@quyykk
Copy link
Member

quyykk commented Oct 20, 2022

Oh no. Can you provide a save file? Thanks!

@quyykk quyykk reopened this Oct 20, 2022
@eternal-sorrow
Copy link

save.txt

In this save the escorts are already stuck in Ultima Thule, while the flagship is in Heia Due. If you go back and refuel escorts, they follow through the wormhole without problem.

@daveeater
Copy link

Downloaded the save file. I selected one of the escorts in Ultima Thule (clicked on icon in lower left screen), opened the map, selected Waypoint, right-clicked on the mini-map to tell the escort to go to Waypoint...and it went to Waypoint. Repeated with the second escort, and then used G to gather them to me (once they accumulated enough fuel to make the hyperjump). No need to go back to Ultima Thule to "get" them.

@eternal-sorrow
Copy link

This is not the point. The point is, they do not follow the flagship automatically as one would expect.

@Amazinite Amazinite pinned this issue Nov 13, 2022
@Amazinite
Copy link
Collaborator

Pinning this issue since it's haunting us.

@Zitchas
Copy link
Member

Zitchas commented Nov 13, 2022

As an aside, that testing code that displays a ships fuel and stuff looks really useful for debugging.

@yjhn
Copy link
Contributor

yjhn commented Nov 14, 2022

I think (if I remember correctly) that after #7379 escorts that are already stuck will remain stuck, but no new escorts will get stuck and currently stuck ships will get unstuck if the flagship (player) visits their system. For some reason I did not document this in the original PR (#5635).

@eternal-sorrow
Copy link

But I got escorts stuck while i was already playing on the 0.9.16 version (which is supposed to include that fix?)

@yjhn
Copy link
Contributor

yjhn commented Nov 14, 2022

Ok, that definitely isn't supposed to happen.

@wjp
Copy link
Contributor

wjp commented Nov 20, 2022

In @eternal-sorrow 's save, one reason the escorts are semi-permanently stuck is because they are out of fuel and too far from the system center for solar collection to do very much. AI::MoveEscort() does have two code branches that move ships to the center of the system, but those (with the comments // Return to the system center to maximize solar collection rate. and // This ship has no route to the parent's system, so park at the system's center. ) aren't reached because both are behing !isStaying (which is blocked because needsFuel is true).

Incidentally that second branch is never reachable because it needs !isStaying and needsFuel to be both true so that is definitely a bug I think (even if unrelated to this issue).

The reason why the escorts aren't taking the wormhole even when they're out of fuel is similarly because all branches that can make the escorts take the wormhole are either behind a needsFuel check (via !isStaying) or behind a parentIsHere check.

I have the impression (but I'm very new to all this code) that the !parentIsHere && !isStaying branch at the top of MoveEscort wasn't expecting that isStaying also covers not having fuel. Changing that branch to if(!parentIsHere && !ship.GetPersonality().IsStaying()) makes the escorts come back to the flagship as expected by first taking the wormhole and then waiting for enough fuel to jump.

I can't judge yet if that has unexpected side effects though, which is why I'm not yet submitting this as a PR.

wjp added a commit to wjp/endless-sky that referenced this issue Nov 23, 2022
This is a small fix-up of endless-sky#7379 fixing a new report in endless-sky#5541.

MoveEscort() has two branches that were blocked if an escort was out of
fuel. These two branches were responsible for planning how an escort
should follow its parent, and already contain code handling the
out-of-fuel condition, by either landing to refuel (via SelectRoute) or
by moving to the system center as a fallback. Also flying through a
wormhole without fuel was blocked as an option as a side effect.

This patch enables taking those branches for escorts without fuel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something in the game is not behaving as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants