Raptor007 / aq2-tng

Action Quake 2: The Next Generation. Raptor007's sandbox for testing changes. When verified stable, this code is pushed to the official aq2-tng repo:
https://github.com/aq2-tng/aq2-tng/tree/bots
4 stars 2 forks source link

Server variable FPS and hurt brush damage differences #117

Closed darkshade9 closed 2 years ago

darkshade9 commented 2 years ago

I left an issue on q2pro's Github but I thought I'd also bring it up here since TNG is one of the exclusive users of sv_fps. There's a significant difference in hurt brush rate of damage and sv_fps, as show in this video:

https://youtu.be/9DgUibXAysk

I don't have a 'control' test at the moment to test on a server that does not have variable FPS enabled, but I'm certain that this is doing a lot more player damage than on a server that doesn't have it.

If this is unrelated to TNG at all feel free to close and hope that Q2Pro could address it somehow?

Raptor007 commented 2 years ago

This looks like something to be solved in TNG, and may be related to some of the code mentioned in issue #27.

Raptor007 commented 2 years ago

I think I see it. My guess is the hurt brush flag spawnflags & 16 is meant to specify whether damage is dealt once per second or 10 times per second, but instead of 10 per second it may be happening on every frame: https://github.com/Raptor007/aq2-tng/blob/35db97fcd9dd9ff349697907639345b0553790bd/source/g_trigger.c#L475-L478

Most likely this would be the fix:

    if (self->spawnflags & 16)
        self->timestamp = level.time + 1;
    else
        self->timestamp = level.time + 0.1;

But I'd like to test a few maps with hurt brushes to make sure this is a good fix that doesn't cause other problems.

Raptor007 commented 2 years ago

Yes, this fix seems to work. Didn't break any edge cases that I could find.

It looks like that's been set to FRAMETIME since waaay back before sv_fps was added, when they were expecting it to be a hard-coded constant 0.1: https://github.com/Raptor007/aq2-tng/blame/40c9508c6768149c7d9c11974bc65a221cdb77dd/source/g_trigger.c#L462-L465

darkshade9 commented 2 years ago

Good catch there, it felt like a framing issue sped up by the sv_fps addition. The cacti in tequila didn't seem to do much more damage but the spiked door in police did an absolute massive amount.

Raptor007 commented 2 years ago

I think the cacti in tequila use spawnflags & 16 to deal damage once per second, so they shouldn't have been effected by this sv_fps issue. Actually I think most map hurt brushes do, which is probably why this problem was not noticed sooner.