Preventing witchspace jumps

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

Ragged
Above Average
Above Average
Posts: 28
Joined: Mon Jun 29, 2009 10:55 am

Preventing witchspace jumps

Post by Ragged »

I've been looking at this

http://starwars.wikia.com/wiki/Immobilizer_418_cruiser

and wondering how such a think could be implemented for Oolite. Basically, the idea would be to prevent any ship entering witchspace within a certain radius (big for an interdictor navy ship, smaller for an interdictor mine).

Thing is I can't work out how to do it. I can see that there is a shipWillEnterWitchspace eventhandler, but I can't work out how to say "actually, don't".

Any suggestions?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Make a note of how much fuel the ship has, and then remove it. Once the ship is outside range re-award the fuel again so it can jump if it wants to.

Or alternatively I think there's a flag within 1.75 for whether a ship can make such jumps or not. That may also be usable, but it will depend on how it is implemented (and if it's read-only or read/write).
Ragged
Above Average
Above Average
Posts: 28
Joined: Mon Jun 29, 2009 10:55 am

Post by Ragged »

The 'remove fuel' solution occurred to me, but it will have the unwanted side-effect of preventing fuel-injector use.

Hopefully the new property in 1.75 will do what I want.
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 »

Alternative solution, completely without scripting: simply make the ship big enough to prevent other ships from jumping simply by masslocking.

Example: it is impossible to jump in a radius of 10 km around a normal station. A superhub effectively prevents ships inside a 23 km radius from jumping out. Torus stations also have quite a big prevention radius.

I don't know off the top of my head whether it's the volume or the mass of the entity which prevents jumps. If it's mass you also could use a smaller ship and give it a ridiculously high density.

EDIT: a short test shows that indeed the ship's mass is the relevant factor, so you can use the density trick. Now you just have to fiddle with it until you have a satisfactory blocking range.
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:
I don't know off the top of my head whether it's the volume or the mass of the entity which prevents jumps. If it's mass you also could use a smaller ship and give it a ridiculously high density.

EDIT: a short test shows that indeed the ship's mass is the relevant factor, so you can use the density trick. Now you just have to fiddle with it until you have a satisfactory blocking range.
From the comment in the code I read:

Code: Select all

	// checks if there are any large masses close by
	// since we want to place the space station at least 10km away
	// the formula we'll use is K x m / d2 < 1.0
	// (m = mass, d2 = distance squared)
	// coriolis station is mass 455,223,200
	// 10km is 10,000m,
	// 10km squared is 100,000,000
	// therefore K is 0.22 (approx)
However the actual value used in the code for K is 0.1, making the actual test for blocking: 0.1 * mass > distance * distance
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 »

Eric Walch wrote:

Code: Select all

	// checks if there are any large masses close by
	// since we want to place the space station at least 10km away
	// the formula we'll use is K x m / d2 < 1.0
	// (m = mass, d2 = distance squared)
	// coriolis station is mass 455,223,200
	// 10km is 10,000m,
	// 10km squared is 100,000,000
	// therefore K is 0.22 (approx)
However the actual value used in the code for K is 0.1, making the actual test for blocking: 0.1 * mass > distance * distance
Thanks, Eric! :D It's always good to have someone who is diving into the code.

@ Ragged: So you only have to create a ship, look at its normal mass, and set its density to a value so that the resulting mass is ten times the square of the distance you want to achieve.
Ragged
Above Average
Above Average
Posts: 28
Joined: Mon Jun 29, 2009 10:55 am

Post by Ragged »

Excellent solution.

Do you know the formula for calculating mass?
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 »

The simplest way is to spawn the ship and investigate it with the JS-console. Target the ship, and type: player.ship.target.mass

Or make a dump for the ship. The mass should be among the recorded values.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

