Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Iluvathar on June 03, 2003, 04:17:15 am

Title: 1st p. view with cockpit?
Post by: Iluvathar on June 03, 2003, 04:17:15 am
Is anyone interested in creating support for 1st person view cockpits in ships?

(Seems not to be pain in the ass to code, and could add a bit of good realistic feeling to flight experience like in wing commander (oh i loved that game! ))

Feel free to contact me via e-mail @ [email protected]
Title: 1st p. view with cockpit?
Post by: Petrarch of the VBB on June 03, 2003, 04:55:24 am
IIRC this has been discussed before, and most people are against the idea.

I, however, am not, and would quite like to see this feature.:yes:
Title: 1st p. view with cockpit?
Post by: RandomTiger on June 03, 2003, 07:23:14 am
Theres load of problems with doing this but it just might work if you do it like this.

Render cockpit onto screen and into stencil buffer.
Clear z buffer and render freespace as normal (without HUD I guess) using the stencil buffer as a mask.

I think anyway.
Title: 1st p. view with cockpit?
Post by: TrashMan on June 03, 2003, 08:32:14 am
I know Iluvathar personally, and he's a damn good programmer!

As I recall he said SUPPRT for cockpits, for the cockpits themselvs would be made by modelers.
A cockpit could be just another entry in the ships.tbl (like the one that asks for shockwave or explosions), thus making it easy to enable/disable...:D
Title: 1st p. view with cockpit?
Post by: Petrarch of the VBB on June 03, 2003, 09:09:02 am
So the cockpits would actually be models (ala Starlancer) rather than just images (ala X-Wing)?
Title: 1st p. view with cockpit?
Post by: Tiara on June 03, 2003, 09:57:58 am
I'd certainly like it if it were easily enabled/disabled. :nod::yes: If I'd be forced to use the cockpit then I wouldn't use the cockpit addition :p
Title: 1st p. view with cockpit?
Post by: Alan Bolte on June 03, 2003, 10:37:41 am
I know SWmod would probably like it, as there are a slew of models waiting to be converted that have amazing model-based cockpits. I don't think there'd be a lot of support for image-based cockpits, though. Those just kinda look bad.
One another note, in XWA, which uses model-based cockpits on every craft, there is a simple toggle for the display bound to the [.] key. Just thought I'd mention.
Title: 1st p. view with cockpit?
Post by: Hudzy on June 03, 2003, 11:01:08 am
Quote
Originally posted by Tiara
I'd certainly like it if it were easily enabled/disabled.


Agreed. :nod:
Title: 1st p. view with cockpit?
Post by: Nico on June 03, 2003, 11:36:44 am
Quote
Originally posted by Petrarch of the VBB
So the cockpits would actually be models (ala Starlancer) rather than just images (ala X-Wing)?


of course :p
images suck, and are much more difficult to do anyway.
Title: 1st p. view with cockpit?
Post by: Petrarch of the VBB on June 03, 2003, 11:47:44 am
This will certainly be interesting.

I've just had a thought, though, would the cockpits be part of the ship model, or a separate model, that just sits infront of the player?
Title: 1st p. view with cockpit?
Post by: Nico on June 03, 2003, 12:22:11 pm
separate model
Title: 1st p. view with cockpit?
Post by: Petrarch of the VBB on June 03, 2003, 12:26:17 pm
Ahh, good. It would allow for more detail, after all.

