Author Topic: Rear and Forward 2D Radar  (Read 3978 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Rear and Forward 2D Radar
i dont work on making little pewny scripts that just do one thing, i work on epic scripts that do lots of things. and i might release it if i am ether elected world emperor (and thus have the power to send whoever complains about bugs to death camps), or finish it, whichever comes first.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Aardwolf

  • 211
  • Posts: 16,384
Re: Rear and Forward 2D Radar
well is it finished yet?

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Rear and Forward 2D Radar
no
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

  

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Rear and Forward 2D Radar
* jr2 has an idea:

slightly smaller Forward 2D radar - 3D orb radar - slightly smaller Rear 2D radar

... Yeah, I know.  :warp:

 
Re: Rear and Forward 2D Radar
Not impossible but that's a lot of redundant information and a very small space.

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Rear and Forward 2D Radar
Well, maybe a toggle switch for forward 2D / rear 2D / forward and rear 2D / 3D orb?

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Rear and Forward 2D Radar
radars are actually very easy. heres some speudocode

/psedocode/
iterate through ships
determine if you want this on the radar
determine what color you want the blip to be and set it
vector subtract your position from the target's position (make your ship 0'0'0)
determine if you still want to do this. is it in range (pos:getMagnitude() < x)?
rotate the target's position vector by your orientation matrix (player.Orientation:rotateVector(target.Position)), this line (and the one above it) puts the object in your frame of reverence
determine if you still want to render this.  is in the scan cone? etc. (do this a lot, especially before big and potentially unnecessary calculations, it will make it faster)
\pseudocode\

now you decide how you want these dots to be displayed, the math here depends on what you want done. it may just involve some simple scaling and clipping for orthographic projections, or trig functions for fish eye or hemispheric modes. but regaurdless this is where the look of the radar is defined. for example, a hemispherical radar, i used something like x,y = (pos.x/pos:getMagnitude()) * scaler, (pos.y/pos:getMagnitude()) * scaler. basic knowledge of trig and vector math comes in handy here. once you determine where you want to draw a blip, and what you want to draw (can be a pixel, a circle, but i use a small icon myself).

Well, maybe a toggle switch for forward 2D / rear 2D / forward and rear 2D / 3D orb?

how you want different radars to be selectable is entirely arbitrary, do you want every mod to have the same set of radars to choose from, or do you want it so modders can say this mod (or this ship) uses this radar (or this ship uses this other radar). while it makes sense to set it as a global flag, it seems the feature of multiple radars would have a multitude of applications that a global flag would destroy. i myself would make it a hud_gauges.tbl thing. (of course my scripted gauges have their own implementation all together with their own table).
« Last Edit: January 16, 2010, 07:12:40 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN