Game Development Community

dev|Pro Game Development Curriculum

Radar Control (GuiRadarCtrl) for TGEA v1.0+

by James Laker (BurNinG) · 05/14/2007 (3:05 pm) · 78 comments

Download Code File

Hey again. Just in the process of porting my old resource found here .

To install and use:
1) Backup old guiRadarCtrl.h/guiRadarCtrl.cc (If you already have it installed)
2) Add the files from this resource. I created a new folder called "Hud" in my game folder. So in guiRadarCtrl.cpp you'll find that the .h file is referenced in to that loacation. You can just change it to match yours. Look for it at the #includes at the top of the file.
3) Recompile (Full Build)
4) In the GUI editor (F10) add the GuiRadarCtrl
5) Change the properties in the GUI editor

Extra:
Randy sent me some updates to this to allow for different blip dots (which are now small images). So when a target on the Radar is higher than your player, you can have a different blip image. So you should see 3 different blip files in the Properties (Above,Below,Level). You can make them all the same if you prefer that.

The LevelRange is the variable to set when the LevelBlip should be shown. If the value is 10, then all object on the Radar 10 meters above and 10 meters below you will still be shown as level.
The default is 20.

Then there's the RadarRange variable which is how far your radar will pick up objects. The default is 2500

Community Contribution:
The Scrolling Map and Radar Compass fix has been contributed (09 August 2007) by Matt Huston and Stickman Studios. Thanx you guys!

Last Update:
10 March 2008
Page «Previous 1 2 3 4 Last »
#1
04/16/2007 (7:41 am)
Good stuff James. The compass part is a bit rough to do. I've been trying to complete that for sometime now. Hoping you can get that patched.

-Andy
#2
04/24/2007 (4:39 pm)
Hmmm....it seems i'm missing a file: Cannot open include file: 'dgl/dgl.h': No such file or directory......not sure where it's at assuming it comes with TGEA. Thats my only error, so maybe you could include this file with an update for me :P Thanks Much
#3
05/15/2007 (3:08 am)
@Ian
dgl.h is not part of TGEA afaik, cause the graphics interface for TGEA has been rewritten to be more generic I think. dgl.h was part of TGE...
#4
07/25/2007 (5:42 am)
Have any of you guys got the Scrolling map and compass working too in TGEA?

I've added this request to GGs job opportunities area for $$s if anyone's interested. See here

www.garagegames.com/index.php?sec=mg&mod=project&page=view.job&qid=6091

Cheers

Harv 8)
#5
08/09/2007 (2:43 am)
Updated by Matt Huston for our good friends at Stickman Studios to include Scrolling map and Rotating Compass. They were so kind to give back to the community!
#6
08/09/2007 (7:26 am)
No problem James. It is Huston by the way, but I get that sort of thing all the time ;)

Thank Stickman especially for allowing the code to be accessible tot he community.
#7
08/09/2007 (7:30 am)
No Worries!! Anything we can do to help keep James' dapper compass up to date. 8)
#8
08/29/2007 (1:31 pm)
I get this error:

..\engine\game\fps\guiRadarCtrl.cpp(384) : error C2248: 'GFXDevice::mBitmapModulation' : cannot access protected member declared in class 'GFXDevice'
#9
09/01/2007 (10:46 am)
Thanks a lot for porting this resource!

I had that error as well (with 1.0.3) Adam and solved it by moving the line
GFXVertexColor mBitmapModulation;
in engine/gfx/gfxDevice.h a bit up into a public block:

public:
   GFXDevice();
   virtual ~GFXDevice();

   [b]GFXVertexColor mBitmapModulation;[/b]

   /// initialize - create window, device, etc
   virtual void init( const GFXVideoMode &mode ) = 0;
#10
09/09/2007 (4:20 pm)
So is the scrolling map and rotating compass fixed in this version? I'm not sure by the conversation above. Or is it still outscourced?
#11
09/10/2007 (5:34 am)
Hi Andy, well we've got it working in TGEA, I think we're still on 1.01 at the moment though.


One question though. Everything is working fine, but our map seems to be offset so not showing your actual position, is there a way of adjusting this? ... When we change the 'RadarRange' shouldn't it scale the map too so the blips are in the correct place on the map, and you're standing in the correct place on the map? I may have done something wrong from an art point of view but I don't think so...
#12
09/10/2007 (6:50 am)
Andy, this works in 1.02 and 1.03....
I'm updating it again to just make sure.
#13
09/10/2007 (7:04 am)
Harvey... The RadarRange is how far you the Radar will show blips. If you use the default (2500) it will scale things down alot and right at the edge of the Radar it will display things that are 2500m away. Changing that to 1000m will change the range to 1000m... Thus if something is a 1000m away, it'll scale it so that the blip is drawn right at the edge.

So I'm thinking that you just need the right scale and everything should show up in the right places. That's how it's intended to work.

The problem Adam had and Stefan Grevan fixed is changed in the files I uploaded now. It's not needed so I just removed it and fixed a small thing where the On/Off settings didn't properly work. Just trying to keep this resource a drop-in, so no other files should be changed.
#14
09/10/2007 (7:42 am)
Hi James,

Yeah, the radar blips work fine, they're showing in the right place, and if I try a different radar range they'll show further out, or closer in as they should. It's the scrolling map itself. It seems to have no relevance to where you're actually standing or which direction your ponting in. It scrolls correctly, but it's almost like it's offset or something, and I seem to remember it scaled up or down so that the radar blips are exaclty where they should be on the map etc...Have you seen it all working in your version? If so it must be something we're doing wrong our end. We've got the advanced camera resource in by the way...
#15
09/13/2007 (8:18 pm)
This resource is awesome! Thanks to everyone who has contributed to it and kept this going.

