Witchspace Jump Failure Detection
Moderators: winston, another_commander
- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Witchspace Jump Failure Detection
"...........5,4,3,2,1... witchjump failed", asteroid/station too close.
or
a piece of equipment breaks while going to into witchspace.
We have all had this happen to us when 'somehow' we were too close to something while jumping to another system, particularly after exiting a station or seedy space bar. Would it be possible to create a piece of equipment to detect a coming failure to witchspace, or equipment failure while trying?
or
a piece of equipment breaks while going to into witchspace.
We have all had this happen to us when 'somehow' we were too close to something while jumping to another system, particularly after exiting a station or seedy space bar. Would it be possible to create a piece of equipment to detect a coming failure to witchspace, or equipment failure while trying?
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
- Fatleaf
- Intergalactic Spam Assassin
- Posts: 1988
- Joined: Tue Jun 08, 2010 5:11 am
- Location: In analysis mode on Phaelon
- Contact:
Re: Witchspace Jump Failure Detection
It would be possible, but I prefer the look behind you and see how big the object is compared to my distance from it, approach. And with the stuff breaking then to prevent that keep your ship maintained and it will never happen.
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
Holds the Ooniversal record for "Thread Necromancy"
- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Re: Witchspace Jump Failure Detection
I do; which would explain why it happens so infrequently ( ). I didn't realize that was a maintenance issue .Fatleaf wrote:And with the stuff breaking then to prevent that keep your ship maintained and it will never happen.
Thanks for clearing that up. About the being too close, I have always kept of a habit of no jumping while in close proximity to anything; perhaps it has to do with how close you are to something when the button is pressed?
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
- Fatleaf
- Intergalactic Spam Assassin
- Posts: 1988
- Joined: Tue Jun 08, 2010 5:11 am
- Location: In analysis mode on Phaelon
- Contact:
Re: Witchspace Jump Failure Detection
It is all about the entities mass and the distance you are at the end of the countdown. It works around a formula which I can't seem to find, I know I read it on the BB somewhere but lost it. I'm sure a Dev will enlighten us!CommRLock78 wrote:...perhaps it has to do with how close you are to something when the button is pressed?
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
Holds the Ooniversal record for "Thread Necromancy"
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Witchspace Jump Failure Detection
I dunno, CommRLock78, I don't think you looked very hard. Both these threads are less than a week old:-Fatleaf wrote:It is all about the entities mass and the distance you are at the end of the countdown. It works around a formula which I can't seem to find, I know I read it on the BB somewhere but lost it.CommRLock78 wrote:...perhaps it has to do with how close you are to something when the button is pressed?
https://bb.oolite.space/viewtopic.php?f=4&t=12145
Download this before I update it to a new version. The function $checkForSaveBeforeJump checks whether the player is too close to another mass to make a successful jump:
https://bb.oolite.space/viewtopic.php?f=4&t=12150
The log file BuggyBY posted shows him repeatedly trying to jump while too close to a station, and $checkForSaveBeforeJump correctly predicting the jump would fail.
The mis-jumps, which take three forms - exiting in interstellar space, fuel leak on arrival, or failure to jump with internal damage - can't be predicted before they happen. Cim sent me a detailed explanation, but basically on each jump there's a 1/128 chance of a mis-jump with a well-maintained ship, and slightly higher chance with a poorly-maintained ship.
- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Re: Witchspace Jump Failure Detection
That would explain some of the mis-jumps and whay they happen even on a well-maintained ship.Wildeblood wrote:basically on each jump there's a 1/128 chance of a mis-jump with a well-maintained ship, and slightly higher chance with a poorly-maintained ship.
I'm not sure if I'm looking to add an OXP that changes that much of the game-play, that's why I never did installed the save anywhere OXP
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Witchspace Jump Failure Detection
I'm not asking you to add anything to your game, I'm saying the function that does what you asked about is there in that script to be copy/pasted.CommRLock78 wrote:I'm not sure if I'm looking to add an OXP that changes that much of the game-play, that's why I never did installed the save anywhere OXP
- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Re: Witchspace Jump Failure Detection
Ach, I see now . You're speaking of this, it appears:Wildeblood wrote:I'm not asking you to add anything to your game, I'm saying the function that does what you asked about is there in that script to be copy/pasted.CommRLock78 wrote:I'm not sure if I'm looking to add an OXP that changes that much of the game-play, that's why I never did installed the save anywhere OXP
Code: Select all
function() {
// get all entities within scanner range of player ship
var blockers = system.filteredEntities(this, function() {return true; }, player.ship, 25600);
for (var i=0; i<blockers.length; i++) {
// if they are a ship
if (blockers[i].isShip) {
// get distance by comparing positions
var d = player.ship.position.subtract(blockers[i].position).magnitude();
if (blockers[i].mass / d*d >= 10) {
// too close and heavy, return the blocking entity
return blockers[i];
}
}
}
// if we get this far, nothing is blocking
return null;
}
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Witchspace Jump Failure Detection
A couple of weeks ago now I got a PM asking about this, and my immediate reaction was to assume it would be simple to check for blocking masses when the jump countdown started, and advise the player whether the jump would likely succeed or fail. It's been surprisingly frustrating: it took me a while to figure out the mistake in the following. (See if you can guess what it is, kids. ) It leaves the expected messages in the log file, but nothing on screen.
Code: Select all
"use strict";
this.name = "Check For Likely Jump Success";
this.version = "0.1";
/* ====================================================================================
EXAMPLE CHECK WHEN COUNTDOWN STARTS
======================================================================================= */
this.playerStartedJumpCountdown = function(type, countdown)
{
if (type === "standard")
{
var message = this.$checkForLikelyJumpSuccess();
player.consoleMessage(("Hyperspace jump " + message + "."),6);
player.commsMessage(("Hyperspace jump " + message + "."),6);
log(this.name,("Hyperspace jump " + message + "."));
}
}
this.$checkForLikelyJumpSuccess = function()
{
var howfar = System.infoForSystem(galaxyNumber, system.ID).distanceToSystem(System.infoForSystem(galaxyNumber, player.ship.targetSystem));
if (howfar > player.ship.fuel) return "insufficient fuel";
// Thanks, Ahruman & cim
var psPos = player.ship.position;
var blockers = system.filteredEntities(this, function (entity) {
return entity.isShip &&
entity.mass / psPos.squaredDistanceTo(entity) >= 10;
}, player.ship, 25600);
if (blockers.length > 0) return "blocked";
else return "will likely succeed";
}
Latest.log wrote:14:55:54.121 [Check For Likely Jump Success]: Hyperspace jump will likely succeed.
14:57:59.478 [Check For Likely Jump Success]: Hyperspace jump will likely succeed.
15:34:55.480 [Check For Likely Jump Success]: Hyperspace jump blocked.
15:36:46.663 [Check For Likely Jump Success]: Hyperspace jump will likely succeed.
15:37:30.663 [Check For Likely Jump Success]: Hyperspace jump will likely succeed.
- Tricky
- ---- E L I T E ----
- Posts: 821
- Joined: Sun May 13, 2012 11:12 pm
- Location: Bradford, UK. (Anarchic)
Re: Witchspace Jump Failure Detection
Not sure what I did but I got it to work.
I just cleaned it up a bit and put a few more test lines using player.ship.commsMessage. As you can see from the screenshot it shows all messages.
(commsMessage also outputs to the console)
I just cleaned it up a bit and put a few more test lines using player.ship.commsMessage. As you can see from the screenshot it shows all messages.
(commsMessage also outputs to the console)
Code: Select all
this.playerStartedJumpCountdown = function(type, countdown) {
if (type === "standard") {
var message = this.$checkForLikelyJumpSuccess();
// player.consoleMessage("Hyperspace jump " + message + ".", 6);
player.commsMessage("Hyperspace jump " + message + ".", 6);
player.ship.commsMessage("* Hyperspace jump " + message + ".");
player.ship.commsMessage("** Hyperspace jump " + message + ".", player.ship);
log(this.name, "Hyperspace jump " + message + ".");
}
}
this.$checkForLikelyJumpSuccess = function() {
var ps = player.ship,
howfar = System.infoForSystem(galaxyNumber, system.ID).
distanceToSystem(System.infoForSystem(galaxyNumber, ps.targetSystem));
if (howfar > ps.fuel) {
return "insufficient fuel";
}
// Thanks, Ahruman & cim
var psPos = ps.position;
var blockers = system.filteredEntities(this, function (entity) {
return entity.isShip && entity.mass / psPos.squaredDistanceTo(entity) >= 10;
}, ps, ps.scannerRange);
if (blockers.length > 0) {
return "blocked";
} else {
return "will likely succeed";
}
}
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Witchspace Jump Failure Detection
Commenting out the console message was the crucial fix. Remove the console message, thus, and it will work fine:Tricky wrote:Not sure what I did but I got it to work.
Code: Select all
// player.consoleMessage(("Hyperspace jump " + message + "."),6);
player.commsMessage(("Hyperspace jump " + message + "."),6);
log(this.name,("Hyperspace jump " + message + "."));
Oolite automatically suppresses messages that are identical to the previous message, so-
Code: Select all
player.consoleMessage("Hello world!",6);
player.consoleMessage("Hello world!",6);
Code: Select all
player.consoleMessage("Hello world!",6);
player.commsMessage("Hello world!",6);
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: Witchspace Jump Failure Detection
This is a nice OXP / idea. Excellent!
However [EDITED]:
(1) The 'likely to succeed' message is a bit misleading, since it somewhat suggests there will be no misjump, i.e. that you won't end up in interstellar space. How about saying that the jump will not be 'mass locked' or something like that? [This does not apply to the 'Check For Likely Witchspace Jump Failure' OXP, but only - at most - to the test OXP 'Check For Likely Jump Success'.]
(2) In my brief testing I saw the 'likely succeed' message only some of the times that the jump succeeded. [Ditto above parenthetical comment.]
(3) Sometimes part of a message from the OXP got obscured on my screen. (I have such messages appearing in the bottom-ish right of the screen).
(4) 'Avoid nearby mass' is not quite the best English / as specific as it could be. How about 'Distance yourself from nearby mass' or 'Depart from nearby mass' or just 'Mass locked'?
However [EDITED]:
(3) Sometimes part of a message from the OXP got obscured on my screen. (I have such messages appearing in the bottom-ish right of the screen).
(4) 'Avoid nearby mass' is not quite the best English / as specific as it could be. How about 'Distance yourself from nearby mass' or 'Depart from nearby mass' or just 'Mass locked'?
Last edited by UK_Eliter on Sat Sep 01, 2012 10:31 pm, edited 1 time in total.
- Rese249er
- ---- E L I T E ----
- Posts: 647
- Joined: Thu Jun 07, 2012 2:19 pm
- Location: Well, I WAS in G3...
Re: Witchspace Jump Failure Detection
Point is, it works as intended. The text could Ghurka pickles and I'd smile as I injected a little farther. Great OXP!
Got all turned around, lost my nav connection... Where am I now?
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Witchspace Jump Failure Detection
UK_Eliter, you appear to be commenting on both the test script above (Check For Likely Jump Success 0.1), and the version I packaged as an OXP (Check For Likely Witchspace Jump Failure 1.0) over there, and not discriminating between them. This is the only message the OXP will produce:-UK_Eliter wrote:(2) In my brief testing I saw the 'likely succeed' message only some of the times that the jump succeeded.
(4) 'Avoid nearby mass' is not quite the best English / as specific as it could be. How about 'Distance yourself from nearby mass' or 'Depart from nearby mass' or just 'Mass locked'?
So I'd be very surprised if you ever saw the "likely to succeed" message.this.playerStartedJumpCountdown = function(type, countdown)
{
if (type === "standard")
{
if (this.$checkForLikelyJumpSuccess() == "blocked") player.commsMessage("Witchspace jump blocked. Avoid nearby mass before countdown ends.",5);
}
}
- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Re: Witchspace Jump Failure Detection
Hat's off to Tricky and Wildeblood. Many thanks indeed fellas ! I just tested it and I have to say, I love this "OXP"; it's exactly what I was thinking when I created the thread. Now, I have my usual noob kind of question: I placed the script.js in the /AddOns/Config folder, which I had to create, so the question is, is a folder named Config in the AddOns folder an extension to the "main" Config folder .
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'