Commander McLane wrote:
Example: it is impossible to jump in a radius of 10 km around a normal station. A superhub effectively prevents ships inside a 23 km radius from jumping out. Torus stations also have quite a big prevention radius.
As far as the actual figures are concerned, I seem to be able to jump from ~5 km from a normal station and ~13 km from a superhub. Could those numbers you quoted be diameter instead of radius?
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 »

Switeck wrote:
Commander McLane wrote:
Example: it is impossible to jump in a radius of 10 km around a normal station. A superhub effectively prevents ships inside a 23 km radius from jumping out. Torus stations also have quite a big prevention radius.
As far as the actual figures are concerned, I seem to be able to jump from ~5 km from a normal station and ~13 km from a superhub. Could those numbers you quoted be diameter instead of radius?
According to above formula and the coriolis mass mentioned there, it would be: Math.sqrt( 0.1 * 455223200) = 6747.02 meter. So this means the values you experienced in game are what the code mend to be. :lol:
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

I've definitely done jumps from the main station at less than 6 km, simply because I can't get that far away from the main station that fast in a Boa 2 in 15 seconds without injecting.
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 »

Switeck wrote:
Commander McLane wrote:
Example: it is impossible to jump in a radius of 10 km around a normal station. A superhub effectively prevents ships inside a 23 km radius from jumping out. Torus stations also have quite a big prevention radius.
As far as the actual figures are concerned, I seem to be able to jump from ~5 km from a normal station and ~13 km from a superhub. Could those numbers you quoted be diameter instead of radius?
That's strange. Since I didn't dive into the code I took all my measurements in-game. I was flying away from a Superhub and hit "H" repeatedly. Only upwards of 23 km it started working. I also tried to jump faster after launching from a main station. But if I have the buoy in front of me when the countdown is up the jump fails. Therefore in my experience the 10 km rule is pretty accurate. There may be a couple of meters missing, but certainly not four kilometers or more.

The only thing I can imagine is that the jump distance may be shorter in the direct line in front of the dock. I usually leave that line pretty soon after launch, because I don't want to collide with the buoy.
User avatar
Sendraks
---- E L I T E ----
---- E L I T E ----
Posts: 404
Joined: Tue Jun 02, 2009 1:43 pm
Location: Leeds UK

Post by Sendraks »

Given you can apply this effect to a ship, could you apply it to a missile?

I'm guessing that as there is the idea of this being applied to a Navy mine, then the intent is for this to be applied to a launchable object. So you could have ships dropping interdiction mines during a fight to stop a target escaping. A real boon for bounty hunters.
User avatar
Darkbee
---- E L I T E ----
---- E L I T E ----
Posts: 335
Joined: Mon Aug 09, 2004 8:40 pm
Location: Space... man!
Contact:

Post by Darkbee »

What advantage is there from jumping into Witchspace while under attack from bounty hunters (or any ship for that matter)? Wouldn't they just follow you through your own worm hole? Is there a random chance that you won't come out in the same location? Is there still a random chance of getting stuck in Witchspace, as with your own jumps? This also begs the question of whether non-escort AI currently will follow you through your worm holes? I'm guessing the answer is no.

Anyway, as a player, other ships jumping to Witchspace serves no purpose if they are trying to escape your laser crosshairs, as you can simple follow (fuel free too! Which would put them at even less of an advantage in terms of using fuel injectors).
Darkbee
Oolite: A grOovy Kind of Love
Image
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 »

Darkbee wrote:
Anyway, as a player, other ships jumping to Witchspace serves no purpose if they are trying to escape your laser crosshairs, as you can simple follow (fuel free too! Which would put them at even less of an advantage in terms of using fuel injectors).
Well, it begins to make prefect sense if you imagine a fight with multiple opponents. If everybody jumps out in a different direction, the player can only enter one of the wormholes, so the rest of the bunch would be safe.

Also jumping out while the player is still engaged with another adversary makes sense, especially for small ships. Chances are that the wormhole wouldn't last long enough to follow, if the player would be busy finishing off the rest of the bunch.
Post Reply