Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Angs on November 07, 2011, 02:22:33 am

Title: My take on the 2D radar
Post by: Angs on November 07, 2011, 02:22:33 am
Hello everyone, first time posting here. First, I want to thank the whole community for being awesome.

I recently started replaying the fs2 retail campaign and wasn't pleased with the radar(s), so I decided to dive into the source and make my own. Without further ado, here's what I came up with: The rear mirror radar:

(http://img269.imageshack.us/img269/7569/screen0016.jpg) (http://imageshack.us/photo/my-images/269/screen0016.jpg/)

It has the same projection (azimuthal equidistant) as the original 2D radar, but without vertical flattening (for extra math pureness). The rear mirror is the 90 degree cone behind the player. The forward radar has a projection of a cube with the player centered in it for visualization.

If someone is interested in it, I can give the code/build/graphics. Any comments and/or criticism?
Title: Re: My take on the 2D radar
Post by: The E on November 07, 2011, 02:27:12 am
Code would be appreciated. I like the idea, and it's an option that is missing at the moment, so I definitely would like to check it out.
Title: Re: My take on the 2D radar
Post by: Angs on November 07, 2011, 03:55:55 am
Here is a patch and a .vp containing the bitmaps. There are some changes to the -orbradar command line switch for testing purposes: it is renamed to -radar and it takes a int parameter: 0 is standard 2D radar, 1 is orb radar and 2 is the new one.

There are two new additional files in the patch, "radar/radarrm.*", which is not reflected in the project files or makefiles, so they probably have to be added manually.

Edit: changed attached awful code to rewrited more modular one

[attachment deleted by a basterd]
Title: Re: My take on the 2D radar
Post by: Nuke on November 07, 2011, 04:22:11 am
not bad. i rather like this projection.

i should point out that radars are fairly easy to script. i dont see the point of hard coding every potential radar into the game, which it would be far more sane to allow scripted hud gauges (moddable through in hud_gauges.tbl, but defined in lua). of course its easier to get scripters to write c than it is to get modders to write script. screw it, enjoy your feature creep. :P
Title: Re: My take on the 2D radar
Post by: Angs on November 07, 2011, 05:06:35 am
Yeah, I agree that it would be best if it would be possible to define the radar without a recompilation of the entire code, but is there a hud_gauges.tbl for the default retail gauges? The wiki article is a little bit vague on the subject and MediaVP doesn't seem to have one. I just put the code in the first place I could think of as I was in a hurry to play the retail game. With a C++ subclass I could reuse almost all code from the standard hud. :)
Title: Re: My take on the 2D radar
Post by: Dragon on November 07, 2011, 08:13:49 am
Looks good, I like it.
Title: Re: My take on the 2D radar
Post by: Rodo on November 07, 2011, 08:21:06 am
cool radar, I'm getting it if that's ok with you.
Title: Re: My take on the 2D radar
Post by: chief1983 on November 07, 2011, 10:56:14 am
An old fork of the SCP codebase, Imperial Alliance, once had a split radar just like like this, except it was symettrical, and they had moved it to the upper left and right corners of the screen, similar to the X-wing games.  Is this dynamic enough that with the right HUD config and bitmap files, that effect could still be achieved?
Title: Re: My take on the 2D radar
Post by: z64555 on November 08, 2011, 09:02:25 am
Do you know if you can add an option that makes the forward radar an N-gon instead of an ellipse? I know of at least 2 projects that have octogonal radar (FringeSpace and maybe Diaspora)

I have an idea of how to do it, but haven't gotten around to playing with the code. :(

Title: Re: My take on the 2D radar
Post by: Angs on November 08, 2011, 10:02:37 am
cool radar, I'm getting it if that's ok with you.

I don't mind at all.

An old fork of the SCP codebase, Imperial Alliance, once had a split radar just like like this, except it was symettrical, and they had moved it to the upper left and right corners of the screen, similar to the X-wing games.  Is this dynamic enough that with the right HUD config and bitmap files, that effect could still be achieved?

I twiddled "a little bit" with the code, and came up with a nice way to do this. I added a few hudgauges.tbl options to the standard radar for cutoff angle and whether it points forward or backward. The just load as many radars as you want (well, I couldn't image you'd want more than two but..)
Now I can load the radar presented in the first photo without any command line funnyness with
Code: [Select]
#Gauge Config
$Base: (1024, 768)
$Gauges:
+Radar:
Position: (411, 560)
Axes: (193, 193)
Origin: (100.0, 100.0)
Filename: 2_radar2
Crosshair Filename: 2_target1
Angle: 270
Rear: false
+Radar:
Position: (411, 560)
Axes: (64, 64)
Origin: (215.4, 36.033)
Filename: 2_radar2
Crosshair Filename: 2_target1
Rear: true
Angle: 90
$End Gauges
#End
or
Code: [Select]
#Gauge Config
$Base: (1024, 768)
$Gauges:
+Radar:
Position: (411, 590)
Axes: (187, 155)
Origin: (104.0, 85.0)
Filename: 2_radar1
Angle: 180
+Radar:
Position: (10, 10)
Axes: (187, 155)
Origin: (104.0, 85.0)
Filename: 2_radar1
Rear: true
Angle: 180
$End Gauges
#End
for this one:
(http://img856.imageshack.us/img856/8571/screen0024.jpg) (http://imageshack.us/photo/my-images/856/screen0024.jpg/)
Do you know if you can add an option that makes the forward radar an N-gon instead of an ellipse? I know of at least 2 projects that have octogonal radar (FringeSpace and maybe Diaspora)

I have an idea of how to do it, but haven't gotten around to playing with the code. :(

How would it work? Are the corners cut off or is the circle projected onto the n-gon, so that the distance to blip to real turning distance wouldn't be equal always?

Anyways, here (http://users.utu.fi/aovtam/fs/) are resources for the radar(s) if someone wants them.

[attachment deleted by a basterd]
Title: Re: My take on the 2D radar
Post by: chief1983 on November 08, 2011, 11:22:36 am
Awesome, looks good functionally.
Title: Re: My take on the 2D radar
Post by: JGZinv on November 08, 2011, 01:24:12 pm
Angs, this is what we're trying to do.  I've got this as a PSD if you want a
better look at it.


(http://files.fringespace.org/jgz/HLP/GSHUDPSD.gif)
Title: Re: My take on the 2D radar
Post by: z64555 on November 08, 2011, 05:26:29 pm
Do you know if you can add an option that makes the forward radar an N-gon instead of an ellipse? I know of at least 2 projects that have octogonal radar (FringeSpace and maybe Diaspora)

I have an idea of how to do it, but haven't gotten around to playing with the code. :(

How would it work? Are the corners cut off or is the circle projected onto the n-gon, so that the distance to blip to real turning distance wouldn't be equal always?

I was originally just thinking of constraining them to fit inside the n-gon, but they would still be projected to an ellipse. JGZ's picture shows the hud gauges used for a majority of the craft in FringeSpace, but one faction has an octagon instead of an ellipse.
(http://upload.wikimedia.org/wikipedia/sl/thumb/e/e3/Space_Battle_Bora.png/325px-Space_Battle_Bora.png)
Sorry I couldn't find a bigger picture...  :nervous:

All of the faction's radars have 359 degree forward viewing cone... if that makes any sense. The inside ellipse there marks where the target "should" be on the player's screen, but that will be probably done using some texture magic. Edit: Now that I think of it, the actual radar itself may be a 180 degree viewing cone, but everything beyond 180 is constrained to the edges of its nearest projection. I'm just not sure... this is a weird radar to say the least, Lol.

I was also thinking of adding an option to the n-gon so that you could rotate where the vert's would be, so that people could get something like a heptagon with one vertix pointing up, down, left, etc... if they ever wanted to.


Shoot, I really need to find time to code more fun stuff like this.
Title: Re: My take on the 2D radar
Post by: JGZinv on November 08, 2011, 06:24:21 pm
You made a good point, sorry about forgetting the other hud style.
Title: Re: My take on the 2D radar
Post by: z64555 on November 08, 2011, 06:42:51 pm
You made a good point, sorry about forgetting the other hud style.

It happens  :P
Title: Re: My take on the 2D radar
Post by: TwentyPercentCooler on November 08, 2011, 07:16:46 pm
No welcome beam? Ah well, welcome to HLP, Angs! Is your name related to angstroms, by any chance?

Good work on the radar, I'll actually try this out. For whatever reason, I prefer the 2D radars.
Title: Re: My take on the 2D radar
Post by: Commander Zane on November 09, 2011, 10:06:05 am
You made a good point, sorry about forgetting the other hud style.

It happens  :P
It's just the Bora. :p
GalSpan all the way. ;7
Title: Re: My take on the 2D radar
Post by: z64555 on November 09, 2011, 10:48:42 am
You made a good point, sorry about forgetting the other hud style.

It happens  :P
It's just the Bora. :p
GalSpan all the way. ;7

Well there's also the 'neutral' hud seen in the Mako, but as far as the radar hud goes, it's the same.

I guess Bora just like being different than the rest of Sol space.

Title: Re: My take on the 2D radar
Post by: Angs on November 09, 2011, 12:19:58 pm

I was originally just thinking of constraining them to fit inside the n-gon, but they would still be projected to an ellipse. JGZ's picture shows the hud gauges used for a majority of the craft in FringeSpace, but one faction has an octagon instead of an ellipse.

Constraining to an ellipse is simpler than a general n-gon. Before scaling and transposing x and y offsets, draw only if abs(x)<cos(pi/8) && abs(y)<cos(pi/8) && abs(x)+abs(y)<(3-sqrt(2))*cos(pi/8).


All of the faction's radars have 359 degree forward viewing cone... if that makes any sense. The inside ellipse there marks where the target "should" be on the player's screen, but that will be probably done using some texture magic. Edit: Now that I think of it, the actual radar itself may be a 180 degree viewing cone, but everything beyond 180 is constrained to the edges of its nearest projection. I'm just not sure... this is a weird radar to say the least, Lol.

After watching a few youtube clips, I must agree that it sure is weird :)

No welcome beam? Ah well, welcome to HLP, Angs! Is your name related to angstroms, by any chance?

Good work on the radar, I'll actually try this out. For whatever reason, I prefer the 2D radars.

Thank you! And no, not related. :) (Where I come from those would be called ångströms)
Well in any case, the radar is a mapping of the 3D space to a 2D screen, it's just a matter whether it tries to look 3D. The orb radar is quite ambiguous when something is close to the borders, not to mention that there are almost always two points that are projected to the same place. This gets especially bad with radar icons.
Title: Re: My take on the 2D radar
Post by: chief1983 on November 09, 2011, 01:41:39 pm
Really, having two full circles for the radar makes the icons even more attractive to use if you ask me, they have all that radar real estate to use now :)
Title: Re: My take on the 2D radar
Post by: Nuke on November 09, 2011, 09:11:30 pm
im kinda fond of the elite style radar. gives you good at a glance ranging and linear situational awareness. but at the expense of radial awareness.
(http://i213.photobucket.com/albums/cc103/Emperor_of_Nihil/screen0048.jpg)
most radars only indicate the angular offset to targets and dont really give you an idea of the target's relative position to you. not to say other types of radars dont have their charm. a dual hemisphere radar gives you at a glance confirmation that noone is on your six. a fisheye radar simplifies the concept but is harder to read whats in front or behind, good markings are essential to help determine front from back. it does have the advantage of helping you determine the optimal turning angle. angs' radar seems to be a hybrid of fisheye and hemispherical. instead of two 180 degree or one 360 degree projection, it seems like a 270 and a 90 for the rear, and so has all the benefits of both.
Title: Re: My take on the 2D radar
Post by: z64555 on November 10, 2011, 12:41:04 pm
angs' radar seems to be a hybrid of fisheye and hemispherical. instead of two 180 degree or one 360 degree projection, it seems like a 270 and a 90 for the rear, and so has all the benefits of both.

I personally think its much better than XWA's style or TTF's style alone. A rough ranging could be added to radial radars by progessively dimming the brightness of the blips the further away the object is... which I might add to my list of "to-do's."
Title: Re: My take on the 2D radar
Post by: JGZinv on November 10, 2011, 02:46:23 pm
What about putting the rear inside of the main radar, like a cutout... circle within a circle?
Title: Re: My take on the 2D radar
Post by: jr2 on November 10, 2011, 04:32:46 pm
How about an animated, rotating radar, with the player depicted in the center and some sort of fixed lines so that the sense of orientation is not lost?  Like orb radar, but spinning between maybe 3 different axis, so that nothing escapes your view.  However, not a good idea for a quick glance to give you the position of everything out there.  Maybe make it toggleable with a key?  Or fixed like an orb radar, but occasionally shifting to cover blind spots?

Maybe I'm just crazy.  :lol:  Thoughts?
Title: Re: My take on the 2D radar
Post by: The E on November 10, 2011, 04:37:08 pm
Wait till you see the DRADIS style radar.
Title: Re: My take on the 2D radar
Post by: z64555 on November 10, 2011, 10:52:03 pm
What about putting the rear inside of the main radar, like a cutout... circle within a circle?

Overlap comes to mind, plus you'll be guaranteeing a bind spot.
How about an animated, rotating radar, with the player depicted in the center and some sort of fixed lines so that the sense of orientation is not lost?  Like orb radar, but spinning between maybe 3 different axis, so that nothing escapes your view.  However, not a good idea for a quick glance to give you the position of everything out there.  Maybe make it toggleable with a key?  Or fixed like an orb radar, but occasionally shifting to cover blind spots?

Maybe I'm just crazy.  :lol:  Thoughts?

Um... what? Can you say it with pictures, please?
Title: Re: My take on the 2D radar
Post by: JGZinv on November 10, 2011, 11:45:27 pm
Quote
Overlap comes to mind, plus you'll be guaranteeing a bind spot.

Only directly behind you, you're thinking of keeping the displayed graphic the same, and replacing the center of the radar - creating a deadzone... that's not what I mean.

You readjust the display zone so what was "in the center" is now just outside the rim of the interior circle's rim.  Then you tweak what remains of the original radar area and
adjust it to use the new outer ring's space. How can I say it...  like taking a flat 2D picture and making it fisheye through a lens.  The content is still there, just redistributed.

Frankly if you're including the rear radar circle, then your rear deadzone will be eliminated. The blind spot directly ahead of you doesn't matter because you can see that area for
most any purpose you'd use the radar for.
Title: Re: My take on the 2D radar
Post by: Angs on November 11, 2011, 04:55:58 am
Frankly if you're including the rear radar circle, then your rear deadzone will be eliminated. The blind spot directly ahead of you doesn't matter because you can see that area for
most any purpose you'd use the radar for.

This gave me a wild idea: You could just have a 270 degree rear view radar, because everything else is in view (though I'm note sure if vertical FOV covers the remaining 90 degrees.) Then perhaps every ship in view could be circled, akin to this:

(http://img83.imageshack.us/img83/8453/f18fgunf22020lz.jpg)

Another possibility for the 90 degree forward sector could be a distance radar with loss of one dimension of angular information (is DRADIS something like this?)
Title: Re: My take on the 2D radar
Post by: Nuke on November 11, 2011, 06:10:56 am
i also have a conic radar, which isnt really useful per se but i use it as part of a multi-targeting system. but im really thinking of not making the feature radar dependant so that i can lock reguardless of radar mode.
Title: Re: My take on the 2D radar
Post by: jr2 on November 11, 2011, 09:10:42 am
How about an animated, rotating radar, with the player depicted in the center and some sort of fixed lines so that the sense of orientation is not lost?  Like orb radar, but spinning between maybe 3 different axis, so that nothing escapes your view.  However, not a good idea for a quick glance to give you the position of everything out there.  Maybe make it toggleable with a key?  Or fixed like an orb radar, but occasionally shifting to cover blind spots?

Maybe I'm just crazy.  :lol:  Thoughts?

Um... what? Can you say it with pictures, please?

Well, it would be hard for me to show you an animated object with a picture.  Image the orb radar.  Now imagine that it is an actual physical ball.  Pretend you can take the ball, with the information displayed in it still active, and rotate it so that you can see it from different angles.  Now, if you want to cover all the bases, you can gently rock the ball back and forth, so that you can see, for example, if a fighter is dead ahead and would normally be masked by the player ship representation in the orb radar.  You can rotate the ball towards you (so the top is coming towards you and the bottom is going away from you) so that you can see 'over' yourself and see what's in front of you.  Then rotate back.  If you keep doing this, nothing can remain hidden.  Almost like purposefully pitching your fighter up and down to accomplish the same thing, except you don't have to move your ship, as your radar display is shifting.

Now do you see?
Title: Re: My take on the 2D radar
Post by: Nuke on November 11, 2011, 08:06:31 pm
i thought about a holographic radar, kind of a third person view. you not only can see where all the ships are in relation to you but also their orientation and perhaps velocity as well. i had intended to use this for a newtonian flight model with a logarithmic scale and your velocity would be the primary frame of reference, the idea would have been to project your trajectory and your targets trajectory so that you could better engage your target, approach planets and do orbital maneuvers. using such a radar for non-newtonian flight would be a lot simpler, and it could be linear because the distances are shorter and just use the ship as a frame of reference.  of course it might be information overload and thus be somewhat useless.
Title: Re: My take on the 2D radar
Post by: z64555 on November 14, 2011, 09:32:59 am
Quote
Overlap comes to mind, plus you'll be guaranteeing a bind spot.

You readjust the display zone so what was "in the center" is now just outside the rim of the interior circle's rim.  Then you tweak what remains of the original radar area and
adjust it to use the new outer ring's space. How can I say it...  like taking a flat 2D picture and making it fisheye through a lens.  The content is still there, just redistributed.

Ok, I see what you mean... your shifting the focus of the radar to be directly behind you instead of ahead of you.

Quote
Frankly if you're including the rear radar circle, then your rear deadzone will be eliminated. The blind spot directly ahead of you doesn't matter because you can see that area for most any purpose you'd use the radar for.

Not for the purpose of flying in nebulae, where you can't see more than 50m ahead of you. You can do as Angs suggested and highlight radar targets on the screen, but I really think some experimentation of the different ideas is needed.

Image the orb radar.

Now imagine that it is an actual physical ball.

Pretend you can take the ball, with the information displayed in it still active, and rotate it so that you can see it from different angles.

Now, if you want to cover all the bases, you can gently rock the ball back and forth, so that you can see, for example, if a fighter is dead ahead and would normally be masked by the player ship representation in the orb radar.

You can rotate the ball towards you (so the top is coming towards you and the bottom is going away from you) so that you can see 'over' yourself and see what's in front of you.  Then rotate back.



If you keep doing this, nothing can remain hidden.  Almost like purposefully pitching your fighter up and down to accomplish the same thing, except you don't have to move your ship, as your radar display is shifting.

Ok, I see what you mean there. That may be a bit more difficult than simply animating a texture, because you'll be wanting the relative xyz positions the same as you rotate the orb about, yes? You'd be wanting to make a particle (a 2D plane that always faces the player camera) for each of the radar objects and the radar orb will be a standard 3D orb.

Once the 3D orb is rendered correctly, the next step would be to make an interface to manipulate the orb... Sounds like a good project!


i thought about a holographic radar, kind of a third person view. you not only can see where all the ships are in relation to you but also their orientation and perhaps velocity as well. i had intended to use this for a newtonian flight model with a logarithmic scale and your velocity would be the primary frame of reference, the idea would have been to project your trajectory and your targets trajectory so that you could better engage your target, approach planets and do orbital maneuvers. using such a radar for non-newtonian flight would be a lot simpler, and it could be linear because the distances are shorter and just use the ship as a frame of reference.  of course it might be information overload and thus be somewhat useless.

I think that style of radar would be good for capships or stations, when the commanders need to know what's all going on. But for a fighter in the thick of it all, I think the only thing they need to know is distance and angular position. Relative velocities can be estimated by the pilot and are not that important (at least from my experiance).
Title: Re: My take on the 2D radar
Post by: Nuke on November 14, 2011, 10:39:56 am
i thought about a holographic radar, kind of a third person view. you not only can see where all the ships are in relation to you but also their orientation and perhaps velocity as well. i had intended to use this for a newtonian flight model with a logarithmic scale and your velocity would be the primary frame of reference, the idea would have been to project your trajectory and your targets trajectory so that you could better engage your target, approach planets and do orbital maneuvers. using such a radar for non-newtonian flight would be a lot simpler, and it could be linear because the distances are shorter and just use the ship as a frame of reference.  of course it might be information overload and thus be somewhat useless.

I think that style of radar would be good for capships or stations, when the commanders need to know what's all going on. But for a fighter in the thick of it all, I think the only thing they need to know is distance and angular position. Relative velocities can be estimated by the pilot and are not that important (at least from my experiance).

i considered that. in such a case it would not be so much a radar as a bit of eyecandy in the bridge model. i imagine something of a glass cube, inside of which would be floating 3d rendered icons representing the ships in the vicinity. commanders would be able to designate targets for gunners and fighter wings with some kind of point and click interface. i also envisioned an fps mode where you could walk around and interact with other bridge stations, like gunner and pilot stations, and other less interesting stuff like damage control and engineering. such a system would involve a lot of render to texture to look right. i crated a doom-ish system of 2.5d floorplans that would map to a pof cockpit model (except for an entire bridge and perhaps other areas in the ship, like fighterbays), and define where you could go. but render to texture was unstable and i still didnt have a bridge model so i never really got to hammer this idea into reality.