I've broken the 7 ly limit! (sort of...)

General discussion for players of Oolite.

Moderators: winston, another_commander

Baza
Competent
Competent
Posts: 42
Joined: Wed Dec 05, 2007 7:52 pm

Post by Baza »

Why do we need a new gadget? Surely big ships can carry enough fuel to make multiple jumps. Why not just hire a large ship at a station. you then dock. The ship then makes the jumps for you. For the player they dock then un-dock when they arrive at the destination system. game rules. time etc intact. Cost lots of money or free if navy/ mission requirement?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Baza wrote:
Why not just hire a large ship at a station. you then dock. The ship then makes the jumps for you. For the player they dock then un-dock when they arrive at the destination system.
I’d be very impressed if you could achieve that through scripting.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Post by Mauiby de Fug »

I've no idea how carriers behave while you are docked, so I don't know if this would work or not... My first response would be "no", but I can't think exactly why not... I can't see a way to have a usable control system/interface, though, which is why so many things make use of the pylons.

To both Thargoid and Ahruman: thanks for the scripting feedback! I'll have a go at implementing those.

I see why the log function is working now, and that makes sense. I'm still a bit confused about the jumpChain/chainPos scope thing. I see why you don't want them to be accessed by other scripts; however, I'm not sure how you make them accessible to all functions within the script... I should probably play around and test and work out what you mean!

With regards to PlayerShip/player.ship: things become clearer now. I hadn't twigged that they were prototypes. I did try calling PlayerShip.position, and couldn't work out why it wasn't working. I eventually found the player.ship.position in someone's oxp, but I couldn't see anywhere on the wiki that tells you that that's the notation for it.
User avatar
Nemoricus
---- E L I T E ----
---- E L I T E ----
Posts: 388
Joined: Mon May 18, 2009 8:51 pm

Post by Nemoricus »

I see why the log function is working now, and that makes sense. I'm still a bit confused about the jumpChain/chainPos scope thing. I see why you don't want them to be accessed by other scripts; however, I'm not sure how you make them accessible to all functions within the script... I should probably play around and test and work out what you mean!
Where you have those JS variables defined puts them into a global space. Since they don't have a "this." in front of them to explicitly limit them to your script, they're freely accessible by any script that calls their name.

This can potentially lead to all sorts of nasty and unpredictable behavior.
Dream as if you'll live forever
Live as if you'll die tomorrow
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Post by Mauiby de Fug »

Ooh, so I should put a "this" in front of the variables, and then that'll limit them to the script, put make them accessible to all functions within that script?

I get that having a variable accessible by any script is a bad thing, and something to be avoided. My understanding was that a local variable operated within the scope of the function, and a global function operated within the scope of the script, hence where I put things where they did.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: I've broken the 7 ly limit! (sort of...)

Post by Mauiby de Fug »

Well, I'm tempted to set a mission in Galaxy 5 - there are quite a few places where cutting off a system would prevent travel to other worlds. It could be set up so that one would have to use the wormhole type of equipment to get through. Also, there are very few missions set in Galaxy 5 - only the native cloaking device mission and the end of Deposed.

Of course, this is not likely to happen for quite a while. I'm currently in mission-playing mode and zooming through the various galaxies. I'll keep a save game in 5 though, and alternate between playing and writing. In theory...

