Feature #198

All new hitbox and bounding box system

Added by Jacker almost 7 years ago. Updated 7 months ago.

Status:New% Done:

50%

Priority:NormalSpent time:-
Assignee:-
Category:Mod generic
Target version:2.78
OS: Arch:

Description

The current system of hit detection is flawed and outdated in many ways, and as computers have gotten a lot quicker after the cold war the more complex calculation needed for detection is no longer a problem.

I think we should go with the common idea of bounding box which has the hit boxes inside of it.
We can use the animation skeleton to bind hit boxes more accurately to the model.

https://developer.valvesoftware.com/wiki/Hitbox

standing_bug.jpg - standing - buggy (161 KB) Spyhawk, 20.11.2013 20:35

standing_fixed.jpg - standing - fixed (148 KB) Spyhawk, 20.11.2013 20:35

prone_bug.jpg - prone - buggy (158 KB) Spyhawk, 20.11.2013 20:35

prone_fixed.jpg - prone - fixed (173 KB) Spyhawk, 20.11.2013 20:35

dead_bug.jpg - dead - buggy (166 KB) Spyhawk, 20.11.2013 20:35

dead_fixed.jpg - dead - fixed (137 KB) Spyhawk, 20.11.2013 20:35

swimming_bug.jpg - swimming - buggy (142 KB) Spyhawk, 20.11.2013 20:35

215
216
217
218
219
220
221

Related issues

Related to ET: Legacy Development - Feature #98: Inspect/add prediction code... New 03.11.2012
Related to ET: Legacy Development - Feature #109: Add ETPro like hitboxes Invalid 11.11.2012
Related to ET: Legacy Development - Bug #503: Fix dead player hitbox direction and bb height New 01.02.2014
Related to ET: Legacy Development - Feature #662: Introduce ragdoll effect Invalid 22.11.2014
Related to ET: Legacy Development - Bug #735: Player model is shaking Fixed 18.12.2014
Related to ET: Legacy Development - Feature #1174: Increase slightly the height of wounded player's hitbox Fixed 18.01.2019
Related to ET: Legacy Development - Bug #1209: Region hits don't take non headshot weapon into account Invalid 21.02.2019
Related to ET: Legacy Development - Bug #1120: cg_debugPlayerHitbox doesn't show all & correct hitboxes Fixed 22.10.2018

Associated revisions

Revision 4d5f6793
Added by Spyhawk almost 6 years ago

mod: use fixed height hitboxes from etpub, refs #198

Revision f24596c5
Added by Spyhawk almost 6 years ago

game: added g_debugHitboxes CVAR_CHEAT, refs #198

Revision 20cc5ff5
Added by Spyhawk almost 6 years ago

mod: use fixed height hitboxes from etpub, refs #198

Revision 2dea3c0f
Added by Spyhawk almost 6 years ago

game: added g_debugHitboxes CVAR_CHEAT, refs #198

Revision c142cba0
Added by IR4T4 almost 6 years ago

game: g_debughitboxes fixed

Revision e1b64091
Added by IR4T4 almost 6 years ago

game: fixed antilag trace functions to use our proper hitbox values

Revision 2ef0fb06
Added by Jacker almost 5 years ago

included the mdx files for the realhead code on qagame

Revision b501d55d
Added by Jacker almost 5 years ago

woops the macros were incorrect

Revision cc81256c
Added by Jacker almost 5 years ago

only allow the sv_gettag to use client code on release builds

Revision 5408aba4
Added by IR4T4 almost 5 years ago

game: g_realhead added

Revision fa56a80d
Added by Jacker almost 5 years ago

mdx fixes

Revision 2969011f
Added by IR4T4 almost 5 years ago

game: clean up

Revision b3170253
Added by Jacker almost 5 years ago

fixed the build on non mdx configuration

Revision 2b9d4cdc
Added by Jacker almost 5 years ago

realhead code now works, but needs testing

Revision eac71cfb
Added by Jacker almost 5 years ago

added missing code and uncrustified

Revision 41effd95
Added by Jacker almost 5 years ago

enable mdx support by default

Revision 39d296a3
Added by IR4T4 almost 5 years ago

game: server side realistic hitboxes fixed

Revision 23ca303a
Added by Jacker almost 5 years ago

fixed the infinite helmet bug, refs #198

Revision 48e59277
Added by Jacker almost 5 years ago

changed the frametime value to be calculated based on sv_fps, refs #198

Revision eb6b0b62
Added by IR4T4 almost 5 years ago

game: added Neil Toronto’s skip correction code

Revision 3ec570f3
Added by IR4T4 almost 5 years ago

game: fix warnings refs #735

Revision 299c89d0
Added by Jacker almost 5 years ago

enabled realhead also for proning players

Revision d6da69e1
Added by Spyhawk almost 5 years ago

