D3D Crosshair?
Hi again,
Just wondering is someone could give me some info on how to make a D3D crosshair in a 3D video game. This is not for cheating or anything like that... it is just for practice, in single player. Thanks Again :) |
In what game? You mean a game from scratch? That could take a while. Maybe a few thousand lines just to create a window, initialize DX, handle inputs and load graphics...
If you just wanna know how it works, the concept of a crosshair is simple though: Simply set the mouse cursor to invisible, load an image with the cross-hair and let that be your "new" mouse cursor. Usually, it's done with a small image, where everything is black (or any other color, actually) but the cursor itself. You then tell DX to ignore the color at position 0,0 of the image, so only the actual cursor is displayed. If you really want an example, download DX SDK. It comes with a few examples, but I highly doubt somebody would be kind enough to write thousand of lines to show how a cross-hair works :) |
i think he just wants to replace the game crosshair (the gun crosshair to where you are aiming) with something else.
like a cross + or a O with a dot in it or just a dot. i myself do not know how to do this and will be interested in hearing of how to do it as i have wondered this for quite some time. |
If you're trying to mod an existing closed source video game to do this then the solution is likely very complex and highly dependent on which particular game this is.
|
Quote:
|
I see. So technically speaking, this has really nothing to do with programming :). And as geeman2.0, this kind of modification really depends of the game. As an example, Doom 3 core files are packed in .pak files. You can rename those files to .zip (or was it .rar), uncompress them, change whatever you want and repack them. That's pretty much the way every gun mod is done for Doom 3.
I've no experience creating mods. Just a little creating maps for Unreal Engine, so I'm not in a position to help or advice you with Battlefield. I would advice you searching google for tutorials modding Battlefield. Regards! |
What I really wanted to do was use D3D to add a crosshair, I know this is possible but I do not know how to do it. In other words, have my custom made D3D crosshair follow the in game crosshair moving as I move.
Isn't there some D3D functions that can inject code into the game? I basically want to write over the game's original crosshair with my own(different colour, different shape). |
D3D is a graphics API. It is not an API to "inject code into games." There are only a few ways off the top of my head that I could think of that what you want would be possible.
One other problem is that BF2 uses Punkbuster. So... if you try and use this on a server with Punkbuster enabled (and I believe all ranked servers have to enable Punkbuster) and you have modified your game files using the first method, I'm guessing that you would get kicked. |
I don't know about battlefield2, but if it uses the quake3 (or any ID engine), you can:
goto the folder base(q3, q3, something "base") and you'll find a base*.pk* (or *.pak). Rename this to base*.zip. Open it, and look for the crosshair .tga's. They are probably in the Sprites, or Grapics/SFX folder. When you locate them, find the crosshair that is the one you want to change in the game. Make a note of the location of the crosshair (the path + the filename), e.g. sprites/crosshairs/mycross.tga, and then use a program like The GIMP (www.gimp.org) to make your own crosshair. After you're finished with your crosshair, create a new pak file of your own called "mycrosshair.pk* (.pak)) and compress your crosshair.tga file into it with the same path and same name. It will then have replaced the crosshair with your own. Here, I'll use quake3 as an example: (1): Goto C:\program files\quake III Arena\baseq3 (2): Rename pak0.pk3 to pak0.zip (you may have to tell windows to show file extensions) (3): Open pak0.zip with your fav' archiving program (WinZIP, WinRAR, etc...) (4): In the archiving program, browse to the folder, gfx/2d/ (5): You will now see a few TARGA (.tga) images. The one we will focus on is "crosshaira.tga" (6): Select and extract "crosshaira.tga", and open it with The GIMP or Photoshop (7): Edit it to suit your needs (8): Create a folder called "gfx" (9): Browse into the newly created folder called "gfx" and create another folder called "2d" (10): Save your image into this "2d" folder (11): Create a new archive called "mycross.zip" and compress the "gfx" folder into it (12): Rename "mycross.zip" to "mycross.pk3" and place it into the "baseq3" folder. (13): Luanch the game and enjoy your new crosshair! That is how it is done for Quake3. It will be almost the same thing for any ID engine. If it is some other 3D engine (like Unreal, or Halflife), then you'll have to get their custom archiving tools. But in the end, it is still really just the same thing. Good luck! Note: Punkbuster and other cheat detecting programs might see this change as a cheat, and therefor you might be kicked out of servers. |
BF2 doesn't use the Q3 engine. I believe it is an all new engine that Dice developed.
|
All times are GMT -5. The time now is 08:21 AM. |