Scrolling Map, Radar, Compass gui Control
by Thor Zollinger · 02/08/2003 (9:23 am) · 23 comments
Download Code File
Hi Guys.
Here is a gui control you might like which gives you a rotating, scrolling terrain map combined with modified versions of Matt Webster's compass and radar controls.
You can set the map bitmap, the map/radar range (which has a 250 meter default) and you can turn both the map and radar on and off as well. With both turned off, the rotating compass ring is all that's visible, and with the map off, Matt's green radar background is used.
There are four script-accessable functions for the control:
void setBitmap(const char *name);
void SetRange(F32 Range);
void RadarOnOff(bool RState);
void MapOnOff(bool MState);
Someone needs to test these for me, since I've only had Torque for a week or two and I'm not certain how to get at the functions from a script yet... I'm also new to C++, so be kind in your comments. Delphi and OpenGL were my weapons of choice until I scrapped my own engine for Torque to take advantage of the multiplayer network code.
NOTE: Obvious improvements would be color-coded blips for IFF identification, and a better way to load the control's bitmaps rather than hard-coding them.
If all goes well, I'll be adding a few more interesting items to the code base. I have a nice 2-texture-based massive scenery library placement tool from my old engine, and I want to add some ultra-fast physics modules for vehicles. I noticed a big slowdown in fps when I added a fair number of vehicles into the demo, and I'm a mechanical engineer so the physics doesn't intimidate me in the least. I have an accurate helicopter physics engine right now if anyone is interested in adapting it to Torque.
I hope you find this tool useful!
Thor
Hi Guys.
Here is a gui control you might like which gives you a rotating, scrolling terrain map combined with modified versions of Matt Webster's compass and radar controls.
You can set the map bitmap, the map/radar range (which has a 250 meter default) and you can turn both the map and radar on and off as well. With both turned off, the rotating compass ring is all that's visible, and with the map off, Matt's green radar background is used.
There are four script-accessable functions for the control:
void setBitmap(const char *name);
void SetRange(F32 Range);
void RadarOnOff(bool RState);
void MapOnOff(bool MState);
Someone needs to test these for me, since I've only had Torque for a week or two and I'm not certain how to get at the functions from a script yet... I'm also new to C++, so be kind in your comments. Delphi and OpenGL were my weapons of choice until I scrapped my own engine for Torque to take advantage of the multiplayer network code.
NOTE: Obvious improvements would be color-coded blips for IFF identification, and a better way to load the control's bitmaps rather than hard-coding them.
If all goes well, I'll be adding a few more interesting items to the code base. I have a nice 2-texture-based massive scenery library placement tool from my old engine, and I want to add some ultra-fast physics modules for vehicles. I noticed a big slowdown in fps when I added a fair number of vehicles into the demo, and I'm a mechanical engineer so the physics doesn't intimidate me in the least. I have an accurate helicopter physics engine right now if anyone is interested in adapting it to Torque.
I hope you find this tool useful!
Thor
#2
I haven't tried it with script functions yet, but the code worked great. Tried it with a different map too.
02/08/2003 (12:50 pm)
Very nice. I haven't tried it with script functions yet, but the code worked great. Tried it with a different map too.
#3
I worked on a command map overview a few months ago and gave up, was unable to get a
view of the terrain and properly add the blips to the view.
Maybe when I get some free time I will relook into the command view *shrug*
-Ron
02/09/2003 (8:58 am)
This looks very interesting!I worked on a command map overview a few months ago and gave up, was unable to get a
view of the terrain and properly add the blips to the view.
Maybe when I get some free time I will relook into the command view *shrug*
-Ron
#4
02/09/2003 (11:35 pm)
Thanks for helping with gui's and physics!
#5
02/12/2003 (5:16 pm)
Thanks for the feedback! Just trying to help.
#6
03/02/2003 (6:37 am)
Works perfectly. Do other players show up on the radar as blips?
#7
02/27/2005 (9:00 pm)
Works great! Only problem I have is that the compass.png image doesn't overlay on top of the radar_base and I also get a tad but of lag when firing weapons. Anyone else get this?
#8
04/13/2005 (11:49 am)
Works great! But how can I get differrent radar ranges, just like in Delta Forge?
#9
08/17/2005 (7:24 am)
It works great!thanks.
#10
11/29/2005 (10:25 am)
anyone get this to work in the new 1.4? seem to be having problems
#11
Thanks
02/13/2006 (9:26 am)
Help help help having problems moving over to 1.4 anyone out there integrate this into 1.4Thanks
#13
Place it in engine/gui/game/
In guiRadarCtrl.h change
and in guiRadarCtrl.cc
That should do it.
04/18/2006 (11:51 am)
I got it working with 1.4. There are only a few changes:Place it in engine/gui/game/
In guiRadarCtrl.h change
#ifndef _GUIBITMAPCTRL_H_ #include "gui/guiBitmapCtrl.h" #endifto
#ifndef _GUIBITMAPCTRL_H_ #include "gui/controls/guiBitmapCtrl.h" #endif
and in guiRadarCtrl.cc
#include "gui/guiRadarCtrl.h"to
#include "gui/game/guiRadarCtrl.h"
void GuiRadarCtrl::onRender(Point2I offset, const RectI &updateRect)
{
// Must have a connection
GameConnection* conn = GameConnection::getServerConnection();
if (!conn) return;tovoid GuiRadarCtrl::onRender(Point2I offset, const RectI &updateRect)
{
// Must have a connection
GameConnection* conn = GameConnection::getConnectionToServer();
if (!conn) return;That should do it.
#14
04/18/2006 (7:12 pm)
Thanks, Stefan.
#16
Love this resource!!!
01/05/2007 (8:14 am)
Is there a way to make this show teams in a different color blip?Love this resource!!!
#17
i just don't know what structure those are held in...anyone know? i know the onfire event on the server side does a "MissionCleanup.add" when you fire a weapon but how do i even figure out where to look for that on the client side?
Thanks!
Dan
01/28/2007 (5:58 pm)
I would like to turn this into a sort of fire control radar by adding all the weapons on onto it...i just don't know what structure those are held in...anyone know? i know the onfire event on the server side does a "MissionCleanup.add" when you fire a weapon but how do i even figure out where to look for that on the client side?
Thanks!
Dan
#18
I added different blip colors. It just required adding a variable to the player datablock in player.cc and setting the blipcolor in the player.cs datablock.
03/26/2007 (4:28 pm)
@Jason BurchI added different blip colors. It just required adding a variable to the player datablock in player.cc and setting the blipcolor in the player.cs datablock.
#20
05/29/2007 (2:15 pm)
Daniel Roden, better late than ever huh.. anyway. Check out the if statement which grabs ShapeBase objects, and just make it iterate over the projectiles in your client container instead. 
Torque Owner Badguy
keep it up man!
i'll install it later and try it out.