My Oolite ambition is to release a mission oxp, a ship oxp, and an equipment oxp. (Apart from the obvious becoming Elite and completing all the missions, but they're on target...) This project could well combine the 3 into 1!
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: I've broken the 7 ly limit! (sort of...)

Post by Cody »

Mauiby de Fug wrote:
Well, I'm tempted to set a mission in Galaxy 5 - there are quite a few places where cutting off a system would prevent travel to other worlds.
Good idea... G5 is the most interesting octant, and has the most beautiful planet, namely Zaquesso.
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
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: I've broken the 7 ly limit! (sort of...)

Post by Mauiby de Fug »

Just for the hell of it, I just took a trip to Zaquesso, as I was still waiting for the final mission screen from Deposed to be triggered. I departed dear 5 for 6 from there and ended up at Orbeen, which is neighbours to Azara, a system containing a SecCom station. Most useful for my next mission!

I have to say, I feel rather uncomfortable when I'm in a galaxy which has systems unreachable by jumping. It feels weird, and I don't know why.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: I've broken the 7 ly limit! (sort of...)

Post by Switeck »

I found a way to get to Oresrati -- the bottom left system in Galaxy 8, although I must say it borders on the impossible even with fuel collector and max fuel tanks. Using only fuel tanks, it would take >10 fuel tanks/missile slots to do. The latest Galactic_Navy 5.4.0(test).oxp resets your ship's fuel back to 7.0 LY after each jump which can be used to duplicate this if you care to try -- just remember to take something really fast and/or tough to survive the Thargoid attacks.
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: I've broken the 7 ly limit! (sort of...)

Post by Commander McLane »

Switeck wrote:
I found a way to get to Oresrati -- the bottom left system in Galaxy 8, although I must say it borders on the impossible even with fuel collector and max fuel tanks.
How? Since I've read this I've been misjumping back and forth between Biered and Ererso (which seem to me the two systems closest to Oresrati), but never managed to get closer than 7.6LY to Oresrati. Every other combination looks even less promising. So I wonder what I'm missing.

EDIT: Never mind, I made it! The whole routine is a little more complicated than I thought and doesn't involve Ererso, but a couple of other planets instead. Provided you somehow manage to have enough fuel, it opens up completely new possibilities, because now you can arrive on Oresrati with your Galactic Hyperdrive intact. :)
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: I've broken the 7 ly limit! (sort of...)

Post by Switeck »

Well I didn't say it was easy... :(

What I wish to do now is hack a warp gate (NPC ship) to do this automatically for me, as part of a campaign mission.
(Making this work is one thing...making it work cleanly and look pretty is another.)
1.A warp gate could initiate a jump when you're very near/in it, via a special warpgateAI.plist -- similar to how hoopy casino hyperspaces when at low energy ( performHyperSpaceExitWithoutReplacing )...though I'm at a loss how to set its jump destination.
2.A .js script could be set up to do deliberate player misjumps ( player.ship.scriptedMisjump = true; )...complete with adding another warpgate (via a .js script) at the destination.
3.Jump-chaining could be accomplished by a mission variable storing current location and what jump to do next, coupled with immediately adding another NPC warpgate directly in front of the player on exit at each partial destination.
4...which of course the NPC warpgate immediately jumps on to the next partial destination! The player's ship will be too close to the warpgate to escape and will probably hit the wormhole before the system is even fully loaded.
5.At the final destination (in this case, Oresrati), there may not be a warp gate...since the complexity of this method is sadly not reversible.

Currently, my special warpgateAI.plist can hyperspace out the warpgate, but only when it's badly damaged:

Code: Select all

		"ENERGY_LOW" = ("setStateTo: EXIT_SYSTEM");
...
	"EXIT_SYSTEM" = {
		ENTER = ("addFuel: 7");
		"WITCHSPACE BLOCKED" = (performIdle, "setStateTo: IDLE", "pauseAI: 10.0");
		UPDATE = (performHyperSpaceExitWithoutReplacing); // was performHyperSpaceExit
	};
I'm sure I can come up with something for when the player is very near. Will this work?:

Code: Select all

	"FIND_PLAYER" =
	{
		ENTER = ("scanForNearestShipWithRole: player");
		"TARGET_FOUND" = (setTargetToFoundTarget, "setDesiredRangeTo: 50.0", setDestinationToTarget, setSpeedToCruiseSpeed, performFlyToRangeFromDestination);
		"DESIRED_RANGE_ACHIEVED" = ("setStateTo: EXIT_SYSTEM");
		UPDATE = ("scanForNearestShipWithRole: player", "pauseAI: 10.0");
	};
Adding the warpgate into a system is easy enough:

Code: Select all

this.shipExitedWitchspace = function()
{
// galaxyNumber starts at 0 = galaxy 1, so 7 = galaxy 8
// I don't know what the system.ID number should be yet, 24 is just made-up!
	if(!system.isInterstellarSpace && !system.sun.hasGoneNova && galaxyNumber == 7 && system.ID == 24)
	{
		system.addShipsToRoute("warpgate", 1, 0); // to be right near the witchpoint buoy
// OR to place it almost anywhere:
		system.legacy_addShipsAt("warpgate", 1, "wpu", [Math.random()+0.1, Math.random()+0.1, Math.random()+0.1]);
	}
}
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: I've broken the 7 ly limit! (sort of...)

Post by Commander McLane »

Switeck wrote:
Well I didn't say it was easy... :(

What I wish to do now is hack a warp gate (NPC ship) to do this automatically for me, as part of a campaign mission.
(Making this work is one thing...making it work cleanly and look pretty is another.)
1.A warp gate could initiate a jump when you're very near/in it, via a special warpgateAI.plist -- similar to how hoopy casino hyperspaces when at low energy ( performHyperSpaceExitWithoutReplacing )...though I'm at a loss how to set its jump destination.
2.A .js script could be set up to do deliberate player misjumps ( player.ship.scriptedMisjump = true; )...complete with adding another warpgate (via a .js script) at the destination.
3.Jump-chaining could be accomplished by a mission variable storing current location and what jump to do next, coupled with immediately adding another NPC warpgate directly in front of the player on exit at each partial destination.
4...which of course the NPC warpgate immediately jumps on to the next partial destination! The player's ship will be too close to the warpgate to escape and will probably hit the wormhole before the system is even fully loaded.
5.At the final destination (in this case, Oresrati), there may not be a warp gate...since the complexity of this method is sadly not reversible.
Sounds intriguing. :)
Currently, my special warpgateAI.plist can hyperspace out the warpgate, but only when it's badly damaged:

Code: Select all

		"ENERGY_LOW" = ("setStateTo: EXIT_SYSTEM");
