Page 1 of 2
Preventing witchspace jumps
Posted: Sat Sep 11, 2010 11:47 pm
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?
Posted: Sun Sep 12, 2010 8:19 am
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).
Posted: Sun Sep 12, 2010 9:15 am
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.
Posted: Sun Sep 12, 2010 10:23 am
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.
Posted: Sun Sep 12, 2010 10:41 am
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
Posted: Sun Sep 12, 2010 10:57 am
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!
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.
Posted: Sun Sep 12, 2010 10:58 am
by Ragged
Excellent solution.
Do you know the formula for calculating mass?
Posted: Sun Sep 12, 2010 11:00 am
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.
Posted: Sun Sep 12, 2010 3:13 pm
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?
Posted: Sun Sep 12, 2010 3:23 pm
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.
Posted: Sun Sep 12, 2010 4:03 pm
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.
Posted: Sun Sep 12, 2010 4:13 pm
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.
Posted: Mon Sep 13, 2010 3:00 pm
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.
Posted: Mon Sep 13, 2010 4:05 pm
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).
Posted: Mon Sep 13, 2010 9:45 pm
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.