Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Bixel on July 12, 2009, 01:01:45 am

Title: HUD Ideas
Post by: Bixel on July 12, 2009, 01:01:45 am
(http://img9.imageshack.us/img9/4842/hudz.jpg)

a crappy cockpit I made in about 30 min..  the idea was to make as much viewing space as possible, so...

453 Vertices
636 Faces

How does the text work? is it renderable as a 3d plane or is it a camera fixture? I don't know how the textures that are giving game data relate to the 3D Cockpit.
Title: Re: HUD Ideas
Post by: Scooby_Doo on July 12, 2009, 01:18:51 am
Real time huds aren't implemented just yet.  Nuke's got some hacks to help though, I think.

Also you could use the hud table to move the things around so they kinda look like their in the right place.
Title: Re: HUD Ideas
Post by: Goober5000 on July 13, 2009, 09:37:12 pm
Excellent work, Bixel.  Unfortunately, the HUD is rather hard-coded and not very amenable to moving around or rendering to texture.
Title: Re: HUD Ideas
Post by: Galemp on July 13, 2009, 11:36:43 pm
:wtf: Doesn't HUD stand for 'heads-up display'? As in, projected onto something, and NOT a bunch of little screens hanging around your peripheral vision?
Title: Re: HUD Ideas
Post by: Scooby_Doo on July 13, 2009, 11:53:41 pm
Well all those little screens help keep your head up so I think that kinda counts LOL  :lol:
Title: Re: HUD Ideas
Post by: sigtau on July 14, 2009, 12:26:11 am
We could call this the midpoint between cockpit view and HUD view, you know.
Title: Re: HUD Ideas
Post by: Bixel on July 14, 2009, 12:39:32 am
I guess calling this a HUD was the wrong approach. It really is a bridge view, similar to a cockpit but probably better suited for frigates and larger vessels.
Title: Re: HUD Ideas
Post by: Nuke on July 14, 2009, 02:50:24 am
the center is a hud, if the other screens have multiple functions they are mfds, otherwise they are displays/panels/gauges/whatever. my cockpit concept is leaning to a few mfds on the panel a hud and possibly a few stand alone gauges. render to texture is not that difficult to script once you get into it, the complicated part is getting to the textures in the cockpit model. i get around this using the old skool show ship method, simply replacing special ship textures. im not sure if theres a way to do it using the separate cockpit models.

the other major problem is that i cant render existing gauges in the game to textures. so every gauge that goes into one of my scripted cockpits must be designed in scripting. there are few exceptions though. for example i can draw targeting brackets thanks to a function aardwolf implemented. bracketing subsystems can probibly also be done with a few more lines of lua. take it a step further and you could probibly script multi-targeting. a lead indicator, possibly better than the default one can be made with about a dozen lines of code. to break it down, il just post an image:
(http://i213.photobucket.com/albums/cc103/Emperor_of_Nihil/hud.jpg)
Title: Re: HUD Ideas
Post by: Galemp on July 14, 2009, 02:53:28 am
You know, I can see this working for the 3D Mission-background scripted mainhall...
Title: Re: HUD Ideas
Post by: Bixel on July 14, 2009, 06:52:35 pm
Yeh absolutely, Nuke, maybe the best thing to do is to start customizing the HUD swapping out the textures with your own, once you are satisfied of their design and location - to start worrying next about the 3d aspect of the bridge/cockpit. It could be a lot easy to go with that approach rather than modeling something 1st - cause in the end you may have to make drastic changes to the model.
Title: Re: HUD Ideas
Post by: sigtau on July 14, 2009, 08:00:00 pm
Maybe they don't even have to *be* 3D... they can just be custom hud gauges put into the VP files.
Title: Re: HUD Ideas
Post by: Nuke on July 14, 2009, 09:00:25 pm
any gauge done in scripting can also be rendered to texture for display on screens and huds. problem with huds is that any gauge that requires vectors to be projected onto (targeting brackets, lead indicators, direction indicators, ect) will need to put that vector through some transforms to make it match up on the hud. fortunately there arent that many of them. this is something i plan to eventually do with the cockpit demo, that is once i get the damn cockpits.tbl parser working.
Title: Re: HUD Ideas
Post by: ssmit132 on July 15, 2009, 07:33:08 am
(http://img9.imageshack.us/img9/4842/hudz.jpg)
That actually might work well for cockpits like the one in the Myrmidon.
Title: Re: HUD Ideas
Post by: portej05 on July 15, 2009, 07:46:25 am
any gauge done in scripting can also be rendered to texture for display on screens and huds.

Did not know that :P How do you do it?
Title: Re: HUD Ideas
Post by: Nuke on July 16, 2009, 12:30:03 am
tex = gr.createTexture(256,256,TEXTURE_DYNAMIC)
gr.CurrentRenderTarget  = tex
--draw stuff
gr.setTarget()

then use texture replacement to swap a ships textures or you can draw it to something. also you can call also call renderFrame() while rendering to a texture to create a camera view.

see the old cockpit demo
http://www.game-warden.com/nukemod-cos/downloads/cockpitdemo2.7z

or wait for the next version, it will be modder friendly, having a table much like the ones theyre familiar with and you can add new cockpits and other features to ships without having to even touch the script. it also supports other things, like player operated turrets, guided drones, cockpit animation, and camera display features. id like to improve mfds, right now you can cycle through cameras with the number keys. id like to improve on this, you would have a key to toggle between mfds, and then use the number keys to change display specific settings. right now the number of useful displays is kinda slim. i might try to recreate some of the existing gauges to give it something you can play with. id like to also implement multi targeting, and a 3d heads up display, which have ideas on how to make work, but havent coded anything yet.
Title: Re: HUD Ideas
Post by: Getter Robo G on July 16, 2009, 09:23:46 pm
How about doing as much detail or recreation of status screens and controls as you want as visual candy on the cockpit interior, BUT for now just state that all actual HUD displays are static virtual projections onto the inside of the pilot's helmet???
Title: Re: HUD Ideas
Post by: Nuke on July 16, 2009, 11:19:32 pm
thats cute, BUT TS WRONG!
i mean i ike the idea of an hmd helmet. this is atualy a key feature to a lot of current generation fighterplanes. but since freespace has a retro korean war era air combat feel to it, such a gizmo is completely bs.

im sure theres a way to do this. if the hud is square to and centered in the view frustum then its not all that difficult. mark corners of the hud polygon and project them to the screen with :getScreencoords() this defines a portion of the screen where the hud is located. you draw any gauges you want on the simulated hud to that section. convert the coords while the target is still the screen, then set target to the hud texture and do the rendering. thats plan a.

plan b makes use of gr.drawPolygon() and a camera. i create a camera as arount the place where the players view center is. i set its fov and orientation so that the polygon exists squarely and snugly in its frustum. set the camera and then set the target to the texture  you will draw to the polygon and render the gauges, they should lign up properly.

the kicker is that trackir users will need to keep their head perfectly centered if they want the hud to be useful. sorta the same way it works in orbiter and other flight simulators. frankly i dont mind, it will still be awesome.