Reverse up-down control when looking astern?

An area for discussing new ideas and additions to Oolite.

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: Reverse up-down control when looking astern?

Post by Norby »

cim wrote:
player.ship.AI. If it's "dockingAI.plist" then the docking computer is active.
Thanks cim, I put this fix into [wiki]ReverseControl[/wiki] v1.2.
Now docking computer is working well in the aft view also.
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Reverse up-down control when looking astern?

Post by Zireael »

Uh, Norby, with your OXP it reversed my controls in the front view, too.
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: Reverse up-down control when looking astern?

Post by Norby »

Zireael wrote:
it reversed my controls in the front view, too.
I can't reproduce your problem, nor imagine how this happen. The whole code is very short and all relevant lines are within the following condition (ps=player.ship):

Code: Select all

if( ps && ps.isValid && !ps.docked && ps.viewDirection == "VIEW_AFT" 
		&& ps.AI != "dockingAI.plist" ) {
You must debug due to the problem is at you only, for example put a log(this.name, ps.viewDirection); call after the quoted line. If you can proof that this return aft while you are in the front view then maybe the core dev team will do something.
Graham
Average
Average
Posts: 10
Joined: Thu Jan 08, 2015 12:56 pm

Re: Reverse up-down control when looking astern?

Post by Graham »

I've just started looking at the Expansion Packs and the first one I decided to try was the Reverse Control one, however although it says "In Oolite v1.79 or later do not unzip the .oxz file, just move into the AddOns folder of your Oolite installation", when I tried to run the game I got a message "Reversecontrol_1.3.ocx does not have a valid manifest plist and could not be loaded".

I don't know what this means, but I'm using the latest release version.

Can someone help, please?
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: Reverse up-down control when looking astern?

Post by Norby »

The wiki say how can you install it by hand but the best way is to use the built-in expansion manager. This oxz contain a valid manifest.plist at me so I do not know how can you get this message - maybe you use a Mac (where I can not test)? If not then I guess something is changed at you due to the problem is not reported by the other one thousand downloaders.
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: Reverse up-down control when looking astern?

Post by Norby »

[EliteWiki] ReverseControl v1.4 normalize controls in left and right views also.

There is a bit strange effect during roll in side views, it seems the centre of roll is not the centre of view, but I can not fix this by moving the viewpoint in shipdata due to the centre moving further with my changes. :shock:
Still usable imho and no problem with yaw which is much better in side views to compensate the forward movement of your ship.

Thanks to Lone Wolf for a performance idea which is implemented now also, and here is an answer to his question arrived in pm about the math, maybe others are interested also.

In my code ps.pitch is the current pitching speed in angle/second what the player set with his controller in this moment. I multiply ps.pitch with delta (the fraction of a second elapsed since the last frame) to get the angle what the ship rotated since the last frame. Then I apply the double of this angle in reverse direction to cancel the rotation added by the core and make a similar opposite one.

When I set pitch then I rotate around prevori.vectorRight() which points to "right" from the orientation vector of the previous frame.
Imagine the forward vector of your ship, then turn right (press F4 ;)), then rotate yourself clockwise around your centre: this is what your ship do when pitching up. In js:

Code: Select all

	var a = ps.pitch * delta;
	var c = prevori.vectorRight();
	ps.orientation = ps.orientation.rotate( c, 2 * a );
Then I do the same with roll also, then the variations of this to the side views. After I imagined the situtation in a side view I applied the current roll to the new pich and pitch to roll, then I tried and corrected the direction by a minus sign before 2*a where needed.
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:

Reverse Y Control v1.5

Post by Norby »

Reverse Y Control, which is a variation of ReverseControl to satisfy this request, now got a small fix in v1.5 to work instantly after hyperjump in the case when one of the views accessible by F5-F8 are shown at the point when the countdown ends.
cag
Deadly
Deadly
Posts: 202
Joined: Fri Mar 17, 2017 1:49 am

Re: Reverse up-down control when looking astern?

Post by cag »

Norby: I've been playing around w/ your code & this fixes the prob on my rig. Try it out:

Code: Select all

this.$ReverseControl_FCB = function( delta ) { //FrameCallBack
	var ps = player.ship;
	var a, c = null;
	if( ps && ps.isValid && !ps.docked && this.$ReverseControlOn && ps.AI != "dockingAI.plist" ) {
		var prevori = this.$ReverseControlPrevOri;
		if( prevori ) switch ( ps.viewDirection ) {
			case "VIEW_AFT":
				//reverse up-down
				a = ps.pitch * delta;
				c = prevori.vectorRight();
				ps.orientation = ps.orientation.rotate( c, 2 * a ); // 2 * incl's correcting for pitch cmd that got us here
				//reverse roll
				a = ps.roll * delta;
				c = prevori.vectorForward();
				ps.orientation = ps.orientation.rotate( c, 2 * a ); // 2 * incl's correcting for roll cmd that got us here
				break;
			case "VIEW_PORT":
				//pitch -> roll
				a = ps.pitch * delta;
				c = prevori.vectorRight();
				ps.orientation = ps.orientation.rotate( c, 1 * a ); // - 1st undo this frame's pitch
				c = prevori.vectorForward();
				ps.orientation = ps.orientation.rotate( c, -1 * a ); // - now apply pitch cmd as roll
				//roll -> -pitch
				a = ps.roll * delta;
				c = prevori.vectorForward();
				ps.orientation = ps.orientation.rotate( c, 1 * a ); // - 1st undo this frame's roll
				c = prevori.vectorRight();
				ps.orientation = ps.orientation.rotate( c, 1 * a ); // - now apply roll cmd as pitch
				break;
			case "VIEW_STARBOARD":
				//pitch -> roll
				a = ps.pitch * delta;
				c = prevori.vectorRight();
				ps.orientation = ps.orientation.rotate( c, 1 * a ); // - 1st undo this frame's pitch
				c = prevori.vectorForward();
				ps.orientation = ps.orientation.rotate( c, 1 * a ); // - now apply pitch cmd as roll
				//roll -> -pitch
				a = ps.roll * delta;
				c = prevori.vectorForward();
				ps.orientation = ps.orientation.rotate( c, 1 * a ); // - 1st undo this frame's roll
				c = prevori.vectorRight();
				ps.orientation = ps.orientation.rotate( c, -1 * a ); // - now apply roll cmd as pitch
				break;
			default:
				this.$Stop();
		}
		this.$ReverseControlPrevOri = ps.orientation;
	} else {
		this.$ReverseControlPrevOri = null;
	}
}
Last edited by cag on Sat Mar 18, 2017 11:25 pm, edited 1 time in total.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Reverse up-down control when looking astern?

