fabiangreffrath / crispy-doom

Crispy Doom is a limit-removing enhanced-resolution Doom source port based on Chocolate Doom.
https://fabiangreffrath.github.io/crispy-homepage
GNU General Public License v2.0
810 stars 131 forks source link

Improve weapon recoil relaxation strategy #176

Closed JNechaevsky closed 7 years ago

JNechaevsky commented 7 years ago

I have noticed that weapon recoil pitch looks not smooth in framerates higher than 35 fps. Even in uncapped mode it looks and feels like 35 fps, i.e. Maybe it should be corrected to more smooth, just like mouse look?

Note: I'm not attaching any video, because barely it can show this properly. Please, just take a try this by yourself.

Additional suggestion: not sure that it's worth it, but maybe different weapons must have a little bit different amplitudes? Without too much fanaticism, of course. Can't offer anything interesting for now, need to think (if this is interesting at all).

Suggestion №61

fabiangreffrath commented 7 years ago

I admit that recoild feels a bit clumsy, although the recoil pitch is already interpolated since this commit: https://github.com/fabiangreffrath/crispy-doom/commit/9d5d45c150b654ddf8284d8e58e51e7497093fda

I think this may be due to the way the pitch relaxes, which happens here just as it is done in Strive VE: https://github.com/fabiangreffrath/crispy-doom/blob/master/src/doom/p_user.c#L319

I'll see if I can find a solution to reduce the pitch a bit smoother.

different weapons must have a little bit different amplitudes

But, it's already that way: https://github.com/fabiangreffrath/crispy-doom/blob/master/src/doom/p_pspr.c#L46

fabiangreffrath commented 7 years ago

Ho do you like this change?

diff --git a/src/doom/p_pspr.c b/src/doom/p_pspr.c
index cc059159..deada88c 100644
--- a/src/doom/p_pspr.c
+++ b/src/doom/p_pspr.c
@@ -64,7 +64,7 @@ void A_Recoil (player_t* player)
    P_Thrust(player, ANG180 + player->mo->angle, 2048 * recoil_values[player->readyweapon][0]);

     if (crispy_pitch)
-   player->recoilpitch = recoil_values[player->readyweapon][1]<<FRACBITS;
+   player->recoilpitch = recoil_values[player->readyweapon][1];
 }

diff --git a/src/doom/p_user.c b/src/doom/p_user.c
index 42076165..8646b6a2 100644
--- a/src/doom/p_user.c
+++ b/src/doom/p_user.c
@@ -320,12 +320,7 @@ void P_PlayerThink (player_t* player)
     // adapted from strife-ve-src/src/strife/p_user.c:677-688
     if (player->recoilpitch)
     {
-   fixed_t recoil = (player->recoilpitch >> 3);
-
-   if(player->recoilpitch - recoil > 0)
-       player->recoilpitch -= recoil;
-   else
-       player->recoilpitch = 0;
+   player->recoilpitch /= 2;
     }

     if (player->playerstate == PST_DEAD)
diff --git a/src/doom/r_main.c b/src/doom/r_main.c
index ac543b69..12afaae7 100644
--- a/src/doom/r_main.c
+++ b/src/doom/r_main.c
@@ -927,7 +927,7 @@ void R_SetupFrame (player_t* player)
         viewangle = R_InterpolateAngle(player->mo->oldangle, player->mo->angle, fractionaltic) + viewangleoffset;

         pitch = (player->oldlookdir + (player->lookdir - player->oldlookdir) * FIXED2DOUBLE(fractionaltic)) / MLOOKUNIT
-                + ((player->oldrecoilpitch + FixedMul(player->recoilpitch - player->oldrecoilpitch, fractionaltic)) >> FRACBITS);
+                + (player->oldrecoilpitch + FixedMul(player->recoilpitch - player->oldrecoilpitch, fractionaltic));
     }
     else
     {
@@ -937,7 +937,7 @@ void R_SetupFrame (player_t* player)
         viewangle = player->mo->angle + viewangleoffset;

         // [crispy] pitch is actual lookdir and weapon pitch
-        pitch = player->lookdir / MLOOKUNIT + (player->recoilpitch >> FRACBITS);
+        pitch = player->lookdir / MLOOKUNIT + player->recoilpitch;
     }

     extralight = player->extralight;
JNechaevsky commented 7 years ago

Aha, checked them. Looks much more smoother, everything is fine. The only thing I would like to recommend - to calm down a bit amplitude of Plasmagun, in uncapped framerate it looks a bit aggressive.

Hey, and there is also "-fliplevels" turned on by default, don't forget about it!

fabiangreffrath commented 7 years ago

smoother, everything is fine. The only thing I would like to recommend - to calm

I agree. How about a pitch value of 6 instead of 8? I'd still like it to have a bit more kawoom then the chaingun. ;)

Hey, and there is also "-fliplevels" turned on by default, don't forget about it!

Yep, that's an easter egg. ;)

JNechaevsky commented 7 years ago

Argh, dang! You caught me! What a nice April's fool joke, upon compiling and first run of executable I was thinking that this is because of I was done something wrong. Grrr! 😈

Okay, since there is interest of implementing different amplitudes, here's some my thoughts:

fabiangreffrath commented 7 years ago

How about this (let's talk numbers):

JNechaevsky commented 7 years ago

I've changed values in p_pspr.c to these, compiled and checked this out.

I've also noticed that now it is again impossible to switch to the fist while having chainsaw. Is it by design?

JNechaevsky commented 7 years ago

Thinking a little bit more, I would like to offer a little choice to the player, with standard amplitude and light (for example, halfed of current). This is a cool feature, but I have a feeling that it can be pain for the eyes after some time. Maybe not. Completely at your discretion.

fabiangreffrath commented 7 years ago

I've also noticed that now it is again impossible to switch to the fist while having chainsaw. Is it by design?

Yep. In demos the intent to change weapons is recorded (i.e. the key press) and since it must not change from Chainsaw back to Fist there, I think it would feel strange if this was possible during regular play.

JNechaevsky commented 7 years ago

So be it then. Yet still, it was my first impressions, more longer and deeper testings still needed.

fabiangreffrath commented 7 years ago

Let's improve the recoil relaxation strategy a bit further. Simply halving its amplitude in every tic is a bit rough.