TheJosh / chaotic-rage

An unusual zombie shooter game for Windows and Linux
GNU General Public License v2.0
35 stars 10 forks source link

FPS mode improvements #84

Closed esper closed 9 years ago

esper commented 10 years ago

Sub-issue of #82

The FPS mode (first person view) is not really the normal FPS mode found in other games. The view is basically that the camera has move to the head of the player.

Suggested improvements (can be divided into smaller specific issues):

TheJosh commented 10 years ago

I had an idea on the bus today for the crosshair (I do a lot of thinking on the bus). You could have a per-weapon image which is textured onto a quad (triangle strip) in the middle of the screen.

Then I started thinking about variable size crosshairs, based on some sort of accuracy figure which would vary between shots.

You could have it as the amount of randomness applied to the angle of the shot, in degrees. 0 = perfect accuracy. 50 = terrible. So then you would modify the weapon type config to have additional keys:

As for the crosshair, you could define two sizes in pixels. The engine would map the smallest size to the best accuracy, and the largest size to the worst accuracy. Then the size of the quad could vary based on the accuracy value. Thus you would add three more keys:

Of course, this is only one possible implementation for this kind of feature.

TheJosh commented 10 years ago

@esper, are you planning on making any of these changes? I did one of them by adding a simple crosshair, but feel free to commence this if you would like.

esper commented 10 years ago

@TheJosh, working on be able to aim in the vertical axis, no real progress yet.

TheJosh commented 10 years ago

Take a look at the calls to the WeaponType::doFire method from the unit class. There is a btTransform which contains the position (basis) and rotation of the unit.

You can tweak the angle using something like this:

btQuaternion rot = xform.getRotation() * btQuaternion(axis, angle);

where axis is a btVector3 and angle is in radians.

The actual weapons themselves use this line to tweak the horizontal axis to provide for a random angle for accuracy calculations:

btQuaternion rot = xform.getRotation() * btQuaternion(btVector3(0.0f, 1.0f, 0.0f), DEG_TO_RAD(angle));
esper commented 10 years ago

Thanks! I have found the doFire functions but had/have problems with the transforms. Will try your suggestion.