Infinite problem - Hitboxes


(Jaquboss) #1

I have seen many examples showing that hitboxes are baddas things , so I have questions

  1. Is there any possibility to make model based collision?
    2)How can I see them in-game?
    3)How can I edit them , and add more parts ( legs , arms , helmet…)?
    Thanks for answers , HITBOXES are bad idea , but if there is nothing better…

(zinx) #2

Yes, but it’s not at all trivial – you have to sync the animations on the server/client, and write your own mdx/mdm code.

You can see the current hitboxes by adding some code to the server to send them
every frame (for a somewhat real view), or by making the client draw them based on the contents of entityState_t.solid, which holds the encoded bounding box used for client collisions. Check CG_ClipMoveToEntities for the exact encoding of entityState_t.solid.
This bounding box might not always match the server, though it should in most cases.

Edit the code, but it’s pretty convoluted IIRC. The current hit area code is in g_combat.c; look for IsArmShot(), etc.


(Jaquboss) #3

“Edit the code, but it’s pretty convoluted IIRC. The current hit area code is in g_combat.c; look for IsArmShot(), etc.”
Yes , but I want to add hitboxes not just code for it , thats easy BTW (isarmshot)…
“Yes, but it’s not at all trivial – you have to sync the animations on the server/client, and write your own mdx/mdm code.”
That´s what I want … With it ET will be much more realistic


(zinx) #4

Well, I may or may not get around to cleaning up the code in etpro and releasing; It has [disabled] support for using server-specified hit cylinders/boxes/spheres. It’s not per-poly, but I felt per-poly was a bit wasteful on CPU time, and not as flexible.

Of course, bani seems to not want this to happen :slight_smile:

In the mean time, you can try implementing it yourself, using the same unofficial specs I did - http://games.theteamkillers.net/rtcw/mdx/


(SCDS_reyalP) #5

You can see the current hitboxes by adding some code to the server to send them
every frame (for a somewhat real view), or by making the client draw them based on the contents of entityState_t.solid, which holds the encoded bounding box used for client collisions. Check CG_ClipMoveToEntities for the exact encoding of entityState_t.solid.
This bounding box might not always match the server, though it should in most cases.

[/quote]
What I used to show the hitboxes on the client is to predict them based on the view angles and stand/crouch/prone state. This is simple to do in vanilla ET. Just rip the code from buildhead, and the various places the z dimension is set. That gives you a pretty accurate representation of what the servers hitbox would be, if antilag/prediction were perfect. My code currently doesn’t deal with players on vehicles correctly, that seems to have a special case that I missed. I stole the actual drawing code from the unlagged2 source, found here http://www.planetquake.com/alternatefire/ (he uses the decoding method zinx suggests to get the dimensions)

Beware that g_smoothclients throws off model positions a lot, up to half a player width under normal circumstances. See http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=7890&postdays=0&postorder=asc&highlight=gsmoothclients&start=30

edit:
on vehicles as in actually mounted on the tank gun, not just riding :moo: