Game Development Community

Non-fixed Crosshair?

by Jason Barno · in Torque Game Engine · 06/07/2007 (7:47 am) · 4 replies

Here at theorystudios, we noticed something that would definately bring a closer respect to modern gaming, and with no available resources. How does one go about creating a non-fixed crosshair, from games such as Halo, or even the original 007: Goldeneye? For those who haven't played either of these time-respective masterpieces, I'm referring to the crosshair not being "fixed" in the center of the screen, instead giving the player a free range of aim before actually re-orienting the character, to where when the crosshair nears the edge of the screen, the player would rotate in the given direction, but staying within a certain parameter, could target things that are not directly located in front of him.

We spent a few hours looking, and were unable to find any resources on this. If anyone knows of a related resource, it could save us some good time. And if not, if someone can help, we'll "resourcize" this for the rest of the world.

Thanks again!
~Jace

#1
06/08/2007 (7:34 am)
I'm not too hot on how you'd code this, but I've also thought about implementing something similar. It's probably end up similar to RTS camera control - where if you move the cursor to the right of the screen, the camera goes right. But instead of moving right only when you touch the side of the screen, you'd start moving when the cursor got close. As the cursor gets closer to the side of the screen, increase the amount you turn by.
It would probably involve a normal cursor, getting its position each tick, and checking to see whether it's close enough to an edge to start panning/tilting the camera.

Also, when does that happen in Halo?
#2
06/08/2007 (12:26 pm)
It's been awhile since Halo, but I know for a fact Halo 2 has it and if my memory serves me well, so does TimeSpliiters' Future Perfect. Not sure if you completely understood what I meant or not, so to clarify: this isn't so much rotating the camera, just basically imagine a generous circle covering the center of the screen; not actually visible, but you can freely move the crosshair anywhere inside that part of the screen, adjusting only muzzle trajectory, not actually looking or turning in any direction. Cross the line, to the outer edges of the screen, then turn the character. So here's a simple diagram: xx|yyyy|zz - you could stand perfectly still and target/move the crosshair in the yyyy area, but if the cursor (crosshair) is in xx, the player will start to rotate left, and yy will rotate it right, and the camera will naturally remain and rotate with the player; I don't even understand quite how animating this would require because the arms basically would move, just a bit, independantly of the torso. (arms rotate a certain extent before the character rotates.)

Hope that clarified a bit. This might even be in an existing camera/player control resource, but I couldn't find any that explicitly listed this feature.

Thanks again for any help.
~jace

Oh, @Daniel, I'm thinking maybe if I can get the curor to raycast into the world, and then adjust the muzzle trajectory/visible arms to point at that object, this might work. Any more thoughts on the matter are appreciated.
#3
06/10/2007 (11:35 pm)
We've actually got something like this implemented in Versus... We call it the "lazy reticle". It's not exactly what you were looking for, but it might help. Unfortunately I cannot release the code but I can, however, give some pointers as to how we achieved the effect.

Imagine a ring around a standard "+" crosshair. The ring represents the amount of "play" in aiming a particular weapon based on that weapon's mass. A larger weapon has more mass, therefore it requires more effort to bring the weapon to bear on a target. BRACE FOR INCOMING ASCII ART!
Big Gun:
___
 /   \
/     \
|  +  |
\     /
 \   /
  ---

Little Gun:
_
/   \
| + |
\   /
  -

As the player rotates via the mouse, the circle "drags" across the screen in the opposite direction of rotation until the crosshair reaches the edge. At that point the circle stops "dragging" and remains fixed in place until the player stops rotating. Remember, it's not the "+" that moves, it's the ring.
Rotating Left:
  ___
 /   \
/     \
|+    |
\     /
 \   /
  ---
Rotating Right:
  ___
 /   \
/     \
|    +|
\     /
 \   /
  ---
Once rotation has ceased, the circle slowly returns to the center position at a rate, again, based on mass. The projectile is emitted from the muzzlePoint, but follows the vector set by the GUI element. It was a little tricky to get a vector in worldspace from a GUI element, but there's ample resources that implement something similar (clickable world objects). Getting it to work in client/server is the real magic... and I'll leave that for you to figure out. If you give a man a fish... :)

It's a supremely effective optical illusion and with some tweaking in the weapon datablocks we're able to give each weapon a really unique feel.

EDIT: clarity
#4
06/11/2007 (5:16 am)
That is an interesting application of mild weapon physics and does point me in the right direction. Does anyone know, though, how the animation of the arms could work to realize this so gun doesn't point straight while bullets go right? Oh, once again, @Cogburn, thanks.