But will they have fully functional gauges and whatnot?
Title: 1st p. view with cockpit?
Post by: IceFire on June 03, 2003, 12:27:07 pm
Yes please...separate model.  That way...if you had two ships that potentially had the same cockpit (ala TBP's Aurora variants, and Badger StarFury) you can reference a single file.  Keeps the sizes down.
Title: 1st p. view with cockpit?
Post by: Nico on June 03, 2003, 01:04:30 pm
Quote
Originally posted by Petrarch of the VBB
Ahh, good. It would allow for more detail, after all.

But will they have fully functional gauges and whatnot?


obviously not, unless there's some way to use the HUD anis as maps for the cockpit...
Title: 1st p. view with cockpit?
Post by: phreak on June 03, 2003, 01:20:21 pm
i was thinking that venom.  it would be neat if one can specify where the hud gauges go on a hud.. too bad it would require a rewrite of the hud code.
Title: 1st p. view with cockpit?
Post by: Petrarch of the VBB on June 03, 2003, 01:25:38 pm
But could the hud code be reworked, so that it is defined in a tbl, rather than being hard-coded?
Title: 1st p. view with cockpit?
Post by: phreak on June 03, 2003, 01:29:04 pm
alot of the hud code assumes things like position and size.  i'll have to take a look, but its 3.7 or 3.8 stuff atm
Title: 1st p. view with cockpit?
Post by: Petrarch of the VBB on June 03, 2003, 01:37:39 pm
Thank you, good sir.:D
Title: ...
Post by: Iluvathar on June 03, 2003, 02:11:26 pm
Well, I was thinking it would be a model and would be rendered conditionally. Just another camera so you folks that don't want it, just don't use it. As simple as it can be.

Well, anther thing is that models would be rendered just on the machinne using it. It would be rendered only to a player, so it wouldn't just in front of a ship model. (other players would be shocked:-))

Note: it won't be easy to implement that like implementing image cocks (u perverts it's a short word for cockpits.:-)), but it would offer many many animation possibilities.

I would like to point that TrashMan is a bit overreacting when describing me as a programmer. I'm probably good, but I'm far from "damn good" ( John Carmack is a damn good prog.- not me). Well, I know some DX OGL and cpp etc. so I can do stuff.

I would like NOone expects me to do all the work myself and to be active/available 50hrs a day. I have a job, colledge, and I'm working on a BIG VR engine project (now TrashMan would be confused:-) ... yeah yeah,... it was a secret proj. until now - lol) so I just don't have full-time available.

I appreciate your patience in reading this, but it was needed so u people can understand the topic:-).
Call it disclaimer if you want.

Stay well and healthy
Title: 1st p. view with cockpit?
Post by: Nico on June 03, 2003, 02:31:41 pm
VR engine? VR= virtual reality?
Title: 1st p. view with cockpit?
Post by: Unknown Target on June 03, 2003, 02:35:36 pm
I'm very interested.
Would it be possible to make animations for the cockpit?
Title: ...
Post by: Iluvathar on June 03, 2003, 02:40:36 pm
Yeap - VR means [V]irtual [R]eality

It's not quite VR u maybe think. It's just a high-resolution 3D engine intended to be used in arhitecture & technical construction. It's different from game engines because it offers realistic materials (glass, wood, cloth etc) in mean of realistic world interaction (i.e. radiosity light) and most important -  realistic object physics.

It's a bit hungry for system resources right now (on my machine it would run in only 6fps- but I never run it in full size.. just portions - kinda demos).

Well in the meani...

U got the point.. :-)
Title: 1st p. view with cockpit?
Post by: Unknown Target on June 03, 2003, 02:44:03 pm
So, in the tables, would you have a line that read something like:

+Cockpit Model: ____.pof???
Title: ...
Post by: Iluvathar on June 03, 2003, 03:08:17 pm
yes... animations are needed. Just imagine all that leds and alive info on control panesl.... eheheh
Title: 1st p. view with cockpit?
Post by: Nico on June 03, 2003, 03:16:52 pm
just imagine the work to do such a model :p
Title: ...
Post by: Iluvathar on June 03, 2003, 03:26:18 pm
and fs2 was made with no work invested at all???
well.. I think it's worth... sometimes.
how much work - that much final pleasure and product quality..
Title: 1st p. view with cockpit?
Post by: Flaser on June 03, 2003, 07:34:46 pm
Actually the HUD is projected onto the pilot's helmet visor - ero it would be nice to just have the hud as usual - but have a button assigned to switch it off (it's already done in 3.6 I guess) - pluss a model to go with the ship.
All the displays in the model could be derived from the same data what the hud uses - but doesn't have to be the hud itself.
With ani-texturing supported I guess we could already make a cockpit, however the trick is using them with the data gained from the HUD.
Moreover most panels would have to be illuminated one way or another.
Title: 1st p. view with cockpit?
Post by: Nico on June 04, 2003, 01:59:22 am
Quote
Originally posted by Flaser
Actually the HUD is projected onto the pilot's helmet visor -


