Game Development Community

dev|Pro Game Development Curriculum

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

About the author

Recent Blogs

Page «Previous 1 2
#1
02/08/2003 (12:47 pm)
Very cool thor!!
keep it up man!
i'll install it later and try it out.
#2
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
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
02/13/2006 (9:26 am)
Help help help having problems moving over to 1.4 anyone out there integrate this into 1.4
Thanks
#12
02/21/2006 (11:41 am)
HELP need help for 1.4
Thanks
#13
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"
#endif
to
#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;
to
void 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
01/05/2007 (8:14 am)
Is there a way to make this show teams in a different color blip?

Love this resource!!!
#17
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
03/26/2007 (4:28 pm)
@Jason Burch

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.
#19
03/27/2007 (7:46 am)
@Anton Bursch

Thank you very much!!!

This is awesome.
#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.
Page «Previous 1 2