cgame: added comment about CG_RailTrail time value, refs #198

Revision 1fccfc39
Added by Spyhawk 6 months ago

mod: fixed prone hitbox height and debug hitbox rework, refs #198 #1120

  • adjusted prone hitbox height (was twice as high as etpro)
  • added slightly lower hitbox when crouching without moving
  • adjusted height of client side hitboxes to be same as server side
  • added missing prone legs hitbox in server side debug hitbox mode
  • added headbox in client side debug hitbox code
  • adjusted debug hitbox colours

Revision 6ff60b74
Added by Spyhawk 6 months ago

cgame: adjusted client side predicted hiboxes height, refs #198 #1120

Revision b208525b
Added by Spyhawk 6 months ago

game: fixed legs debug hitbox not displayed, refs #198 #1120

Revision d447aabe
Added by Spyhawk 6 months ago

cgame: added client side head and legs debug hitboxes, refs #198 #1220

Note: readhead code is server side only

Revision fabe421f
Added by Spyhawk 6 months ago

cgame: display debug hitbox for current alive client only, refs #198 #1120

Revision 1a42738b
Added by Spyhawk 6 months ago

mod: small hitbox height optimization, refs #198 #1120

Revision 9952397d
Added by Spyhawk 6 months ago

game: fixed debug hitbox head ent reference, refs #198 #1120

Also minor comment cleanup

See 9b1339457c6679b7c0a56dd8ffe279b8711f3f68

History

#1 Updated by Dragonji over 6 years ago

I think it is not a good idea to add such accurate hitboxes to W:ET. People who play the game for years are used to the big boxes they played with for the whole time.

Jaymod and N!tmod for example have options to use such hitboxes:

And they are a complete fail in my opinion, almost none server use them because as I said previously people are used to the ones they played with for years, the accurate ones completely change gameplay as players become unhittable. The other thing is that mid server can become a lag fest with such hitboxes even if running on Core i7 machine...

I’d only like to suggest to just slightly adjust original/ETPro hitboxes, what I’ thinking about is something like this:

Bodybox ending at the shoulders level instead of the top of the head, it is a big change already but worth implementing in my opinion so:
1. Players won’t become unhittable
2. Players won’t be "granted" with bodyshots while shooting at the head level anymore.

#2 Updated by Mateos over 6 years ago

It is supposed to be an option isn’t it?

N!tmod is quite popular, even if the hitboxes are tinier. As well, there’s people who likes it, people doesn’t.

Not sure about setting the majority on a side or the other one Personally I see it as a extra challenge, be more accurate. At least you know that you hit what you shoot with such new hitboxes, while laggers can hit anything with the etmain one, even if they shoot totally left of right

#3 Updated by Dragonji over 6 years ago

Mateos wrote:

N!tmod is quite popular, even if the hitboxes are tinier. As well, there’s people who likes it, people doesn’t.

N!tmod by default uses the same big boxes as other mods and ETPro, the picture I posted is just an option which can be enabled but doesn’t have to. I know only 1 server which uses realistic N!tmod hitboxes and it is the server of N!tmod devs.

#4 Updated by Spyhawk over 6 years ago

Dragonji wrote:

Mateos wrote:

N!tmod is quite popular, even if the hitboxes are tinier. As well, there’s people who likes it, people doesn’t.

N!tmod by default uses the same big boxes as other mods and ETPro, the picture I posted is just an option which can be enabled but doesn’t have to. I know only 1 server which uses realistic N!tmod hitboxes and it is the server of N!tmod devs.

You can’t make everybody happy, so make this a cvar. A more modern, accurate hitbox system is definitely welcome, especially if the mod wants to become active on the pro-scene. Lag compensation will do the rest.

#5 Updated by Dragonji over 6 years ago

Spyhawk wrote:

Lag compensation will do the rest.

Well I don’t think so, as some mods use Neil Toronto’s Unlagged code and it still feels like players were unhittable with smaller hitboxes. The problem with this is spread, if you decide to make hitboxes much smaller, you should also decrease spread of weapons.

EDIT:
Damn, I mean spread of course, not recoil.

#6 Updated by Saukko over 6 years ago

I have always been against the ETPro hitboxes and I still won’t change my mind. Those hitboxes are the worst hitboxes with Jaymod. I think Jaymod might have new hitboxes but still has that awful hit detection as usually. When there is a standing player on ETPro and you shoot almost a meter to left or right you will still hit the enemy. So yeah I would rather be with the idea to make a CVAR out of this. Make one for accurate hitboxes and for the hitboxes like ETPro’s (bähhh).

-*S

#7 Updated by Dragonji over 6 years ago

All of the mods has got same hitboxes as ETPro by default (at least if talking about size), an only exception is NQ where bodybox doesn’t cover head