no, no nooooooo :p
watch the FS1 intro, or even watch the personna anis during comms.
1) not enough room on those (anyway) crappy designed helmets
2) you can see fairly well the HUD in the cockpit, and it's your normal todays-like head up display :)
thinking about it, would be cool to have that, that would really improve the realism, imagine, dunno, playing fs2 with the falcon4 cockpit ( her, dunno if it's 3d, make it the EF2000 cockpit, with that wide angle view, was neat ), that would greatly improve the atmosphere of the game :)

mix this with a padlock view, and you have a winner :)
Title: Yo
Post by: TrashMan on June 04, 2003, 04:23:07 am
I'm all for cockpits....
It would make a hi-tech fighter look and feel hi-tech(If you make a hi-tech cockpit that is...:D )....

Iluvathar, you didn't tell me about that VR engine...
What about the Clodia2 engine? (Clodia 1 was excellent, with hi-res textures and phiscs and all, but poorly tuned..on my machine 12-18 fps!!)...
Or do you stll plan to make that sci-fi FPS... I still have the sketches, and you still have that friend in CroTeam (creators of Serious Sam);7
Title: 1st p. view with cockpit?
Post by: mikhael on June 04, 2003, 08:16:24 am
Quote
Originally posted by Venom
mix this with a padlock view, and you have a winner :)


Now there's an idea that could be a winner. No space sim has ever had a padlock view that I know of.
Title: 1st p. view with cockpit?
Post by: phreak on June 04, 2003, 09:33:01 am
its not on the pilot's visor

(http://www.descent-freespace.com/goodies/gallery/cockpit/cok19.jpg)
Title: 1st p. view with cockpit?
Post by: Hudzy on June 04, 2003, 10:43:31 am
Wouldn't it be good if we could look around at all that stuff with a hat switch or something. Yeh, I know it's not gonna happen but still.
Title: 1st p. view with cockpit?
Post by: Petrarch of the VBB on June 04, 2003, 10:45:18 am
Maybe in FS2 it WAS on the pilots visor, what with technology being upgraded, and all.

Those images of a traditional hud are all from FS1, after all.
Title: 1st p. view with cockpit?
Post by: Unknown Target on June 04, 2003, 11:06:31 am
It's not on the visor, it's just that [V] went arcade (no offense, they did it well), and made the HUD all you could see.


Personally, I'd prefer a HUD similar to that seen in Macross: Do You Remembe Love?, where the HUD wraps around the whole cockpit, bubble-fashion.
Title: 1st p. view with cockpit?
Post by: Nico on June 04, 2003, 11:11:09 am
Quote
Originally posted by Hudzy
Wouldn't it be good if we could look around at all that stuff with a hat switch or something. Yeh, I know it's not gonna happen but still.


:D

you can already do that, even w/o the SCP. yes, in cockpit view ( altho the HUD disappears as soon as you turn your head ). I think it's the 0 or the . from the numpad that allows for that.
Title: 1st p. view with cockpit?
Post by: Flaser on June 04, 2003, 11:26:56 am
Actually it was based on a comment from a friend of mine - he could only purchase a pirate version of FS2thoug, so no movies, no voiceove - he lost half of the fun...I wish there was another way, but hey don't due me I got it all legal and ect!
He said that the pilot puches the visor up when looking around that's the reason why you don't see the hud...
Anyway was that screenshot from Silent Threat  (I never got that one) or the original FS-intro?
Title: 1st p. view with cockpit?
Post by: Nico on June 04, 2003, 11:29:17 am
neither, that's a shot from the descent don'trememberwhat website, lots of renders of models there ( you have a whole page for the cockpit ).
but you get to see the cockpit quite well in the FS1 intro indeed.
There's no cutscenes in Silent Threat if I remember right ( well, save for the secret folder ones, which is the most interesting stuff in the CD :p ).
Title: 1st p. view with cockpit?
Post by: Flaser on June 04, 2003, 12:09:55 pm
Yeah, beside the pilot would probably have throtle control at his left hand.
Title: ...
Post by: Iluvathar on June 04, 2003, 01:12:59 pm
niiiiiiice......

well. that's what I tought. It should be possible to move with hat. it's the easiest thing to implement. In fact, all this stuff is just messing with camera and controls. Adding support for hat control is not such a problem.

To answer trash-one: clodia is DEAD in the form u knew it. lol:-)
Clodia 2 is that VR engine, so now u're happy.

