oolite cockpit/increasing the viewing angle

General discussion for players of Oolite.

Moderators: winston, another_commander

Blecha
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Tue Dec 04, 2012 2:30 pm
Location: Ceesxe

oolite cockpit/increasing the viewing angle

Post by Blecha »

So I am fairly new to oolite but no less obsessed. I have been wanting to build a cockpit for FPV airplanes and general flight stuff but I am actually in the serious planning stages now. With most flight sim software you can fairly easily tweak it to work with a curved screen and projectors, oolite on the other hand is locked in to its default viewing angle. I am a fairly proficient C and python coder so I would probably end up digging into this at some point regardless of difficulty but I wanted to see how hard you folks thought it would be before I start buying expensive hardware. So here are my questions:

What sections of code would I want to start looking at to adjust the viewing angle?

Are there any inbuilt issues with changing this?

Is it even "possible" with the current codebase to go up to say 180 degrees? 220? 360?

Thanks to anyone who can help point me in the right direction :)
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: oolite cockpit/increasing the viewing angle

Post by another_commander »

I believe the best place to start looking for field of view modifications would be GameController.m, method - (void)setUpBasicOpenGLStateWithSize:(NSSize)viewSize, particularly the glFrustum call line. With some very crude, quick and dirty experiments, it seems that it is relatively straight forward setting the FOV to values other than the default. Here is one screenie taken at Lave with a FOV set close to 180 degrees.
Image
For angles higher than this, we seem to be getting some positioning and depth buffer issues (mainly objects popping in/out of existence, exhausts misplacement etc.). Also the scanner gets scaled together with the view depending on selected FOV, which is not what we really want, but for the purposes of testing and proof of concept, this much should be good enough for now.

Edit to add: Topic moved to Discussion, as it is not Linux specific.
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: oolite cockpit/increasing the viewing angle

Post by Day »

Hi everybody,

here is a new Jameson having flown only some short hours, with most OXZ activated.

I would find really useful to be able to modify via oxp the viewing angle.
I went to see into the code, and what it would take for this is to make writable by oxp the variable GameController.setUpBasicOpenGLStateWithSize.ratio, currently fixed to 0.5.

Currently, this gives (if i'm doing it correctly) a viewing angle of 2*Tan-1(ratio=0.5/1) = 53° for the vertical axe.
The angle for the horizontal axe depends on the geometry of your screen.

I look forward to having some equipments upgrade allowing to have a greater angle of view :-)
And better still, an angle of view depending on the current activity, for example greater when in jump mode :-)

Would this be possible?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: oolite cockpit/increasing the viewing angle

Post by another_commander »

Changes that occurred in the rendering code after my initial message seem to have complicated things a bit. At the moment of writing this, I am not able to change the field of view just by changing the ratio value in trunk.

But even if it worked, it would still need plenty of fine tuning, as you don't really want the scanner to follow changes in the FOV. The side effects with objects popping up and disappearing at certain ratio values would also have to be fixed. So it needs some work. It would be quite interesting to have FOV set via preferences or OXP methods, provided that it gets done properly and not as a quick hack (which what changing ratio really was).
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: oolite cockpit/increasing the viewing angle

Post by Day »

Hi another_commander, thanks for answering.

Well, I wasn't aware of it as I just got a quick view in this method, but you're right if some things like the scanner are related to the FOV, then the change is not obvious.

Oh well, i guess i'll have to wait for the time this idea is considered top of TODO :-p
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: oolite cockpit/increasing the viewing angle

Post by Cody »

G'day, Day - 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!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: oolite cockpit/increasing the viewing angle

Post by another_commander »

@Day: If you would like to give it a try by all means go ahead! Patches with improvements are more than welcome and we can help with questions that may pop up along the way.
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: oolite cockpit/increasing the viewing angle

Post by Day »

@Cody: thank you, Cody :-)

@another_commander: well, i'm proficient in a number of languages, but not in C or objective-C :-/
Is there somebody in the dev team working on linux? What is the config they use? Eclipse like in http://wirecode.blogspot.fr/2007/11/obj ... lipse.html ?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: oolite cockpit/increasing the viewing angle

Post by another_commander »

Day wrote:
Is there somebody in the dev team working on linux? What is the config they use? Eclipse like in http://wirecode.blogspot.fr/2007/11/obj ... lipse.html ?
OTOH cim, kanthoney, submersible and quite often Getafix all work on Linux. I'm sure one (or more) of them will be here soon to help with your question.
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: oolite cockpit/increasing the viewing angle

Post by Cody »

another_commander wrote:
... cim, kanthoney, submersible and quite often Getafix all work on Linux.
The Penguinistas have taken over the asylum!
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!
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: oolite cockpit/increasing the viewing angle

Post by Smivs »

An asylum as a refuge for the sane - interesting concept :)

...and welcome, Day.
Commander Smivs, the friendliest Gourd this side of Riedquat.
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: oolite cockpit/increasing the viewing angle

Post by Day »

Thank you Commander Smivs :-)
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: oolite cockpit/increasing the viewing angle

Post by cim »

Day wrote:
Is there somebody in the dev team working on linux? What is the config they use? Eclipse like in http://wirecode.blogspot.fr/2007/11/obj ... lipse.html ?
Nothing so fancy here - emacs to edit the source code, and a terminal window to type 'make' into to build it. (And another terminal window to type 'grep' into if I forget which file something is in)
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: oolite cockpit/increasing the viewing angle

Post by Diziet Sma »

G'day, Day! Welcome aboard.. 8)

Not a member of the dev team, but for my modest needs, I use Smartgit (or sometimes just git in a terminal), Geany as my editor, and a terminal window for make, etc..

Just go with whatever IDE you're comfortable/familiar with, would be my suggestion.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
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: oolite cockpit/increasing the viewing angle

Post by Day »

Hi and thanks, cim and Diziet Sma :-)

Ok, I'll take the easier path for me, it should be Eclipse now.
Post Reply