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

[Solved] wormholes in interstellar space not quite fixed yet

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

Moderators: winston, another_commander, Getafix

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:

[Solved] wormholes in interstellar space not quite fixed yet

Post by Commander McLane »

I'm experiencing an odd bug which I cannot explain.

For a new OXP I am pursuing the idea that the player's wormhole can be restored after a misjump. The basic idea is that the Thargoids are placing Witchspace Jammers in interstellar space. Once the jammers are destroyed, your wormhole re-opens.

Technically the death of the last jammer spawns an object which will jump into the player's original target system. The object is simply an alloy with scanClass CLASS_NO_DRAW and a sufficient density to create a wormhole that will last about 1.5 minutes. Here's the shipdata:

Code: Select all

	<key>wormhole-restoration-wormhole-creator</key>
	<dict>
		<key>ai_type</key>
		<string>nullAI.plist</string>
		<key>cargo_type</key>
		<string>CARGO_NOT_CARGO</string>
		<key>density</key>
		<integer>500</integer>
		<key>fuel</key>
		<integer>70</integer>
		<key>like_ship</key>
		<string>alloy</string>
		<key>name</key>
		<string>Wormhole</string>
		<key>roles</key>
		<string>wormhole_restoration_wormhole_creator</string>
		<key>scanClass</key>
		<string>CLASS_NO_DRAW</string>
		<key>script</key>
		<string>wormhole-restoration-wormhole-creator.js</string>
		<key>script_info</key>
		<dict>
			<key>npc_shields</key>
			<string>no</string>
		</dict>
	</dict>
And here's the relevant part of its script:

Code: Select all

this.$attemptJump = function()
{
    // attempts to jump out to the player's original target system 
    if(this.ship.exitSystem(worldScripts["wormhole-restoration"].targetSystem) === true)
    {
        this.jumpAttemptTimer.stop();
        delete this.jumpAttemptTimer;
    }
}

this.shipSpawned = function()
{
    this.jumpAttemptTimer = new Timer(this, this.$attemptJump, 0.1, 0.5)
}
I'm using a repeating timer, because the object's jump may fail the first time, for instance if it's too close to another entity.

During my test I have simulated some situations which won't occur usually, and the bug showed up in one of them.

Initially everything's working fine. The Witchspace Jammers are destroyed, the tweaked alloy appears and creates a wormhole as expected, leading to my target system.

But, if I don't go to my target system, but instead I misjump again, things get strange. It doesn't matter whether I misjump by pulling up while entering the wormhole or by pressing 'H'.

After the second misjump I again arrive in interstellar space, again with some Witchspace Jammers. I kill them again, another tweaked alloy appears and...

This time it creates a blue disk like a wormhole disk. But it's not a wormhole. I can't target it, and I fly straight through it. The viewscreen turns blue while I'm crossing the disk, and then I see the disk in my rear view. No jump happens.

The same will happen reliably for each subsequent misjump. Blue disk: yes. Wormhole: no.

I can break the cycle by jumping out into normal space. When I now misjump again, the first time a correct wormhole is created. Again, for subsequent misjumps I only get the blue disk without a wormhole.

My guess is that for some reason some of the properties of the first wormhole stay in the cache and prevent the creation of further wormholes while still in interstellar space.

However, if I target any ship with enough fuel during subsequent misjumps and type PS.target.exitSystem() in the console, that ship correctly exits the system and correctly leaves a usable wormhole.

Perhaps it has something to do with using the targetSystem parameter? I now seem to remember that there was a similar bug report recently with the reaching-Oresrati OXP.

I'm using rev 4514.

EDIT: more tests: PS.target.exitSystem() on other ships works, PS.target.exitSystem(number) doesn't work and returns false. It seems that exitSystem with parameter only works once each time in interstellar space.
Last edited by Getafix on Wed Jul 13, 2011 9:53 pm, edited 3 times in total.
Reason: Altered "solved" flag to comply with the other solved cases.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: wormholes in interstellar space not quite fixed yet

Post by Thargoid »

Might it be that in the second case, you're "jumping" from interstellar space back to interstellar space (as your target system after entering it first time and then leaving by misjump is now interstellar space rather than your original proper target system). Hence it may be that your variable storing where you eventually want to get to is being overwritten and so you're script is getting confused. Thus when you fly through the second wormhole it's taking you nowhere as the game is thinking your current and target systems are now the same (interstellar space).

Does that make sense and fit the scenario?
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: wormholes in interstellar space not quite fixed yet

Post by Commander McLane »

Thargoid wrote:
Might it be that in the second case, you're "jumping" from interstellar space back to interstellar space (as your target system after entering it first time and then leaving by misjump is now interstellar space rather than your original proper target system). Hence it may be that your variable storing where you eventually want to get to is being overwritten and so you're script is getting confused. Thus when you fly through the second wormhole it's taking you nowhere as the game is thinking your current and target systems are now the same (interstellar space).

Does that make sense and fit the scenario?
I suspected that as well first. But you can also target a random ship in interstellar space and make it jump out to a specified system. It doesn't work.
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: wormholes in interstellar space not quite fixed yet

