An Explanation of Hitzones

Discussion for GU League Players
Post Reply
snick
Private First Class
Private First Class
Posts: 95
Joined: Thu Jun 02, 2005 2:26 pm

An Explanation of Hitzones

Post by snick »

User avatar
Destroyer
Private First Class
Private First Class
Posts: 284
Joined: Sun Sep 25, 2005 3:40 pm
Location: Germany
Contact:

Re: An Explanation of Hitzones

Post by Destroyer »

Hm nice one snick!
Image
snick
Private First Class
Private First Class
Posts: 95
Joined: Thu Jun 02, 2005 2:26 pm

Re: An Explanation of Hitzones

Post by snick »

Destroyer wrote:Hm nice one snick!
Thanks. A couple of things to add. Firstly, I've been asked to share my code for
displaying the hitzone discs[1] in bzflag. After all, squares are instrinsically bad
(they have pointy bits that could take an eye out) and circles are nice[2]. The
code follows and I've attached a patch file. Here's what it looks like in BZFlag:

Image

Original src/bzflag/RadarRenderer.cxx snippet:

Code: Select all

  // draw the tank
  if ((player == NULL) || !useTankDimensions) {
    // align to the screen axes
    glRotatef(float(myAngle * 180.0 / M_PI), 0.0f, 0.0f, 1.0f);
    glRectf(-size, -size, +size, +size);
  }
Replacement code:

Code: Select all

  // draw the tank
  if ((player == NULL) || !useTankDimensions) {
    // align to the screen axes
    // glRotatef(float(myAngle * 180.0 / M_PI), 0.0f, 0.0f, 1.0f);
    // glRectf(-size, -size, +size, +size);

    float hitzone = 4.245f;

    glBegin(GL_TRIANGLES);
    for (float a = 0.0f; a < 6.29f; a += 0.262) {
        glVertex2f(0.0f, 0.0f);
        glVertex2f(hitzone * cosf(a), hitzone * sinf(a));
        glVertex2f(hitzone * cosf(a + 0.262), hitzone * sinf(a + 0.262));
    }
    glEnd();
  }
Patch file:

[The extension diff has been deactivated and can no longer be displayed.]

Warnings: It's terribly unoptimized. Please use responsibly (not in matches etc.).

Secondly, having spoken to a couple of people, it appears that my second diagram
may have caused confusion. Let me say now that the right angle vertex does not touch
the sphere surface, hard though it is to see that in the picture.

[1] It's actually the hitzone slice S that is shown. Please see page 2 referred to above.
[2] Vicious circles excepted.
dexter
Private First Class
Private First Class
Posts: 212
Joined: Sun Apr 30, 2006 7:36 am
Location: Germany :o)

Re: An Explanation of Hitzones

Post by dexter »

Nice of you to share that with us. I compiled a client with it and my tank did not really show up as a circle on the radar. Somehow a cross between circle and square, I have to play with it some more and see what's up. Anyways, good job. :)
snick
Private First Class
Private First Class
Posts: 95
Joined: Thu Jun 02, 2005 2:26 pm

Re: An Explanation of Hitzones

Post by snick »

dexter wrote:Nice of you to share that with us. I compiled a client with it and my tank did not really show up as a circle on the radar. Somehow a cross between circle and square, I have to play with it some more and see what's up. Anyways, good job. :)
You may be seeing the height box. Try jumping and see if the box gets bigger.
ts
Dev Monkey
Dev Monkey
Posts: 970
Joined: Fri Jan 14, 2005 6:26 pm

Re: An Explanation of Hitzones

Post by ts »

There were already questions whether it is allowed in GU league matches. The answer is no and the reason is that any patch not listed in our whitelist is not allowed.
GU league: http://www.guleague.org/
An introduction to TCP: http://www.lafkon.net/tc/
snick
Private First Class
Private First Class
Posts: 95
Joined: Thu Jun 02, 2005 2:26 pm

Re: An Explanation of Hitzones

Post by snick »

Please note: I have found a bug that can cause the effective hitzone
to vary (depends on framerate, affects hittability[1]). Further details:

http://my.bzflag.org/bb/viewtopic.php?f=32&t=13649

Regards,

Snick.

[1] Presumably not in the OED :)
Post Reply