Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

[RELEASE] Torus To Sun OXP v1.7

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

Moderators: winston, another_commander

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [RELEASE] Torus To Sun OXP v1.5

Post by Norby »

avder wrote:
the longer I play, the speedup effect increases with every jump or dock/undock.
Welcome avder!

Please check if you use the latest version. Your description sounds like a bug which has been fixed in v1.5.
A missing $ sign in the StopTimer function started an additional timer and increasing bonus at every lauch and jump.
Layne
---- E L I T E ----
---- E L I T E ----
Posts: 355
Joined: Sat Mar 28, 2015 11:14 pm

Re: [RELEASE] Torus To Sun OXP v1.5

Post by Layne »

avder wrote:
Hello, new board member here, have been lurking for a few weeks as I only recently discovered Oolite and have been enjoying it quite a bit and this board has helped a lot.
I would also like to table a motion to petition a formal proposal to requisition an application to welcome you to the board as well!

All in favor of greeting avder? (*show of hands*)

That sounds a lot more complicated than it really needed to be.
Reports of my death have been greatly underestimated.
avder
Above Average
Above Average
Posts: 29
Joined: Mon Jul 27, 2015 4:39 pm

Re: [RELEASE] Torus To Sun OXP v1.5

Post by avder »

Norby wrote:
avder wrote:
the longer I play, the speedup effect increases with every jump or dock/undock.
Welcome avder!

Please check if you use the latest version. Your description sounds like a bug which has been fixed in v1.5.
A missing $ sign in the StopTimer function started an additional timer and increasing bonus at every lauch and jump.
The in game expansion manager says I have 1.5.

I'll try downloading it manually off the Wiki.

And as for the complexity...well I'm a "fix it yourself" kind of guy at heart :D
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [RELEASE] Torus To Sun OXP v1.6

Post by Norby »

I found and fixed another typo, please update to v1.6 and try again.
avder
Above Average
Above Average
Posts: 29
Joined: Mon Jul 27, 2015 4:39 pm

Re: [RELEASE] Torus To Sun OXP v1.6

Post by avder »

Outstanding! Works flawlessly now. And on my 3rd test I ran into about 20 pirates from the neighboring Anarchy system doing battle with Vipers and assorted do-gooders so I bagged a ton of kills and escape pods to boot. Only a few hundred more to go until I get upgraded from Dangerous to Deadly.

I have a feature request tho: an optional equipment item that would create an interface while docked that would let you manually change the maximum speed with weapons on (perhaps togglable only between 1 and 2), and the time compression variables. Maybe have it cost 15 minutes per integer of change for balance? Seems like it should be station only as it occurs to me that tweaking those settings in flight is just asking for a core meltdown or something, or a catastrophic unintentional witchspace jump to interstellar space, or a ship fire that destroys your precious Naval Energy Unit.

Also any way of getting it to work with the navigation MFD to have it display correct ETA's?

Excellent work btw, I've got a couple more of your add-ons and they all work wonderfully.

Glad I could help you pin down a bug :)
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: [RELEASE] Torus To Sun OXP v1.6

Post by Day »

@avder: greetings avder!

@Norby: thank you Norby for the bugfix :)
The way I play, I gradually developed ways to handle the extreme speed, but I wondered if it was the "normal" gameplay :D
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [RELEASE] Torus To Sun OXP v1.6

Post by gsagostinho »

@Norby I don't know if this is still being maintained, but here is a small feature request: when using this OXP together with the Navigation MFD, the Estimated Travel Time is displayed wrongly. At every refresh moment, the Estimated Travel Time value is shown as the time that the ship would take with a regular torus (1x) regardless of the current value. Would it be possible to somehow compensate that?
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [RELEASE] Torus To Sun OXP v1.6

Post by Norby »

It is possible to make support in the other side, as in CombatMFD. Ask spara there.

The next lines can calculate the real speed:

Code: Select all