Post by Commander McLane »

Testcase:

1) misjump

2) target one of the surrounding ships or spawn a trader and target him

3) type PS.target.exitSystem(PS.targetSystem) (you can use the ID of one of the adjacent systems as well)

4) the ship jumps out

5) target the wormhole; everything's fine

5a) you can repeat that with more ships; everything's fine

6) now misjump again

7) repeat steps 2 - 4

8 ) this time you cannot target the wormhole, it's only a blue disk without wormhole properties

This bug only appears if you use the exitSystem with a parameter.

EDIT: wormholes in interstellar space got fixed by Micha for 1.75.1, see thread here: https://bb.oolite.space/viewtopic.ph ... 3&start=15

After some testing we found out back then that the bug was only triggered if there was already a wormhole key in the save-file. The same may be the case here, because I could create the bug with all OXPs except Debug.oxp and my ship OXP removed and using my save-file. However, I could not create the bug with only Debug.oxp installed and a fresh Jameson.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: wormholes in interstellar space not quite fixed yet

Post by Switeck »

This sounds vaguely related to my jump crashes:
https://bb.oolite.space/viewtopic.php?f=3&t=9564

For part of my tests, I was using a hacked version of 1-way Ticket 2 Oresrati, which is really an NPC ship that jumps right in front of you...too close for you to avoid its wormhole. Often after a few jumps, the game would crash. Probably if I could pull back and examine the wormhole for that jump...it'd probably be all screwy.
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: wormholes in interstellar space not quite fixed yet

Post by Commander McLane »

Another problem:
ship.exitSystem(number) for NPCs doesn't work in interstellar space if number is the player's origin system (the system he misjumped from). It always returns false from both the console and a script. It does work for all other systems in the vicinity, but not for the system the player comes from.

You can try it by targeting a random ship in interstellar space and making it jump to your system of origin. Even if you go to the map and select your system of origin as your current target system, it still doesn't work.

The bug probably also needs a wormholes-key in the save-game in order to surface.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: wormholes in interstellar space not quite fixed yet

Post by JensAyton »

Tracking as Bug #18082.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: wormholes in interstellar space not quite fixed yet

Post by another_commander »

Commander McLane wrote:
Another problem:
ship.exitSystem(number) for NPCs doesn't work in interstellar space if number is the player's origin system (the system he misjumped from). It always returns false from both the console and a script. It does work for all other systems in the vicinity, but not for the system the player comes from.
Fixed in r4519.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: wormholes in interstellar space not quite fixed yet

Post by Switeck »

Commander McLane wrote:
ship.exitSystem(number) for NPCs doesn't work in interstellar space if number is the player's origin system (the system he misjumped from).
This might also explain the lack of a distance line drawn on the player's fuel bar on the HUD when trying to hyperspace back to the system you just misjumped from?
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: wormholes in interstellar space not quite fixed yet

Post by Commander McLane »

Switeck wrote:
Commander McLane wrote:
ship.exitSystem(number) for NPCs doesn't work in interstellar space if number is the player's origin system (the system he misjumped from).
This might also explain the lack of a distance line drawn on the player's fuel bar on the HUD when trying to hyperspace back to the system you just misjumped from?
I hadn't noticed that one.

Well, just try the latest nightly and report whether the line is now drawn.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: wormholes in interstellar space not quite fixed yet

Post by Switeck »

No, the line does not seem to be drawn. It's quite odd once you notice it.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: wormholes in interstellar space not quite fixed yet

Post by Switeck »

I've seen this again with the 0-distance system pairs.
NPC ship created wormholes to the 0-distance system is unusable.
I'm using an OXP to create such wormholes...try LongRangeScanner v0.2.oxp if you want to see something similar.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: wormholes in interstellar space not quite fixed yet

Post by Switeck »

0-distance NPC wormholes still aren't working properly in oolite-trunk-1.75.2.4537-dev.win32.exe
Sometimes they cannot even be targeted, but they don't seem to work in any case -- your ship flies right through them!

I must admit it makes for a neat wormhole "tunnel" to have about 50+ of these wormholes lined up in a row and flying through them at speed. 8)
Vaguely reminds me of Dr. Who for some reason...
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Re: wormholes in interstellar space not quite fixed yet

Post by another_commander »

Switeck wrote:
No, the line does not seem to be drawn. It's quite odd once you notice it.
This one is now fixed as of r4551.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: wormholes in interstellar space not quite fixed yet

Post by Switeck »

0-distance NPC wormholes (which can pretty much only occur in interstellar space after multiple misjumps) still aren't working properly in oolite-trunk-1.75.3.4555-dev.win32.exe
May also occur with the extremely rare system pairs at the same X, Y location!
Sometimes they cannot even be targeted, but they don't seem to work in any case -- your ship flies right through them.

These need to be allowed if the system.ID between current location and wormhole target system do not match. (meaning: the wormhole is to somewhere else even though distance = 0 LY.)
Post Reply