Well clodia ran slow because it used multipass terrain shadowing, bump mapping, antisotrop filtering and small textures of 2048*2048 :-))))))) lol

Guess no comp would run it faster hehehe. SG maybe?!

ghhhhh it's 8pm and I'm tired of keyboard...   896 lines o cpp code today . :-) I'm proud:-) although it was just the grunt work:-)

gonna sleep now..............
Title: 1st p. view with cockpit?
Post by: Hudzy on June 04, 2003, 02:14:22 pm
Quote
Originally posted by Venom


:D

you can already do that, even w/o the SCP. yes, in cockpit view ( altho the HUD disappears as soon as you turn your head ). I think it's the 0 or the . from the numpad that allows for that.


:D I meant in the way flightsims work, where you look at all the lights and buttons and stuff.
Title: 1st p. view with cockpit?
Post by: Nico on June 04, 2003, 02:18:03 pm
well, would be cool to have the padlock already ( you kow, you lock a ship, and the pilot turns the head to follow this fighter, so your target always stay in the middle of the screen ), now that would be great.
Title: 1st p. view with cockpit?
Post by: bottomfan on June 04, 2003, 02:21:05 pm
That would be really cool!
Imagine to have an option where the view always follows the target( found in all real simulators)!!!!!
Title: ...
Post by: Iluvathar on June 04, 2003, 03:39:12 pm
that kinda view would be somewhat difficult to create. it requires rewriting the complete camera code because of two-var camera need. U should create straight-forward camera target for world (space) interaction (collision detection) and one just for the movable view.

