Tremulous Forum

Mods => Modding Center => Topic started by: /dev/humancontroller on July 10, 2007, 05:21:22 am

Title: CalcMuzzlePoint()
Post by: /dev/humancontroller on July 10, 2007, 05:21:22 am
Code: [Select]
/*
===============
CalcMuzzlePoint

set muzzle location relative to pivoting eye
===============
*/
void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint )
{
  VectorCopy( ent->s.pos.trBase, muzzlePoint );
  muzzlePoint[ 2 ] += ent->client->ps.viewheight;
  VectorMA( muzzlePoint, 1, forward, muzzlePoint );
  VectorMA( muzzlePoint, 1, right, muzzlePoint );
  // snap to integer coordinates for more efficient network bandwidth usage
  SnapVector( muzzlePoint );
}

OK, here we have our little CalcMuzzlePoint() function.
My question is: Why does it do what it does?

This function is used in like every firing/attacking function for humans and aliens:
Code: [Select]
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );

CalcMuzzlePoint( ent, forward, right, up, muzzle );

As far as I understand AngleVectors(), it takes your basic viewing angles, and generates 3 vectors: forward: it points to the direction you're looking, right: points to the right of you, parallel with the ground you're standing on (note: wallwalkers), and up: upward, usually to the sky (note: wallwalkers). The vectors are guaranteed to be nomalized.

After that's done, we call CalcMuzzlePoint() to calculate muzzlePoint,
our result, where we're shooting/slashing/biting from.
We copy the center of our model, and then add the viewheight to get the position of our eye. (Wallwalkers must have 0 viewheigth, or this will not work.)

Next, what the hell are
Code: [Select]
VectorMA( muzzlePoint, 1, forward, muzzlePoint );
VectorMA( muzzlePoint, 1, right, muzzlePoint );
??2?!1!

What does Quake 3 use? Well, Quake 3 uses
Code: [Select]
VectorMA( muzzlePoint, 14, forward, muzzlePoint );
to locate the end of your gun. This is only relevant to the shotgun, so that the pellets don't start widely spread when shooting a wall from up close to it, and the rocket launcher (only a bit).

If this is an attempt to facilitate the rounding to integers in the SnapVector() function, it's seriously overlooked. right and forward may be all-positive, mixed or all-negative, depending on your looking directions.

The human model is 30x30x56 in size, the dretch is 30x30x30. Moving the muzzlePoint to the forward-right direction sqrt(2) far, is not noticable, and useless. I'd say use Q3 code (warning: alien attack range += 13) or nothing, to leave exact center coordinates.

THX