var p = player.ship;
var sp = Math.round(p.velocity.magnitude()/10)*10; //stable but can not show FTL drive nor Torus multiplier
var t = worldScripts.torustosun;
if( t && t.$TorusToSunBonus > 1 ) {
        sp = Math.round(t.$TorusToSunBonus * 3.2 * p.maxSpeed)*10;
        if( t.$TimeFw > 1 ) { //time forwarding active
                sp *= t.$TimeFw;
        }
} else {
        if(sp > 31 * p.maxSpeed ) { //support for FarPlanets and any other position changer drives
                var psp = Math.round(0.1*p.position.distanceTo(this.$PlayerPrevPos))*10;
                if( psp > 1.1*sp ) sp = psp;//instable but needed to follow position changes
        }
}
this.$PlayerPrevPos = p.position;
//now sp contain the approximated player speed
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [RELEASE] Torus To Sun OXP v1.6

Post by gsagostinho »

Of course that has to be implemented on the MFD side, my bad :oops: I already wrote a request on that thread, thanks!
tokugawa
Average
Average
Posts: 12
Joined: Fri Sep 01, 2006 12:51 am
Location: Wroclaw, Poland

Re: [RELEASE] Torus To Sun OXP v1.6

Post by tokugawa »

Hi. I have made what i'm hoping is improvement. Frame Callback is scary regardless of computing power :). TTS is executing it even if torus isn't enabled (like in fights...). This crude but seems to be working hack starts frame callback only for torus maxed. Frame callback removes itself if no speedup is to apply.

Code: Select all

--- a/Scripts/torustosun.js
+++ b/Scripts/torustosun.js
@@ -74,6 +74,11 @@ this._FCB = function( delta ) { //masslockcheck in this framecallback
                var s = ps.maxSpeed * 32;
                var t = this.$TimeFw - 1; //torus speed with time forwarding
                ps.position = ps.position.add( f.multiply( delta * s * ( t + b - 1 ) ) ); //apply speed bonus
+       } else
+       {
+               var ws = worldScripts.torustosun;
+               if( isValidFrameCallback( ws.$FCB ) )
+                       removeFrameCallback( ws.$FCB );
        }
 }
 
@@ -112,8 +117,6 @@ this._StartTimer = function() {
        ws.$PrevEnergy = player.ship.maxEnergy;
        ws.$FwSec = 0; //part of a second during forwarding
        ws.$Timer = new Timer(ws, ws._Timed.bind(ws), 1, 0.25);
-       if( !isValidFrameCallback( ws.$FCB ) )
-               ws.$FCB = addFrameCallback( ws._FCB.bind(ws) );
 }
 
 this._StopTimer = function() {
@@ -132,6 +135,9 @@ this._Timed = function() {
        if( !ps || !ps.isValid ) return; //player died
        if( player.alertCondition == 1 && ps.speed > ps.maxSpeed * 31.9 ) {//Green Alert and Torus maxed
                this._TorusSpeedUp();
+               var ws = worldScripts.torustosun;
+               if( !isValidFrameCallback( ws.$FCB ) )
+                       ws.$FCB = addFrameCallback( ws._FCB.bind(ws) );
        }
 }
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [RELEASE] Torus To Sun OXP v1.7

Post by Norby »

Thank you tokugawa, Torus To Sun v1.7 contain your patch for better offline performance.
tokugawa
Average
Average
Posts: 12
Joined: Fri Sep 01, 2006 12:51 am
Location: Wroclaw, Poland

Re: [RELEASE] Torus To Sun OXP v1.7

Post by tokugawa »

That was fast! I didn't have enough time to roast new patch - maybe you will like it (because this oxp is beautiful - for non-standard ooniverses especially). I can't find which version has alertConditionChanged, but using it i simplified "if" in timed callback - and more importantly the callback isn't called during combat at all!. So nothing bothers me 4 times per second:P All should work to Your intent (i hope you don'y mind my meddling..)

I can sleep now :)

remove log if you integrate this - i'm currently testing this

Code: Select all

