fixed problem with exitingTraderAI

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

fixed problem with exitingTraderAI

Post by Commander McLane »

Exiting traders get trapped after launching from a big station like the Superhub. They are trying to hyperspace out, but the station is masslocking them. exitingTraderAI tells them to fly to a distance of 10,000 meters from the station. But in case of a big station that's not enough, they are still masslocked.

As a result, if you wait next to a Superhub for some time, you will eventually see a large group of launched ships circle the Superhub in a stable orbit with a radius of 10,000 meters. They just go around and around forever. Trapped. It actually looks quite beautiful, however it is still silly.

I think the same problem should arise for Torus stations, but I haven't checked lately.

The solution is simple: increase the distance they have to bring between themselves and the masslocking station. Then they will fly away and jump out the very moment they get out of masslock. In case of the Superhub that's about 22,300 meters, so they can never make it with the existing exitingTraderAI.

Therefore I propose the following change to exitingTraderAI:

Code: Select all

    "EXIT_SYSTEM" = {
        UPDATE = (performHyperSpaceExit); 
        "WITCHSPACE BLOCKED" = (
            setTargetToFoundTarget, 
            setDestinationWithinTarget, 
            "setDesiredRangeTo: 25600.0", 
            performFlyToRangeFromDestination
        ); 
        "WITCHSPACE OKAY" = (wormholeEscorts); 
        "WITCHSPACE UNAVAILABLE" = ("setAITo: route1traderAI.plist"); 
    }; 
I simply replaced "10000.0" with "25600.00". To be completely sure that it works for stations of any size, we could increase the number even more.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

If I understand you correctly, they will fly the full distance before attempting to hyperspace?

If so, this will greatly reduce the chance of seeing a witchspace cloud in the vicinity of a standard station. So the odds of having a fortuitous free ride to your destination would drop dramatically. Also, it would become harder to reach the witchspace cloud in time, before it vanishes.

A better solution (if it can be done) would be for the trader to check to see if it is masslocked. If so, it could then continue to move away, checking at intervals to see if it can jump yet.

Or am I misunderstanding, and they will jump the moment they are able to do so?
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Diziet Sma wrote:
If I understand you correctly, they will fly the full distance before attempting to hyperspace?
No, they don't, and they never have.
Diziet Sma wrote:
A better solution (if it can be done) would be for the trader to check to see if it is masslocked. If so, it could then continue to move away, checking at intervals to see if it can jump yet.

Or am I misunderstanding, and they will jump the moment they are able to do so?
Yes, exactly. Like they always have.

The explanation is in the AI-code I posted: When in state "EXIT_SYSTEM", the AI tries to execute the "UPDATE" part on every update. As there is no update interval specified via "pauseAI: n.n", the default interval is used, which is the smallest interval possible: 0.125 seconds. In other words: the AI tries to jump out eight times a second. (That's why you see the counter in the AI-inspector only oscillate between 0.0 and 0.1.) (And BTW: This is how AIs with an "UPDATE" message always work, which is why it is highly advisable to always set an update interval, except in those few cases where you really want the AI to check for something permanently. In all other cases it only leads to an unnecessary slowdown of the game, especially if there are many ships continuously performing AI updates.)

If it is still masslocked, it will receive the "WITCHSPACE BLOCKED" message, and execute the code therein. In other words: it will try to get further away from the blocking structure.

The only change I made is that until now the AI only tries to get at most 10000 meters away. That's too little for big stations. If it has reached this distance, it actually turns around and flies back, in order to maintain the distance. That way it ends up in an orbit, de-facto oscillating between 8000 and 12000 meters. It's a real orbit, because only the pitch is changed in order to maintain the pre-set distance. It doesn't roll away from its current course.

But the very moment the "performHyperspaceExit"-method doesn't produce a "WITCHSPACE BLOCKED"-response, the method is performed. Which means at most 1/8 of a second after the safe distance is reached.

So the only change I made is to make sure that the ship is able to reach the safe distance in the first place.

Or, in yet other words: The beauty of the solution is that it doesn't change a thing for smaller stations.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: fixed problem with exitingTraderAI

Post by Eric Walch »

Commander McLane wrote:
Exiting traders get trapped after launching from a big station like the Superhub. They are trying to hyperspace out, but the station is masslocking them. exitingTraderAI tells them to fly to a distance of 10,000 meters from the station. But in case of a big station that's not enough, they are still masslocked.
You are right. Its hard coded that nothing outside of scanner range can masslock a ship.
However, when you would look in trunk you'll see its set to 30000 meters some months ago. So consider this being fixed.
Diziet Sma wrote:
If so, this will greatly reduce the chance of seeing a witchspace cloud in the vicinity of a standard station. So the odds of having a fortuitous free ride to your destination would drop dramatically. Also, it would become harder to reach the witchspace cloud in time, before it vanishes.
For normal stations there is no change. The traders first use the command: getWitchspaceEntryCoordinates. This returns a coordinate at 10.000 meters from the station. This won't change. After that is tries to jump every 5 seconds. On failure it tries to set a new course away from the mass-locker. But the way Oolite works, there is only one command for flying away: performFlyToRangeFromDestination When starting within the range it flies away from the mass-locker, but when calling it from outside the range, it will fly towards the mass-locker. For big stations, like the torus stations, you'll see the traders constant switching between these two modes without ever leaving the masslock range. With the new range it still will try jumping from the same distance as before but now will fly away till 30000 meter away before flying backwards. Within this range any ship will be able to get away from a station masslock.
Last edited by Eric Walch on Wed May 19, 2010 11:32 am, edited 2 times in total.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: fixed problem with exitingTraderAI

Post by Commander McLane »

Eric Walch wrote:
Commander McLane wrote:
Exiting traders get trapped after launching from a big station like the Superhub. They are trying to hyperspace out, but the station is masslocking them. exitingTraderAI tells them to fly to a distance of 10,000 meters from the station. But in case of a big station that's not enough, they are still masslocked.
You are right. Its hard coded that nothing outside of scanner range can masslock a ship.
However, when you would look in trunk you'll see its set to 30000 meters some months ago. So consider this being fixed.
Good to know. :D

So, everybody, if you want to enjoy the dance-of-the-traders-around-the-golden-superhub, do it while you're still on 1.73.4. :wink:
User avatar
Yrol_Denjeah
Dangerous
Dangerous
Posts: 75
Joined: Mon Apr 26, 2010 8:29 am

Post by Yrol_Denjeah »

°replaces dockingmusic with ABBA - Dancing Queen°
(in a cutely insane, electronic, stuttering female voice)
Are you Afraid? What is it you Fear?
The End of your Trivial Existence? Ha!
When the History of my Glory is written,
your Species shall only be a Footnote
to my Magnificence.
I am SHODAN.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: fixed problem with exitingTraderAI

Post by Cody »

Commander McLane wrote:
So, everybody, if you want to enjoy the dance-of-the-traders
Oresrati is a good place to watch the dance of the traders… they launch from the Coriolis station with their escorts, do a stately tour of local space, then, having nowhere to jump to, they dock again… then repeat ad infinitum.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Post by Micha »

Heh, I completely forgot about this bug. My personal fix, which I never submitted, had the traders heading towards the witchpoint buoy.

Same problem as you noticed though - distinct lack of witchspace clouds near stations.
The glass is twice as big as it needs to be.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Post by Cody »

Micha wrote:
My personal fix, which I never submitted, had the traders heading towards the witchpoint buoy.
That would be an improvement... all the way to the witchpoint, then a slow cruise back to the station.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Post by Micha »

El Viejo wrote:
Micha wrote:
My personal fix, which I never submitted, had the traders heading towards the witchpoint buoy.
That would be an improvement... all the way to the witchpoint, then a slow cruise back to the station.
?! In what way an improvement? My thinking at the time was for a more 'realistic' Ooniverse: since you can't jump INTO a system close to the planet, you shouldn't be able to jump OUT either. But for the player it'd be very boring to have to fly all the way to the witchpoint, and having the traders do so means there's no witchspace clouds near stations for the player to piggyback on.
Before the advent of the witchspace analyser this wouldn't have mattered so much.

Oolite is a trade-off between 'realism' and 'fun'. As far as I can tell, 'fun' decisions tend to win out in favour of realism.

Anyway, I think I've derailed this topic enough now :)
The glass is twice as big as it needs to be.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

You should note, however, that the "dance" at Oresrati is a completely different thing and totally unrelated to the "dance" I was describing above.

Oresrati's problem is that there simply is no system in jump range, therefore nobody can jump out (neither player nor NPCs), regardless at which point in the system they are. It has nothing to do with masslock.

If you look at the code snippet I posted above, you see that something completely different happens. When the AI tries to jump out, it gets the message "WITCHSPACE UNAVAILABLE", which is something different to "WITCHSPACE BLOCKED". In the code you see that getting the message "WITCHSPACE UNAVAILABLE" results in switching to a different AI, namely route1traderAI. This is the AI which brings the trader to the main station and makes it dock. Therefore the observed behaviour of launching and docking again.

Launching traders who are victims of the bug I described will never ever dock again. For the reasons I explained above they fly around the station forever.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Commander McLane wrote:
Oresrati's problem is that there simply is no system in jump range, therefore nobody can jump out (neither player nor NPCs), regardless at which point in the system they are. It has nothing to do with masslock.

If you look at the code snippet I posted above, you see that something completely different happens. When the AI tries to jump out, it gets the message "WITCHSPACE UNAVAILABLE", which is something different to "WITCHSPACE BLOCKED".
This "WITCHSPACE UNAVAILABLE" also happened before 1.73 with some traders. In 1.72 and older, traders relied on having fuel inherited from a shipdata.plist definition. Some traders that had zero fuel defined, also docked immediately after launch. Since 1.73 all exiting traders get 7 LY of fuel (Not the sunskimmers as they have to do the fuelling job themselves to save a few dimes on the next trip.)
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Micha wrote:
?! In what way an improvement? My thinking at the time was for a more 'realistic' Ooniverse: since you can't jump INTO a system close to the planet, you shouldn't be able to jump OUT either. But for the player it'd be very boring to have to fly all the way to the witchpoint, and having the traders do so means there's no witchspace clouds near stations for the player to piggyback on.
Before the advent of the witchspace analyser this wouldn't have mattered so much.

Oolite is a trade-off between 'realism' and 'fun'. As far as I can tell, 'fun' decisions tend to win out in favour of realism.

Anyway, I think I've derailed this topic enough now :)
You can jump out of a system close to a planetary body because the trans-quad-dimensional gravitmetric calculations are relatively easy to calculate for becuase you're in that gravity well already, the tricky part is calculating it for destination which is why ships jump in a "safe" distance from the planet and the sun.
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Or, to put it simply, its safer to jump away from something than towards it.
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Cmdr James wrote:
Or, to put it simply, its safer to jump away from something than towards it.
Hey, I grew up with Star Trek Next Gen - pointless Techno-babble and I'm not afraid to use it! :lol: :wink:
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
Post Reply