// dev
Title: CalcMuzzlePoint()
Post by: kevlarman on July 10, 2007, 05:26:34 am
the change was committed at rev 206 (which looks like it was from when tremulous was still on sourceforge's cvs), so i doubt anyone other than timbo knows the reasoning, and i doubt that timbo remembers what it was.
Title: CalcMuzzlePoint()
Post by: Warrior on July 10, 2007, 06:02:31 am
Quoted from http://dretchstorm.com/node/88
Quote
Submitted by Fallen- on Sat, 03/24/2007 - 16:15.
Groups: DSPro DSS
Class:  Dretch, Level 1

This is what an aimbot looks like:
http://misc.weedwhacker.org/misc/trem_aimbot.dm_69

from this post:
http://dretchstorm.com/node/354

recorded by WheedWhacker, from a guy called /dev/humancontroller. Is really obvious.
So, our friend interested in Tremulous source-code is a known aimbotter... apparently using the famous null's aimbot...
Well, in Linux we have /dev/null, so...
I don't care about it... lol
Title: CalcMuzzlePoint()
Post by: /dev/humancontroller on July 10, 2007, 06:14:48 am
Quote from: "Warrior"
Quoted from http://dretchstorm.com/node/88
Quote
Submitted by Fallen- on Sat, 03/24/2007 - 16:15.
Groups: DSPro DSS
Class:  Dretch, Level 1

This is what an aimbot looks like:
http://misc.weedwhacker.org/misc/trem_aimbot.dm_69

from this post:
http://dretchstorm.com/node/354

recorded by WheedWhacker, from a guy called /dev/humancontroller. Is really obvious.
So, our friend interested in Tremulous source-code is a known aimbotter... apparently using the famous null's aimbot...
Well, in Linux we have /dev/null, so...
I don't care about it... lol


If someone says that I'm using someone else's bot again, I'm gonna smash my 3rd motinor to the wall. (lost 2 already, got killed in trem and there was nothing to punch --so-> aimbot programming)

OK basically the reason I ask about this function, is that is fucks with my 100% headshots. I hope this isn't the reason why Timbo made it like this. (oh well, coming soon: trial and error aim correction, and g_unlagged detection)
Title: CalcMuzzlePoint()
Post by: Warrior on July 10, 2007, 06:25:35 am
"--so-> aimbot programming"
and
"oh well, coming soon: trial and error aim correction, and g_unlagged detection"

So, are you really null?
As I said, I don't care about who you are or if you use the aimbot or not...
Title: CalcMuzzlePoint()
Post by: /dev/humancontroller on July 10, 2007, 06:30:57 am
Quote from: "Warrior"
Well, in Linux we have /dev/null, so...
...
Quote from: "Warrior"
So, are you really null?
Quote from: "null"
I don't do Windows.

EDIT: null just did an OGC port AFAIK, it's not specialized for trem.
Title: CalcMuzzlePoint()
Post by: .f0rqu3 on July 10, 2007, 09:13:48 am
so aimbot is the only thing you guys can code...
Title: CalcMuzzlePoint()
Post by: benmachine on July 10, 2007, 12:36:57 pm
Why VectorMA is ever called with 1 as the second argument is totally beyond me. I guess it's Just One Of Those Things.
Title: CalcMuzzlePoint()
Post by: next_ghost on July 10, 2007, 04:13:26 pm
Looks like dretch fix to me. Dretch is way smaller than any Quake3 player avatar.
Title: CalcMuzzlePoint()
Post by: /dev/humancontroller on July 10, 2007, 06:32:23 pm
Quote from: "next_ghost"
Looks like dretch fix to me. Dretch is way smaller than any Quake3 player avatar.

No, the human_base and bsuit_bsuit are equally (width x thickness x height) 30x30x56 units, a dretch is 30x30x30 units in size. (Also, in tjw's mod, the dretch is afaik 24x24x24.)

Moving 1 unit to the right and forward is relatively small, so I think we can safely dismiss that it's some dretch fix.
Title: Re: CalcMuzzlePoint()
Post by: Risujin on July 10, 2007, 08:49:49 pm
Quote from: "/dev/humancontroller"
Code: [Select]

  VectorMA( muzzlePoint, 1, forward, muzzlePoint );
  VectorMA( muzzlePoint, 1, right, muzzlePoint );

Just a guess but, perhaps this is supposed to nudge the muzzle point to the right to align it with the right-handed gun visually?
Title: Re: CalcMuzzlePoint()
Post by: /dev/humancontroller on July 10, 2007, 08:58:09 pm
Quote from: "Risujin"
Quote from: "/dev/humancontroller"
Code: [Select]

  VectorMA( muzzlePoint, 1, forward, muzzlePoint );
  VectorMA( muzzlePoint, 1, right, muzzlePoint );

Just a guess but, perhaps this is supposed to nudge the muzzle point to the right to align it with the right-handed gun visually?

One more time, the human model is 30x30 units wide, before these functions, muzzlePoint is in your brains (+22 from the physical center of the model), moving 1 unit to the right will still be in your brains.
I don't know if aliens use guns. :wink:
Title: CalcMuzzlePoint()
Post by: kevlarman on July 12, 2007, 02:01:53 am
huh? who locked this?
edit: i should check my email more often, and you should post something when you lock, paradox.