saw that in independence war code. it's just too complicated.
it's easier and probably would suffice just to use some new animated mesh format and process it on it's own.
Serious Sam (I'm familiar with some of the code) uses similar system.

or Would it just be enough to use standard fs format and forget about that 'helmet' system.?
Title: 1st p. view with cockpit?
Post by: TrashMan on June 05, 2003, 03:27:43 am
Iluvathar...you telling me that you plan to use Clodai 2 engine for that FPS?
Which reminds me...have the sketches...will drop by your place and show them to you!:D
Title: Re: ...
Post by: Nico on June 05, 2003, 04:03:10 am
Quote
Originally posted by Iluvathar
that kinda view would be somewhat difficult to create. it requires rewriting the complete camera code because of two-var camera need. U should create straight-forward camera target for world (space) interaction (collision detection) and one just for the movable view.

saw that in independence war code. it's just too complicated.
it's easier and probably would suffice just to use some new animated mesh format and process it on it's own.
Serious Sam (I'm familiar with some of the code) uses similar system.

or Would it just be enough to use standard fs format and forget about that 'helmet' system.?


I don't understand... since there's already a "cockpit" view that you can control, wouldn't it be possible to link that one to the target, and let the controls handle the ship?

and since it's cool, I think no, it wouldn't be enough. or we can just trash the SCP coz after all FS2 was way enough.
bah.
Title: 1st p. view with cockpit?
Post by: TrashMan on June 05, 2003, 10:24:41 am
How about the cockpit in SW-Alliance?
It could be done like that....

Anyway, we all agree that the biggest problems would be the cockpit guages and the free look..
Title: 1st p. view with cockpit?
Post by: mikhael on June 05, 2003, 10:49:31 am
I'm obviously not understanding your objections to why the padlock view wouldn't work, Iluvathar. Could you explain in clearer detail?
Title: ...
Post by: Iluvathar on June 05, 2003, 04:21:57 pm
well... it's just too ccomplicated.
Let's try the simple way:
I was trying to say that we can always add static cockpit view, because fs is made that way. There are no smooth sliding camera.
The code internally mostly uses ROTATION MATRICES so there a problem shows up. The problem is called GIMBLE LOCK. That's why there are just static cameras (180deg max). Creating padlock view or want hat-controled in-cockpit camera would require using of QUATERNIONS. Quaternions would make possible cockpits like those in IL2 sturmovik and Falcon 4.0.

Well... that's it. Just know that creating such a cockpit u want is really a BIG BIG job.

Sorry.

I must point I'm not sure completely about the particular problem in detail, but I'm sure it doesn't work because I've tried.:-(

uhhh...
Title: 1st p. view with cockpit?
Post by: CP5670 on June 05, 2003, 10:26:59 pm
you mean the hamilton complex-type quaternions? :wtf: I didn't even know those are used anywhere... :p
Title: 1st p. view with cockpit?
Post by: phreak on June 05, 2003, 10:42:11 pm
i did a search of gametutorials.com and this came up

Quote

Around the eighteenth century, a man named W. R. Hamilton discovered quaternions and that
 they could be used as a 4D extension to complex numbers. Following this discovery, it was
 proven that quaternions could also be used for rotations and orientations in three dimensions.
 It wasn't until 1985 that quaternions were used in computer graphics.

 In essence, quaternions are used for rotations.  One of the most popular applications for
 quaternions is in character bone/skeletal animation.  Think of a quaternion as a 4D vector:

 q = (x, y, z, w)    or    q = w + xi + yj + zk   i,j and k being imaginary numbers
 
 Another representation of a quaternion is:
 
 q = [w, v]
 
 "v" represents a vector (x, y, z), and "w" is a scalar.  Just when you think you are
 starting to understand what a quaternion is, a stumbling block is placed in front of you.
 That is, you can't think of the vector (x, y, z) as a 3 dimensional vector, but a vector
 in 4 dimensions.  You can't visualize this because we can't really comprehend a fourth
 dimension.  This is one of those things that you need to just accept, and move on (while  
 playing Quake 3 and barreling your rail gun into your opponent's chest, which if it happens
 to be the Angelina Jolie version of Lara Croft, a big one at that).

 When talking about quaternions, I will be using the first representation.  Before I go
 on to more of the math, I will address the reasons why we use quaternions.
 
 Before quaternions, Euler Angles were primarily what was used to represent a rotation.
 Euler angles are defined as an angle for each axis like so:

 (x, y, z) or (yaw, pitch, roll) or (heading, pitch, roll)

 These are the same, just different representations.  "Heading" is sometimes preferred
 to "yaw" because of the Y abbreviation which confuses yaw with the y-axis.  Each angle
 has it's own rotational matrix.  That means, if each axis rotation is written with matrices
 B, C, and D, then the general matrix A can be defined as:

 A = BCD

 with B C D described as:

 B = [  cos(yaw) sin(yaw) 0 ]    C = [ 1       0            0 ]  D = [  cos(roll) sin(roll) 0 ]
      [ -sin(yaw) cos(yaw) 0 ]        [ 0  cos(pitch) sin(pitch) ]      [ -sin(roll) cos(roll) 0 ]
      [  0        0        1 ]        [ 0 -sin(pitch) cos(pitch) ]      [  0         0         1 ]

 Keep in mind that the order that the matrices are multiplied together is important.

 The famous problem with euler angles is the potential for gimbal lock.  This happens
 when a rotation "overrides" another rotation, which limits your degrees of freedom.
 Quaternions solve this problem, as well as allow a smooth rotation when interpolating
 between 2 rotations.  Though axis angle rotation may not suffer from gimbal lock, when
 interpolated, they can cause unnatural abrupt movements between the rotations.  One of the
 simplest form of quaternion interpolation is called:

 SLERP (Spherical Linear Interpolation - Strange acronym isn't it?)

 When would we need to interpolate between rotations?  Like I mentioned above, the perfect
 example is when doing bone animation.  Each key frame is usually stored with a rotation
 matrix, which can be converted to a quaternion.  If you have the current frame and the
 next frame's rotation stored in a quaternion, the interpolation can easily be performed,
 which will result in a new interpolated quaternion, depending on time t of course.  Check
 out the MD3 Animation tutorial on our site to see an example of SLERP in action.

 There are many aspects that deal with quaternions, but we will only focus on
 converting an angle axis rotation to a quaternion, then converting a quaternion to
 a rotational matrix to be applied to the current model view matrix.


i thought there was already some of this quater-whatever in the vector math libraries in the fs2 source

edit: CP did you get that pm?
Title: 1st p. view with cockpit?
Post by: Sesquipedalian on June 05, 2003, 11:23:17 pm
If there is, cool.  But in the ship rotation code and in FRED2's background editor, it uses Euler angles.
Title: 1st p. view with cockpit?
Post by: mikhael on June 06, 2003, 10:08:58 am
First, gimbal lock is when you get two out of your three axes lined up due to over-rotation on one of them. You see this a lot in 3d animation (during bone work, for example) and modelling during object-centered camera rotations. It doesn't really apply here.  That's a red herring. If you were really concerned with it, automatic unlocking of the pad during over-rotation conditions (people just can't turn their heads too far) and returning to the normal forward view would solve the problem.

As for the necessity to rewrite the engine using quaternions--um no. It would certainly make things easier for some operations, absolutely. But they are NOT required.

Seriously, implementing padlock views would require some work, but it would not require a complete overhaul of the engine codebase. But hey, what do I know?
Title: Re: ...
Post by: Nico on June 06, 2003, 11:08:45 am
Quote
Originally posted by Iluvathar
hat-controled in-cockpit camera


didn't I tell you a couple times already that this is already in FS2?
I love when people blatantly ignore me :p
Title: 1st p. view with cockpit?
Post by: CP5670 on June 06, 2003, 01:41:16 pm
Quote
edit: CP did you get that pm?


Did you send me a pm? It sometimes fails to notify me when I have recieved one; let me go check manually...
Title: 1st p. view with cockpit?
Post by: phreak on June 07, 2003, 04:35:09 pm
just incase you didn't (my pm's have a way with dying sometimes)

check this bug, i have a proposed fix: http://fs2source.warpcore.org/bugzilla/show_bug.cgi?id=81
Title: 1st p. view with cockpit?
Post by: aldo_14 on June 08, 2003, 11:00:16 am
The HUD code treats the screen element (radar, et al) as if they were 3D planes, doesn't it?  Couldn't you adapt it (specifically the code for loading the LOD1 model into the bottom LHS) to display a large cockpit pof model in a similar way?  Sure, you'd only see it looking straight forward, but it could be start.... personally, I'd rather keep the gauges et al shown as if they were projected on the pilots view - as, if you treat them as part of the cockpit you either have to chop off half the screen, or show very little cockpit (only the small bars on the glass display thing).

Plus, if you encoded the cockpit in a similar vein to the HUD guages, couldn't you turn it off in a similar way?
Title: ... (RE:mikhael & venom)
Post by: Iluvathar on June 09, 2003, 02:08:03 am
mikhael: well.. u're maybe right..
venom: sorry, didn't see tha post. I know now:-)
Title: 1st p. view with cockpit?
Post by: Nico on June 09, 2003, 06:29:19 am
Quote
Originally posted by aldo_14
The HUD code treats the screen element (radar, et al) as if they were 3D planes, doesn't it?  Couldn't you adapt it (specifically the code for loading the LOD1 model into the bottom LHS) to display a large cockpit pof model in a similar way?  Sure, you'd only see it looking straight forward, but it could be start.... personally, I'd rather keep the gauges et al shown as if they were projected on the pilots view - as, if you treat them as part of the cockpit you either have to chop off half the screen, or show very little cockpit (only the small bars on the glass display thing).

Plus, if you encoded the cockpit in a similar vein to the HUD guages, couldn't you turn it off in a similar way?


well, something like in wing co prophecy would be cool for a start ( there's just a model, it has no gauges or anything, it's just for the "feeling" ).