...
	"EXIT_SYSTEM" = {
		ENTER = ("addFuel: 7");
		"WITCHSPACE BLOCKED" = (performIdle, "setStateTo: IDLE", "pauseAI: 10.0");
		UPDATE = (performHyperSpaceExitWithoutReplacing); // was performHyperSpaceExit
	};
That can be changed easily enough, of course, to make it jump on any other condition.
I'm sure I can come up with something for when the player is very near. Will this work?:

Code: Select all

	"FIND_PLAYER" =
	{
		ENTER = ("scanForNearestShipWithRole: player");
		"TARGET_FOUND" = (setTargetToFoundTarget, "setDesiredRangeTo: 50.0", setDestinationToTarget, setSpeedToCruiseSpeed, performFlyToRangeFromDestination);
		"DESIRED_RANGE_ACHIEVED" = ("setStateTo: EXIT_SYSTEM");
		UPDATE = ("scanForNearestShipWithRole: player", "pauseAI: 10.0");
	};
Whether this will work depends very much on the player's current speed and the warpgate's maximum speed. If it can't overtake him, it won't get within 50 meters of him.

However, if you want the player to close in to the warpgate instead of the warpgate chasing the player, I would suggest that you do a proximity check in its ship script. See the fuel satellite script or the interstellar help scripts for reference.

Also, if time is of the essence, the pauseAI-intervall should be much shorter. The shortest interval in an AI is 0.25 seconds. This is also the default interval, so you could simply remove the pauseAI. Checks in even shorter interval must be done in JS.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: I've broken the 7 ly limit! (sort of...)

Post by Switeck »

Ok, good news and bad...

The good news is I've figured out how to get the warpgate to only appear in the "correct" systems I want it in.
The bad news is I can't trigger a misjump going through their wormhole using:
player.ship.scriptedMisjump = true;

This is the relevant script.js code for making the warpgate appear and setting the next player jump to be a misjump:

Code: Select all

this.shipExitedWitchspace = function()
{
	if(!system.isInterstellarSpace && !system.sun.hasGoneNova && galaxyNumber == 7 && (system.ID == 121 || system.ID == 9))
	{
		system.legacy_addShipsAt("warpgate", 1, "spu", [0.1-Math.random()*0.2, 0.1-Math.random()*0.2, Math.random()*0.4+0.2]);
		player.ship.scriptedMisjump = true; // ADDED FOR TESTING!
	}
}
(I also have a check for player proximity to the warpgate for triggering/not-triggering scripted misjumps, but this keeps the code snippets short.)

The other bit of bad news is I cannot figure out how to set a destination for the warpgate's jump -- it's just using this:
performHyperSpaceExitWithoutReplacing
Inside its warpgateAI.plist file.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: I've broken the 7 ly limit! (sort of...)

Post by Mauiby de Fug »

Switeck wrote:
What I wish to do now is hack a warp gate (NPC ship) to do this automatically for me, as part of a campaign mission.
(Making this work is one thing...making it work cleanly and look pretty is another.)
1.A warp gate could initiate a jump when you're very near/in it, via a special warpgateAI.plist -- similar to how hoopy casino hyperspaces when at low energy ( performHyperSpaceExitWithoutReplacing )...though I'm at a loss how to set its jump destination.
As far as I can tell, you can't specify where to jump to if you use the AI method. But you can if you use a script. Hence the way I started writing my wormhole chain as a ship script. This causes the ship to appear in the next system as well. Usually. Sometimes it doesn't. Hence work on this has stalled somewhat. I could probably write a script to check and add one if it failed to appear, but this would probably mean changing other things and using a mission variable. Which I haven't had the time to do yet.

I'm probably hampered in that I'm only using javascript, and absolutely nothing in AIs. In fact, the wormhole mine itself has a nullAI. Not particularly useful.

Your warp jumpgates sound similar to stargates! My mind runs along duplicating this by creating a circular gate, that just surrounds the wormhole created by some tiny insignificant thing jumping out. It could be activated by... I don't know, using the special key thing I think exists in trunk? Except I have problems with my sci-fi universes crossing over...
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: I've broken the 7 ly limit! (sort of...)

Post by Commander McLane »

Switeck wrote:
The other bit of bad news is I cannot figure out how to set a destination for the warpgate's jump -- it's just using this:
performHyperSpaceExitWithoutReplacing
Inside its warpgateAI.plist file.
There is no way to give the AI a destination. The engine chooses one of the systems in reach at random.

The proper way is by using the JS method exitSystem which you can use with a parameter that specifies the target system.

However, as far as I know NPCs cannot misjump, and scriptedMisjump is a player-only property. Therefore the wormhole generated by the exiting NPC will always lead into its target system. Your tests seem to indicate that even setting the scriptedMisjump-property will not cause the player to 'fall out of the wormhole'. If this holds up, you're stuck for now.



EDIT: Am I just dense, or do the [wiki] and [wiki=] tags not accept colons (':'), making them pretty useless for the JS-reference pages and for category pages as well?

EDIT2: The tags also don't seem to accept the '#' character, making them also useless for linking to a specific point on a page.
Post Reply