DepthHUD Radar - Add new beacons on the fly !

Hi !
I came across a 3D Radar a while ago, and it was lagging so much that I recoded it, but I was quickly upset because of the “un-extensibility” of the radar. So I started a new one from scratch.


SVN : 

http://depthhudradar.googlecode.com/svn/trunk/


Garrysmod.org : 

http://www.garrysmod.org/img/?t=dll&id=94767

http://depthhudradar.googlecode.com/files/depthhudradar.zip


To install in : 

garrysmod/garrysmod/addons/depthhud_radar/

So this radar is directly inspired from the Grand Theft Auto 3 (and more) radars, melted with the Metal Gear Solid “Soliton Radar”.

Video that illustrates everything that I’ve written below :
[hd]http://www.youtube.com/watch?v=PN0VTnueGx8[/hd]

DepthHUD Radar in a more advanced stage, demonstrating the Farseer features.

http://www.hurricaaanes.info/ai/depthhud_radar_show2.jpg

+Summary of features :

  • You can enable the rendering of a minimap.
  • You can disable any beacon.
  • You can change the style and position of the radar, and its size.
  • You can offset the radar world center. Usually, the radar world center is your own position, but there, you can make it look ahead of you, up or down, and even scale the resolution up and down.

I felt more comfortable with my own radar, because I convert all the positions into polar coordinates : distance, angle, isup. Using polar coordinates, I can get 3 variables that becomes easy as pie to render on screen.

The radar has its own menu so you can customize the position and style, as well as its features. You can disable/enable beacons with the menu.
Also, you can create your own beacons by dropping your script into a folder. Here’s an example I did while on the Gmod Tower server :
http://code.google.com/p/depthhudradar/source/browse/trunk/lua/depthhud_radar_beacon/gmodtower_suite.lua

This little script was enough to add a beacon on my radar with the location and number on suites (when near), and the corresponding animations for each beacon : Blue if occupied, Green if yours, Red with a bouncing signal if empty.

About performance :
If you enable either Soliton Scan or Height Map, your game will lag a bit more, but it will be barely noticeable unless you’re on flatgrass with absolutely no props on the map. Without that, it will run perfectly fine.

If you have any review, or questions, feel free to tell.
Thanks for reading !

Looks neat, I will mess around with it. Also you manage to snap one of the 1000 times I’ve been able to just walk right into Gmod Tower :smug:

Pretty good =D

fawsumsauce.

Height is laggy, but the rest is awesome!

Looks very cool :).

LOL iam in the video and i chatting XD
my name is -<W.U.W>-Venom[HUN]

Cool.

Hurricaaaane, is that you?

Yup (with 3 ‘a’)

Add a health/armor circle around it like GTA IV and this will be epic , i love that HUD.

toggleable , off course

No, i dont think this should get this shit, it is an simple radar, good as it is…

NEW NOT SO LAGGY VERSION ON SVN!

well I agree with him and I don’t give a fuck about what you think, stop being self-centered.

I have found a small bug in this. Any NPC without npc_ at the beginning of their class (such as the Hopper mines, with class combine_mine) doesn’t show up on the radar at all.

It should be fixed, I changed to :IsNPC().
SVN Updated !

Is the “new beacon on the fly” thing as easy as “Edit a class name in a Lua file, save as new file, ???, profit!!!1”?

I assume it deals with a bit of editing, but the system is very modular.

Yup, for example, here’s the code needed to draw the vehicles in the radar, as well as automatically adding an entry in the list to disable/enable this beacon with ease :

[lua]BEACON.Name = “Vehicles”

BEACON.angle = nil
BEACON.dist = nil
BEACON.isup = nil

BEACON.spriteScale = 2.5
BEACON.spriteColor = nil
BEACON.spriteColorEmpty = Color(128,240,128,255)

BEACON.sprite = dhradar_GetTexture(“arrow”)
BEACON.spriteAngle = nil
BEACON.spriteColorBorder = Color(0,0,0,128)

BEACON.theoScale = nil

function BEACON:FindFunction( entities , myTrashTable )
for k,ent in pairs(entities) do
if string.find(ent:GetClass(),“vehicle”) then
table.insert(myTrashTable,ent)
end
end
return myTrashTable
end

function BEACON:DrawFunction( ent )
self.angle, self.dist, self.isup = dhradar_CalcGetPolar( ent:GetPos() )
self.spriteAngle = ent:GetAngles().y - dhradar_Angles().y + 90
self.spriteColor = self.spriteColorEmpty

dhradar_DrawPin(self.sprite, self.angle, self.dist, self.spriteColorBorder ,      1.25*self.spriteScale, self.spriteAngle, true, 0.5)
dhradar_DrawPin(self.sprite, self.angle, self.dist     , self.spriteColor       , 1.00*self.spriteScale, self.spriteAngle, true, 0.5)

return true

end
[/lua]

This code draws all the vehicles in the radius set by the user, in a Need For Speed fashion.

Still does the same, and frag grenades now don’t show up.

Note: Do not increase the range of detection, it crashes you!