Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

enterPlayerWormhole not working if wormhole in save-file

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

Moderators: winston, another_commander, Getafix

User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Re: enterPlayerWormhole not working if wormhole in save-file

Post by TGHC »

Great collaboration fellas.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6579
Joined: Wed Feb 28, 2007 7:54 am

Re: enterPlayerWormhole not working if wormhole in save-file

Post by another_commander »

Commander McLane's test allows me to replicate the problem on my system too. Deleting the wormhole part in the savefile makes everything work again.
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Re: enterPlayerWormhole not working if wormhole in save-file

Post by Micha »

Found the bug.
Saved wormholes don't have a Universal ID, neither does the Player's Wormhole, and the code uses the UIDs to ensure a wormhole isn't added multiple times.

My bad.

<edit>Fixed in r4402</edit>
Last edited by Micha on Thu Feb 24, 2011 11:02 pm, edited 1 time in total.
The glass is twice as big as it needs to be.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: enterPlayerWormhole not working if wormhole in save-file

Post by JensAyton »

Have I mentioned my dislike of universal IDs recently? :-)
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: enterPlayerWormhole not working if wormhole in save-file

Post by Commander McLane »

Removing the wormhole-key from my save-file allowed me to do some more tests, and I've run into another problem.

Sometimes the NPC simply won't follow. Especially the helpless traders from interstellar_help.oxp, for whom I'm doing the whole thing, won't.

Here's the relevant AI-state:

Code: Select all

    "FOLLOW_PLAYER" =     {
        "COURSE_OK" =         (
            "setSpeedFactorTo: 0.7",
            performFlyToRangeFromDestination
        );
        ENTER =         (
            setDestinationToTarget,
            "setDesiredRangeTo: 150",
            checkCourseToDestination
        );
        "PLAYER WITCHSPACE" =         (
            enterPlayerWormhole
        );
        UPDATE =         (
            setDestinationToTarget,
            checkCourseToDestination,
            "pauseAI: 2"
        );
    };
And here are the last couple of seconds worth of log-entries before my jump:

Code: Select all

23:36:14.618 [ai.takeAction]: Moray Medical Boat 1494 to take action setDestinationToTarget
23:36:14.618 [ai.takeAction]: Moray Medical Boat 1494 to take action checkCourseToDestination
23:36:14.618 [ai.takeAction]: Moray Medical Boat 1494 to take action pauseAI: 2
23:36:14.618 [ai.message.receive]: AI interstellarHelpAI.plist for Moray Medical Boat 1494 in state 'FOLLOW_PLAYER' receives message 'COURSE_OK'. Context: handling deferred message, stack depth: 0
23:36:14.618 [ai.takeAction]: Moray Medical Boat 1494 to take action setSpeedFactorTo: 0.7
23:36:14.618 [ai.takeAction]: Moray Medical Boat 1494 to take action performFlyToRangeFromDestination
23:36:16.619 [ai.takeAction]: Moray Medical Boat 1494 to take action setDestinationToTarget
23:36:16.619 [ai.takeAction]: Moray Medical Boat 1494 to take action checkCourseToDestination
23:36:16.619 [ai.takeAction]: Moray Medical Boat 1494 to take action pauseAI: 2
23:36:16.619 [ai.message.receive]: AI interstellarHelpAI.plist for Moray Medical Boat 1494 in state 'FOLLOW_PLAYER' receives message 'COURSE_OK'. Context: handling deferred message, stack depth: 0
23:36:16.619 [ai.takeAction]: Moray Medical Boat 1494 to take action setSpeedFactorTo: 0.7
23:36:16.619 [ai.takeAction]: Moray Medical Boat 1494 to take action performFlyToRangeFromDestination
23:36:17.187 [ai.message.receive]: AI interstellarHelpAI.plist for Moray Medical Boat 1494 in state 'FOLLOW_PLAYER' receives message 'PLAYER WITCHSPACE'. Context: global message, stack depth: 0
23:36:17.187 [ai.takeAction]: Moray Medical Boat 1494 to take action enterPlayerWormhole
After that, silence. Even if I wait for minutes.

The target inspector informs me that:

Code: Select all

Ship entity:
Status: STATUS_ENTERING_WITCHSPACE

AI:
Pending: ENTERED_WITCHSPACE
Think in: -(ever-growing number)
Behaviour: BEHAVIOUR_FLY_TO_DESTINATION
Frustration: 0
The pending AI message is never received or acted upon.

The obvious difference of this code to my test AI code is that this AI is following the player ship and therefore generally in behaviour BEHAVIOUR_FLY_TO_DESTINATION, while my test AI had a performIdle.

Does the performFlyToRangeFromDestination somehow prevent the pending AI message to become active, while the performIdle doesn't?

If so, is there a better way to make the ship 'escort' the player until he jumps out? Would for instance performIntercept be better than performFlyToRangeFromDestination?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: enterPlayerWormhole not working if wormhole in save-file

Post by JensAyton »

Commander McLane wrote:
The pending AI message is never received or acted upon.
Pending messages (and UPDATE) will never trigger for a ship that isn’t “in the universe” (which mostly means in-system, although there are special cases). The line “Moray Medical Boat 1494 to take action enterPlayerWormhole”, and the fact that it’s still in the inspector, means it’s in the wormhole, but I don’t know offhand how you can find out when it will emerge.
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: enterPlayerWormhole not working if wormhole in save-file

Post by Commander McLane »

The ordinary traders which I hijacked with my test AI emerged within a few seconds.

This ship has been in the wormhole for minutes. I don't think it's going to emerge. Could it be that its ship script is somehow stalled?
Post Reply