Post by Cody »

Welcome aboard, Commander! Tip: click edit and highlight that code, then hit the Code button.
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!
cag
Deadly
Deadly
Posts: 202
Joined: Fri Mar 17, 2017 1:49 am

Re: Reverse up-down control when looking astern?

Post by cag »

Thanks for the heads up. Out of curiosity, who audits the code that goes into OXP's?
My framerate is suffering and that appears to be the culprit.
[I've a quad-core CPU @ 3 GHz, 8 GB RAM, Radeon R7 graphics and run from an SSD]
I even tried wire frames w/ min. detail; made no diff!
"Better to be thought a fool, boy, than to open your trap and remove all doubt." - Grandma [over time, just "Shut your trap... fool"]
"The only stupid questions are the ones you fail to ask." - Dad
How do I...? Nevermind.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Reverse up-down control when looking astern?

Post by Cody »

<scratches head> What sort of framerate are you getting? GFX drivers, perhaps? What's in the Latest.log?
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!
cag
Deadly
Deadly
Posts: 202
Joined: Fri Mar 17, 2017 1:49 am

Re: Reverse up-down control when looking astern?

Post by cag »

no oxp: 110-160 fps just sun, planet, station & buoy
min oxp: 90-115 fps traffic around station
basic oxp: 85-105 fps station stuff, BGS, CCL, all in Ambiences_recommended_by_Norby
However, once I get into oxp's w/ framecallbacks (HUDs, MFD's, reverse control, telescope, etc.) I drop into the low 20's when things are calm, high teens when it gets busy.
When I first went thru the games oxz manager, I'd picked a few hundred - mistake!
So, I've got what I believe are more essential and/or less intensive ones (around 90 in ManagedAddOns) and get the85-105 fps stated above.
I've split out missions, Povray's Planets into galaxy specific folders, so it loads less.
I've been optimizing the framerate intensive ones as I go and found, how to be polite, code w/ not fully realized potential(?).
Hence my query re: code audits, who or if?
Take the preceeding post; I tried to pm Norby w/ the fix but the BB wouldn't let me. I don't want to code-shame people, oxp's take hard work but esp. creativity & imagination. I could help w/ the coding - I worked on an interpreter (for Fortran) back in the dark ages (pre-web) - but not via a BB.

[can't really give you a Latest.log at the moment, as its full of my debugging. Is it possible to get line #'s in the log when there's a script error?]
"Better to be thought a fool, boy, than to open your trap and remove all doubt." - Grandma [over time, just "Shut your trap... fool"]
"The only stupid questions are the ones you fail to ask." - Dad
How do I...? Nevermind.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Reverse up-down control when looking astern?

Post by Cody »

I know zilch about coding/audit stuff - I'm merely a dumb pilot.
cag wrote: Sun Mar 19, 2017 2:01 am
Is it possible to get line #'s in the log when there's a script error?]
You mean like this:

Code: Select all

14:03:35.062 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (BGS 2.0): TypeError: this._aid.keepOnScreenID is undefined
14:03:35.062 [script.javaScript.exception.unexpectedType]:       ../AddOns/BGS2.0.oxp/Scripts/BGS.js, line 191.
Which text editor are you using?
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!
cag
Deadly
Deadly
Posts: 202
Joined: Fri Mar 17, 2017 1:49 am

Re: Reverse up-down control when looking astern?

Post by cag »

YES, exactly. All I get is:
n23:35:09.016 [script.javaScript.exception.notDefined]: ***** JavaScript exception (MFDRestoreAfterLoad 0.1 alpha 1): ReferenceError: junk is not defined

I'm using NotePad++ with the JSLint plug-in. That catches all the syntax & variable declaration errors.

I've tried the "logging..." options in the .GNUstepDefaults file but no joy.
"Better to be thought a fool, boy, than to open your trap and remove all doubt." - Grandma [over time, just "Shut your trap... fool"]
"The only stupid questions are the ones you fail to ask." - Dad
How do I...? Nevermind.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Reverse up-down control when looking astern?

Post by phkb »

I think you also need the Debug OXP, found here: http://wiki.alioth.net/index.php/Debug_OXP

And possibly the developer release: http://www.oolite.org/download/
Post Reply