I am using TGEA 1.03 and have two issues. One I fixed (fix is below), the other I'm not sure about.

First issue:
I never used the original GUIRadarCtrl in TGE so I'm not sure if this is expected behavior or not but the compass flickers constantly, sometimes disappearing / fading in and out, as well as becoming green or blue colored. I tried using both a png and jpg (thinking it might have something to do with the transparency) but still get the flickering.

Does anyone have any idea what might be the cause of this?


Second issue:
I made a change to OnRender to fix an issue with the compass not scaling at all based on its extent.

Find the check for this
if (mCompassTextureObject && mShowCompass)
in void GuiRadarCtrl::onRender(Point2I offset, const RectI &updateRect)

And replace the entire code block with this:
if (mCompassTextureObject && mShowCompass)   
	{     	   
		GFX->clearBitmapModulation();

		GFXTextureObject* texture = mCompassTextureObject;

		GFX->setBaseRenderState();

		F32 width = mBounds.extent.x * 0.5;

		MatrixF rotMatrix( EulerF( 0.0, 0.0, mDegToRad(cameraAngle)));

		Point3F offset( offset.x + mBounds.extent.x / 2, 
			offset.y + mBounds.extent.y / 2, 0.0);

		GFXVertexBufferHandle<GFXVertexPCT> verts( GFX, 4, GFXBufferTypeVolatile );
		verts.lock();

		verts[0].point.set( -width, -width, 0.0f );
		verts[1].point.set( -width, width, 0.0f );
		verts[2].point.set( width, width, 0.0f );
		verts[3].point.set( width, -width, 0.0f );

		//verts[0].color = verts[1].color = verts[2].color = verts[3].color = GFX->mBitmapModulation;

		verts[0].texCoord.set( 0.0f, 0.0f );
		verts[1].texCoord.set( 0.0f, 1.0f );
		verts[2].texCoord.set( 1.0f, 1.0f );
		verts[3].texCoord.set( 1.0f, 0.0f );

		for( int i = 0; i < 4; i++ )
		{
			rotMatrix.mulP( verts[i].point );
			verts[i].point += offset;
		}

		verts.unlock();

		GFX->setVertexBuffer( verts );
		GFX->setCullMode( GFXCullNone );
		GFX->setLightingEnable( false );
		GFX->setAlphaBlendEnable( true );
		GFX->setSrcBlend( GFXBlendSrcAlpha );
		GFX->setDestBlend( GFXBlendInvSrcAlpha );
		GFX->setTextureStageColorOp( 0, GFXTOPModulate );
		GFX->setTextureStageColorOp( 1, GFXTOPDisable );
		GFX->setTexture( 0, texture );

		GFX->drawPrimitive( GFXTriangleFan, 0, 2);

		GFX->setAlphaBlendEnable( false );
	}
#16
10/25/2007 (7:13 pm)
Compass Flashing Issue: I'm seeing the same behavior as Matt Kronyak, with the very distracting flashing/bluish compass and/or map bitmap rendering. It almost seems like the compass overlay is having some sort of alpha map passed over it each frame to differing degrees over time, keeping it from rendering correctly. It's changing my colors in the compass artwork, fading them out completely, etc., and it seems to be a repeating pattern.

It's working fine without any map or compass though. Any idea what could be causing this? I'm using TGEA 1.0.3, with AFXA P4.

Camera Position Issue: One other problem I'm seeing is that the mob positions are not relative to the player object, but rather to the camera object. So if I zoom the camera out, the mob positions change on the radar, even though they haven't moved at all. The problem seems to be in the control's determination of where the "center" point should be.

Edit: I was able to resolve the camera position issue by doing something recommended in another thread regarding Advanced Camera (which I guess must be part of AFXA). I changed:
conn->getControlCameraTransform(0,&cam);	// store camera information
to
control->getEyeTransform(&cam);	// store camera information
#17
11/19/2007 (6:03 am)
Noone has got the compass flickering problem solved?
Ok, for the moment it's not among my priority, I'll wait ;)

JoZ ;)
#18
11/19/2007 (6:17 am)
I still don't, I'm really hoping someone who knows more than I do about graphics programming can help out here.

After investigating for many hours, all I could figure out is that it seems to be an issue with the port of the graphics rendering code from OpenGL to DirectX. Unfortunately, that's about as far as I can take it. Anyone have any further thoughts on this?

Also, does anyone NOT have these problems under TGEA while using a compass or map? If not, then can you please post what versions you are using of TGEA, AFXA (if applicable), etc.?
#19
11/20/2007 (8:02 am)
Hi all. We're not having any of the flickering problems you refer to.. We're using the compass, map, and radar too, and all is fine. We had an offset problem with the map though, but I got around it in art by rotating the map graphic 360 degrees, and then doing an 'offset' in pshop by 128 pixels.. We're curently on v1.0.1 I think, but looking at upgrading to 1.0.3 soon(ish) We've tested the game on all manner of Pcs, both Nvidea and Ati with no problems... Hope this helps ..Harv
#20
11/21/2007 (2:31 am)
@Harvey: on my side tested with ATI and NVIDIA , TGEA is v. 1.0.3 , I hope in your case the porting will be painless :)

@... All
Anyone using radar+compass on TGEA 1.0.3 and having or not having the same problem (flickering)?
I'm trying to have an idea if this is a common problem or just in my and Arcanor case...

Tnx ;)
Page «Previous 1 2 3 4 Last »