Script calculating highway distance for the autopilot

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Realspace
Posts: 1410
Joined: Wed, 15. Nov 06, 10:21
x4

Script calculating highway distance for the autopilot

Post by Realspace » Fri, 26. Jan 24, 13:30

I've done huge sectors and very long highways, some are even 8000km.

Problem is the autopilot. It can not calculate a route using the highway unless the ship is very close to the highway.

Seems the AI values the distance from the highway and decides to travel to destination instead of using the highway if it values that the hw is too far.
This makes sense in vanilla sectors where distances are just a few hundreds km so the autopilot discards the highway if too far.

In my mod, distances are thousands km so if there is an highway's entrance at "only" 100km (and destination is 8000km!) the autopilot decides to discard the highway because it is too far. This of course makes no sense.
Also, doing curves and top/downs in the highway's shape, makes the AI discard it in favor of long "direct" travel speed.

I suppose there is some script that regulates this aspect, i.e. "discard the highway if too far".
I looked everywhere in AISCRIPTS for such a command, to increase the range it uses to calculate whether using highway or not. Without success.

In the autopilot files I see interrupts for other reason but not for distance.

Any help would be very appreciated.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13308
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Script calculating highway distance for the autopilot

Post by euclid » Fri, 26. Jan 24, 17:29

Even in the vanilla game the move scripts do silly things. Often I observe the opposite to your case: The ship moves to a highway which is in a much greater distance as the final destination.

I have checked the various scripts and think the cause is in move.generic. But this is a rather long script which covers many exceptions not relevant in this case. My guess is that in your huge universe the definition of zones might complicate things. I'd check move.generic starting around line 780. However, I think only BurnIt! can shed some light on this.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Realspace
Posts: 1410
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Script calculating highway distance for the autopilot

Post by Realspace » Fri, 26. Jan 24, 19:53

Pathfinding is really crazy, my mod only exacerbates the issues.

For instance in a very big capital sector, 12.000km, with gates very far from each other, the autopilot prefers to go back and exit from the S gate, to make a circle all around other sectors, in order to re-enter from the N gate (same sector) that is closer to the target, a station that is close to the hw.
Instead of using the highway...and it prefers to cross a Xenon sector to do this :evil:

I tested with a pilot on board, does the same. If adding the blacklit, the pilot does another circle around other sectors, but using the highway is out of discussion.

If I got correctly, the pilot uses the autopilot's scripts for a lot of things, for instance when docking

Return to “X4: Foundations - Scripts and Modding”