Game Development Community

dev|Pro Game Development Curriculum

3rd/1st Person Crosshair with ShapeName on it

by Jorge Luis Gandulfo · 04/22/2004 (8:36 pm) · 31 comments

Download Code File

I based my work on this tutorial www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3533 from Max Robinson.

Once i applied the changes Alastar Paterson suggested to make the crosshair to stop shaking, i added a small modification.

Actually my problem was that the GuiShapeNameHud have terrific range, and you can see the enemy name from kilometers.

So i deleted that from may playgui.cs and then modified the c code for GuiCrossHairHud.cc and simply added some steps so i could see the name on the shape.

I will attach the Code of GuiCrossHairHud here.

Quote:
So to make this work just copy it to the game/fps/ directory in your engine code directory.

Compile and then set the playgui.cs (mod/client/ui), and make sure you get this part looks like this.

new GuiCrossHairHud() {
      profile = "GuiDefaultProfile";
      horizSizing = "center";
      vertSizing = "center";
      position = "2 -1";
      extent = "653 485";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
      bitmap = "./crossHair";
      wrap = "0";
      damageFrameColor = "0.000000 0.000000 0.000000 1.000000";
      damageRect = "40 4";
      damageOffset = "0 10";
      bitmapSize = "32 32";
      friendlyTargetColor = "0.000000 1.000000 0.233333 1.000000";
      enemyTargetColor    = "1.000000 0.000000 0.000000 1.000000";
      neutralTargetColor  = "1.000000 1.000000 1.000000 1.000000";
      damageOffset = "3 3";
Page «Previous 1 2
#1
04/22/2004 (10:43 pm)
The download is not working.
#2
04/22/2004 (10:44 pm)
As always, download isn't working (you'll have to re-upload it) :/
#3
04/22/2004 (11:32 pm)
Download Fixed! Sorry for that!
#4
07/14/2004 (8:59 pm)
Thanks Jorge,
With some wrenching I got this in!
Works in the latest HEAD.
I'm a 3rd person guy and this got my crosshair back.
Good work!

This resource has been assimilated!

Ari
#5
07/15/2004 (12:32 pm)
does it show on vehicles
#6
08/09/2004 (11:59 pm)
This locks up my engine after 4-5 seconds. I've tried to track down the bug, but cant find it. I got my advanced camera in the engine too, so that might be why. Has anyone have success with this + the advanced camera resource?

I changed the code to use the getRenderEyeTransform instead (in an attempt to get around any camera node problems) but same result
#7
10/19/2004 (7:46 pm)
If anyone is still reading this thread, I'm having the lock up after a few seconds as well. Hopefully you found a fix and happen to read this and post it :)
#8
10/23/2004 (1:24 am)
I read this thread just now :/
#9
10/24/2004 (4:44 pm)
I tried to original super crosshair tutorial on a fresh build without the advanced camera in, and it worked. I think the advanced camera and the crosshair do not like eachother :x
#10
10/24/2004 (5:15 pm)
hmmmm, seems to not want to work with the hitbox tutorial either...
#11
11/16/2004 (1:48 am)
Mmm. this resource was tested with torque 1.2.something :), so i will reapply this to the just downloaded 1.3 version of torque i got, and i will see what i can find,

Any tip on what and how to apply to make this bug?, that way i might be able to work arround it, thanks
#12
01/04/2005 (3:16 pm)
Has anyone had luck with this in 1.3?
#13
01/12/2005 (7:19 pm)
it works fine with me for 1.3...


nice resource!
#14
01/21/2005 (11:35 pm)
Running the latest 1.3 HEAD from cvs using this crosshair. Love it! But got a lockup problem i can not figure out.

Runs fine on 2 machines that have ati radeo video cards, but 2 other machines that are using Nvidia Geoforce FX 5200 cards lockup.

I spent several hours on the Nvidia equipted machines trying to debug the lockup and only after removing this crosshair did the lockups stop. Replaced this super crosshair with the default and game runs fine.

Also, when using this crosshair on the machines with the problem, this only happens when I use OpenGL mode from the video options menu. If I switch to use D3D the problem goes away, but the video quality is not as great as it is in OpenGL.

So im guessing it is an issue with OpenGL and nvidia, and i really have no clue how to fix this.

Take care

don
#15
01/21/2005 (11:37 pm)
The above message should read "ATI Radeon video cards", not "Radeo video cards".. Darned finners :)
#16
04/24/2005 (9:49 am)
To get this to compile with 1.4RC, you need to make the following changes to the guicrosshairhud.cc file due to the new gui folder tree:

#include "gui/core/guiControl.h"
#include "gui/controls/guiBitmapCtrl.h"
#include "gui/core/guiTSControl.h"

Also, in the same file change getServerConnection to getConnectionToServer.

That's just to get it to compile. In-game, the crosshair displays over the character's upper back and looks awkward. I think it would be better if it was up a little above his head.

And if you do a compare between this guicrosshairhud.cc and the current one in HEAD you'll find tons of differences so not sure if I should use this in the first place.

Nick
#17
07/09/2005 (10:55 am)
Has anyone figured out the problem with openGL and nvidia? My framerate goes to a crawl when i turn on d3d. For me it only locks up when it's aiming at a sudden change in depth, like going from the corner of a building to the sky. Could it be something like it's changing position to fast or to slow, any ideas?
#18
10/28/2005 (8:58 am)
........
#19
12/24/2005 (1:41 pm)
I got this working in 1.4...Thanks for the resource Jorge!

any ideas on how to get this to work with non-NPC objects, like items, static/dynamic objects, and basically anything that can be brought in as a DTS?
#20
01/07/2006 (6:12 am)
Well i was out on some Trips, and forgot about most of my torque proyects, anyway most of em, were barely incursions to the egine, but i just started a new project and was checking the site.

Now

-Jake T

I was just reviewing my code and i think the part that filters what kind of shapebase to show info on the crosshair is this:

if(obj->getShapeName())
	{
			hasObject = true;
			dmgLevel = obj->getDamageValue();

			dStrcpy(szShapeName, obj->getShapeName());

			mActiveColor = mEnemyTargetColor;
	}

Basically i think if the shape returns a valid name using the getShapeName Function it should work, i was just checking this.

I will try to check 1.4, i just downloaded it, and with some luck i will upgrade Max Robinson and my code to 1.4.
Page «Previous 1 2