--- a/Scripts/torustosun.js
+++ b/Scripts/torustosun.js
@@ -51,11 +51,24 @@ this.shipWillEnterWitchspace = function() {
 }
 
 this.shipWillExitWitchspace = function() {
-       this._StartTimer(); //must start before Telescope FCBs!
+       this.alertConditionChanged(player.alertCondition, -1); //must start before Telescope FCBs!
 }
 
 this.shipWillLaunchFromStation = function() {
-       this._StartTimer(); //must start before Telescope FCBs!
+       this.alertConditionChanged(player.alertCondition, -1);
+}
+
+this.alertConditionChanged = function(newCondition, oldCondition)
+{
+       log("alertConditionChanged", newCondition  + "::" + oldCondition)
+       if (newCondition == 1)
+       {
+               this._StartTimer();
+       }
+       else
+       {
+               this._StopTimer();
+       }
 }
 
 //TorusToSun functions
@@ -133,7 +146,7 @@ this._StopTimer = function() {
 this._Timed = function() {
        var ps = player.ship;
        if( !ps || !ps.isValid ) return; //player died
-       if( player.alertCondition == 1 && ps.speed > ps.maxSpeed * 31.9 ) {//Green Alert and Torus maxed
+       if( ps.speed > ps.maxSpeed * 31.9 ) {//Green Alert and Torus maxed
                this._TorusSpeedUp();
                var ws = worldScripts.torustosun;
                if( !isValidFrameCallback( ws.$FCB ) )
[EDIT] I'll be sure with one timer only, [EDIT2] don't stress the garbage collector.

Code: Select all

@@ -37,10 +37,13 @@ this.$WFP = null; //store worldScripts.farplanets
 //world script events
 this.startUp = function() {
 	this.$WED = worldScripts.escortdeck;
 	this.$WFP = worldScripts.farplanets;
 	var n = worldScripts.numerichudv3;
+	var ws = worldScripts.torustosun;
+	ws.$Timer = new Timer(ws, ws._Timed.bind(ws), 1, 0.25);
+	ws.$Timer.stop();
 //	if( n && n.version * 1 >= 3.24 ) this.$Messages = false;
 }
 
 this.shipWillDockWithStation = function() {
 	this._StopTimer();
@@ -112,30 +128,30 @@ this._Proximity = function(ws) { //there is a similar function in TimeControl ox
 	return(false);
 }
 
 this._StartTimer = function() {
 	var ws = worldScripts.torustosun;
+	if( ws.$Timer.start() ) {
+		log("t","was started before")
+		return
+	}
 	ws.$PrevEnergy = player.ship.maxEnergy;
 	ws.$FwSec = 0; //part of a second during forwarding
-	ws.$Timer = new Timer(ws, ws._Timed.bind(ws), 1, 0.25);
 }
 
 this._StopTimer = function() {
 	var ws = worldScripts.torustosun;
-	if( ws.$Timer ) {
 	ws.$Timer.stop();
-		delete ws.$Timer;
-	}
 	if( isValidFrameCallback( ws.$FCB ) )
 		removeFrameCallback( ws.$FCB );
 	this._TorusSlowDown(); //set bonus to 1
 }
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [RELEASE] Torus To Sun OXP v1.7

Post by Norby »

Thank you for your ideas, now I uploaded these.
KaiserZandrich
Average
Average
Posts: 10
Joined: Sun Dec 06, 2020 10:02 pm

Re: [RELEASE] Torus To Sun OXP v1.7

Post by KaiserZandrich »

Recently picked up TorusToSun after I realised the distance adjustments were too heavy, but I noticed Torus engine "trail" artifacting above x1 Torus speed, which extends too far to see at about x6 Torus speed. Is there any way I can disable the Torus engine "lights" within your OXP (or even Oolite entirely)? It's a minor detail, but my OCD is driving me insane.

Also, this is probably a necro, but PMs are disabled and I was 110% unsure which board to post this on.
Last edited by KaiserZandrich on Sun Nov 21, 2021 3:18 am, edited 1 time in total.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16073
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: [RELEASE] Torus To Sun OXP v1.7

Post by Cody »

KaiserZandrich wrote: Sun Dec 06, 2020 10:09 pm
PMs are disabled and I was 110% unsure which board to post this on.
Once your first post has been approved (which it now has been), PMs will work - and welcome aboard.
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!
Post Reply