But yeah, why not to make tiny boxes as a cvar, I just think it is a waste of time, I doubt anyone will ever use such realistic CS-like ones.

#8 Updated by Jacker over 6 years ago

Just to point out that a big part of the hitbox system update is that the hitboxes would actually use the bone data, now the hitboxes are pretty much hard coded. Any one with a brain can see that its never a good idea to have hard coded vertex data when it should be read in and calculated properly per model and animation. When we move into a new model format that will be one thing i will be looking at.

#9 Updated by Dragonji over 6 years ago

Jacker wrote:

Just to point out that a big part of the hitbox system update is that the hitboxes would actually use the bone data, now the hitboxes are pretty much hard coded. Any one with a brain can see that its never a good idea to have hard coded vertex data when it should be read in and calculated properly per model and animation. When we move into a new model format that will be one thing i will be looking at.

That’s what N!tmod does AFAIK.

Anyway, I hope it will be cvar-controlled.

#10 Updated by Dragonji over 6 years ago

Jacker wrote:

The current system of hit detection is flawed and outdated in many ways, and as computers have gotten a lot quicker after the cold war the more complex calculation needed for detection is no longer a problem.

I think we should go with the common idea of bounding box which has the hit boxes inside of it.
We can use the animation skeleton to bind hit boxes more accurately to the model.

https://developer.valvesoftware.com/wiki/Hitbox

If you want such tiny hitboxes, that’s absolutely fine. But you need to redefine the spread in the guns otherwise the game will be totally different from the one we used to play for 10 years.

The thing with CS is it’s a slow game, strategic, and the game can be mastered with the aiming. In ET type game I don’t think there is any place for extremely small hitboxes combined with vanilla spread. CS spread and hitboxes work, because it’s so slow.

#11 Updated by Jacker over 6 years ago

The spread of the guns is already rather small for an fps game. Tbh the hitboxes aren’t so small as you make them to be. You do understand that while the hitboxes are fine for the most part while the model is standing but they are bugged in many other postures? Fixin them by hardcoding is just pointles when we could just use bone data. This is rather an issue like people wanting to play 2.55 because it has bugs.

#12 Updated by Spyhawk almost 6 years ago

Since ET:L still uses the terrible default etmain hitboxes, here is what I suggest for 2.71: implement the hardcoded "fixed" hitboxes from etpub, and do so by default (no cvar required) since these are more bugfix than a different hitboxes system. This would be only an intermediary step while the new hitboxes system is implemented later.

See the attached screenshots:

  • lower the standing player’s body hitbox to the shoulders.
  • lower the crouching player’s body hitbox to the shoulders.
  • lower the wounded player’s body hitbox to a reasonable height.
  • lower the prone player’s body hitbox to a reasonable height.

I’ll try to find a way to fix the swimming hitbox too (not fixed in etpub). Also, the headboxes seem curiously accurate, although the code from g_realHead has not been implemented yet. Did I miss something here?

#13 Updated by Mateos almost 6 years ago

According to the screenshots, the entire bottom of the legs is still "safe", isn’t it?

#14 Updated by Spyhawk almost 6 years ago

Yes. The etpub hitboxes aren’t great, but they are still an improvement over the current situation.

#15 Updated by Mateos almost 6 years ago

It is possible to implement a more accurate system atm, or would the extra required work be not worth it?

Just to know, I’m not against it as this: is the system far different from the ETPro one?

#16 Updated by Spyhawk almost 6 years ago

As I understand it, ETPro hitboxes are similar to the etpub hitboxes above but with some work done on the antilag side (most of which has been incorporated in et:l already). See http://enemyterritorytips.wordpress.com/2008/11/22/hitboxes-in-enemy-territory-et-pro-reyaip-report/.

NQ hitboxes are much more complex, as shown here: http://www.crossfire.nu/journals/view/id/125816
This might be a too big change for 2.71 already, and the work involved might be not worth it if we want to implement a better skeleton hitbox system later.

Edit: NQ g_debugHitboxes shows default squared hitboxes like etpub/etpro, so the change above would bring legacy mod more or less on par with etpub/etpro/nq.

#17 Updated by Dragonji almost 6 years ago

Spyhawk wrote:

NQ hitboxes are much more complex, as shown here: http://www.crossfire.nu/journals/view/id/125816

This is all Jaymod, Indloon posted pics from Jaymod docs.

This is NQ: http://imageshack.us/a/img69/2272/20110804220214goldrush2.jpg

#18 Updated by keMoN almost 6 years ago

I have to say, I’m not a fan of changing the wounded player hitbox.
When I’m medic and want to revive someone (frequently with enemies around) I want to make that quick.
With that tiny hitbox you are most likely to miss the wounded player and since the animation of the syringe is horribly slow it takes nearly up to 2 seconds to give it another chance.

The reviving process is using the hitboxes as-well, isn’t it?

