Preventing witchspace jumps
Moderators: winston, another_commander
Preventing witchspace jumps
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?
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?
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).
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).
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Commander McLane
- ---- 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:
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.
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.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
From the comment in the code I read: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.
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)
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- 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:
Thanks, Eric! It's always good to have someone who is diving into the code.Eric Walch wrote:However the actual value used in the code for K is 0.1, making the actual test for blocking: 0.1 * mass > distance * distanceCode: 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)
@ 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.
- Commander McLane
- ---- 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:
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?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.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
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.Switeck wrote: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?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.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- 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:
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.Switeck wrote: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?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.
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.
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.
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.
- Darkbee
- ---- E L I T E ----
- Posts: 335
- Joined: Mon Aug 09, 2004 8:40 pm
- Location: Space... man!
- Contact:
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).
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).
- Commander McLane
- ---- 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:
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.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).
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.