#19 Updated by Spyhawk almost 6 years ago

Dragonji> Thx, so as I suspected it the NQ hitboxes aren’t as complicated (see my edit above).

KeMon> Unless you’re not even aiming at the wounded teammate, this change probably wouldn’t make any difference for a medic. But it would certainly make it simpler to gib wounded players for the enemy. Double edge sword, you know.

Edit: harder→simpler

#20 Updated by Spyhawk almost 6 years ago

  • Related to Bug #503: Fix dead player hitbox direction and bb height added

#21 Updated by IR4T4 almost 6 years ago

  • Target version changed from 2.75 to 2.71rc4

Spyhawk, can you tell us which hitbox issues are exactly fixed by your commits?

I’ve realized our debug vars g_debughitboxes and g_debugbullets show different hitboxes.
I think g_debugbullets still shows http://dev.etlegacy.com/attachments/download/215/standing_bug.jpg and g_debughitboxes shows http://dev.etlegacy.com/attachments/download/216/standing_fixed.jpg which is finally correct.

#22 Updated by Spyhawk almost 6 years ago

IR4T4> Previous commits should have changed the hitbox height of the standing, prone and dead positions (see screenshots above). The swimming box is unchanged and still buggy (similar to standing hbox), since I’ve not been able to have a consistent height in all situation in water. Overall, the current hitboxes should be similar to ETPub default.

I’m not sure why you get different debughitbox, might be related to antilag that I overlooked.

#23 Updated by IR4T4 almost 6 years ago

Well ... we have no g_hitboxes cvar like etpub and we should use the ClientHitboxMaxZ adjustment for bullet/weapon related traces only (no need to do for all). Adjustments have to be done before the trapTrace call and in case you set the r.maxs2 value on real game ents it should be undone after.

Edit: if you enable both cvars g_debugbullets 3 and g_debughitboxes 1 you’ll notice the difference in both debug views.

#24 Updated by Spyhawk over 5 years ago

  • Tracker changed from Task to Feature
  • Target version changed from 2.71rc4 to 2.78

#25 Updated by Spyhawk almost 5 years ago

#26 Updated by IR4T4 almost 5 years ago

  • Status changed from New to Feedback
  • Target version changed from 2.78 to 2.71
  • % Done changed from 0 to 80

#27 Updated by Saukko almost 5 years ago

Head hitbox seems very random to me. I can take a demo footage of it. I just doubt it would be spread causing such unreliability. I actually can finally finish my enemy with headshots when he is on the ground. Significant improvement to the better. Going to try a bit more later on to see some more.

-*S

#28 Updated by Spyhawk almost 5 years ago

Players now have unlimited helmets (helmet pops up, but another reappears on the model). The responsible commit seems to be 39d296a3c62e26d3b2576efec63c4db679a6260a

#29 Updated by Jacker almost 5 years ago

Spyhawk wrote:

Players now have unlimited helmets (helmet pops up, but another reappears on the model). The responsible commit seems to be 39d296a3c62e26d3b2576efec63c4db679a6260a

Fixed!

#30 Updated by Spyhawk almost 5 years ago

  • Related to Bug #735: Player model is shaking added

#31 Updated by IR4T4 almost 5 years ago

  • Target version changed from 2.71 to 2.78

#32 Updated by Jacker over 4 years ago

  • Status changed from Feedback to Fixed
  • % Done changed from 80 to 100

#33 Updated by IR4T4 over 4 years ago

  • Target version changed from 2.78 to 2.74

#34 Updated by Spyhawk about 3 years ago

  • Category changed from General to Mod generic
  • Status changed from Fixed to New
  • Assignee deleted (Jacker)
  • Target version changed from 2.74 to 2.76
  • % Done changed from 100 to 50

We should have another look at this, as Jaymod (now open sourced) implements hitboxes based on skeleton animation.

#35 Updated by IR4T4 almost 3 years ago

  • Target version changed from 2.76 to 2.78

#36 Updated by Spyhawk 10 months ago

  • Related to Feature #1174: Increase slightly the height of wounded player's hitbox added

#37 Updated by Spyhawk 10 months ago

Tracked in #1120.

  • fix debug hitbox code
  • add missing debug hitbox
  • adjust hitbox height to improve prediction (ZMax)
    ..

#38 Updated by Spyhawk 10 months ago

  • Target version changed from 2.78 to 2.77

Moving to 2.77 for the hitbox debug code.

#39 Updated by Spyhawk 9 months ago

  • Related to Bug #1209: Region hits don't take non headshot weapon into account added

#40 Updated by Spyhawk 7 months ago

  • Related to Bug #1120: cg_debugPlayerHitbox doesn't show all & correct hitboxes added

#41 Updated by Spyhawk 7 months ago

  • Target version changed from 2.77 to 2.78

Also available in: Atom PDF