2024-03-28, 15:10 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
Pages: 1 2 [3]
  Print  
Author Topic: Modifying the shotgun  (Read 37238 times)
0 Members and 1 Guest are viewing this topic.
Phoenix
Bird of Fire
 

Team Member
Elite (7.5k+)
*********
Posts: 8805

WWW
« Reply #40 on: 2016-03-16, 00:27 »

You posted as I was working on my post.  See my previous post to this one.  Doom - Thumbs Up!
Logged


I fly into the night, on wings of fire burning bright...
Orbital-S2D
 

Shambler
*****
Posts: 100

RnR Boss

« Reply #41 on: 2016-03-16, 01:11 »

That is fantastic! its is working great!
Logged

GET THAT GUY GET THAT GUY, PEW PEW PEW!
Orbital-S2D
 

Shambler
*****
Posts: 100

RnR Boss

« Reply #42 on: 2016-03-25, 02:36 »

so I broke my shotgun :/

I merged the unlagged code into mine since unlagged is GPLed now...
I only had one hiccup in cg_draw.c and it threw me for a loop. I left an extra { in the code Slipgate - Tongue

anyway unlagged makes this change in the CG_ShotgunPattern
Code:
//unlagged - attack prediction
// made this non-static for access from cg_unlagged.c
void CG_ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, int otherEntNum ) {
int i;
float r, u;
vec3_t end;
vec3_t forward, right, up;

That's fine because when cg_delag is 0 the shotgun works great. but when cg_delag is 1
it doesn't draw a pattern at all.

I found this part in cg_unlagged.c
Code:
// was it a shotgun attack?
else if ( ent->weapon == WP_SHOTGUN ) {
// do we have it on for the shotgun?
if ( cg_delag.integer & 1 || cg_delag.integer & 4 ) {
int contents;
vec3_t endPoint, v;

// do everything like the server does

SnapVector( muzzlePoint );

VectorScale( forward, 4096, endPoint );
SnapVector( endPoint );

VectorSubtract( endPoint, muzzlePoint, v );
VectorNormalize( v );
VectorScale( v, 32, v );
VectorAdd( muzzlePoint, v, v );

if ( cgs.glconfig.hardwareType != GLHW_RAGEPRO ) {
// ragepro can't alpha fade, so don't even bother with smoke
vec3_t up;

contents = trap_CM_PointContents( muzzlePoint, 0 );
if ( !( contents & CONTENTS_WATER ) ) {
VectorSet( up, 0, 0, 8 );
CG_SmokePuff( v, up, 32, 1, 1, 1, 0.33f, 900, cg.time, 0, LEF_PUFF_DONT_SCALE, cgs.media.shotgunSmokePuffShader );
}
}

// do the shotgun pellets
CG_ShotgunPattern( muzzlePoint, endPoint, cg.oldTime % 256, cg.predictedPlayerState.clientNum );
//Com_Printf( "Predicted shotgun pattern\n" );
}
}


and at the bottom the //do the shotgun pellets doesn't match what is in the CG_ShotgunFire

Bleh
Logged

GET THAT GUY GET THAT GUY, PEW PEW PEW!
Phoenix
Bird of Fire
 

Team Member
Elite (7.5k+)
*********
Posts: 8805

WWW
« Reply #43 on: 2016-03-25, 22:01 »

I'm not familiar with unlagged's codebase.  I'm sure it's fixable... a pattern is just a pattern, but I'd need to see the unmodified CG shotgun stuff for unlagged to see what exactly they're doing in comparison to normal Q3.
Logged


I fly into the night, on wings of fire burning bright...
Orbital-S2D
 

Shambler
*****
Posts: 100

RnR Boss

« Reply #44 on: 2016-03-25, 22:10 »

Well after I posted this last night I looked into it a bit deeper and I think it has something to do with the game module. I ran out of time looking.

This is the source that I used.
http://ioquake3.org/files/unlagged-2.01-src-gpl.zip
Logged

GET THAT GUY GET THAT GUY, PEW PEW PEW!
Orbital-S2D
 

Shambler
*****
Posts: 100

RnR Boss

« Reply #45 on: 2016-03-25, 22:11 »

I meant to add that the cg_delag.integer takes over and then processes it in g/cg_unlagged.c
Logged

GET THAT GUY GET THAT GUY, PEW PEW PEW!
Orbital-S2D
 

Shambler
*****
Posts: 100

RnR Boss

« Reply #46 on: 2016-04-03, 14:35 »

Well I just noticed that the shotgun pattern is drawing. Just at random places depending o. Where you point the muzzle. Even behind you.
Another friend of mine said this
Code:
The only possible reason I can imagine is that at some point the unlagged code uses different data/function/calculation than the normal weapon code. Getting hits behind you indicates that the wrong vector component of the view angle is manipulated to calculate the position of hits. I see one diff between the relevant code of 'ShotgunPattern' in 'g_weapon.c' and that of 'CG_ShotgunPattern' in 'cg_weapon.c':

AngleVectors (origin2, forward, right, up);

In cgame you derive the angle vectors from data sent by the server. But unlagged manipulates the player state to do reconciliation


Looking into the anglevectors.
Logged

GET THAT GUY GET THAT GUY, PEW PEW PEW!
Phoenix
Bird of Fire
 

Team Member
Elite (7.5k+)
*********
Posts: 8805

WWW
« Reply #47 on: 2016-04-03, 21:32 »

I have the unlagged code, I've just been taking a break from programming for a bit.  I'll take a look into it tomorrow.
Logged


I fly into the night, on wings of fire burning bright...
Orbital-S2D
 

Shambler
*****
Posts: 100

RnR Boss

« Reply #48 on: 2016-04-03, 23:18 »

No rush!
Logged

GET THAT GUY GET THAT GUY, PEW PEW PEW!
Phoenix
Bird of Fire
 

Team Member
Elite (7.5k+)
*********
Posts: 8805

WWW
« Reply #49 on: 2016-04-06, 21:06 »

I took a look at it, and I see what's happening.  The unlagged code is sending the endpoint and reconciling a forward vector instead of using the angle vectors we were sending from the server.  Since we're predicting the shotgun blast, we'll want to look at the cg.predictedPlayerState to grab the view angles.  Assuming you are using the CG_ShotgunPattern we put together, make these changes in cg_unlagged.c to the CG_PredictWeaponEffects function where noted:

Code:
// was it a shotgun attack?
else if ( ent->weapon == WP_SHOTGUN ) {
// do we have it on for the shotgun?
if ( cg_delag.integer & 1 || cg_delag.integer & 4 ) {
int contents;
vec3_t endPoint, v;

// do everything like the server does

                       
SnapVector( muzzlePoint );

VectorScale( forward, 4096, endPoint );
SnapVector( endPoint );

VectorSubtract( endPoint, muzzlePoint, v );
VectorNormalize( v );
VectorScale( v, 32, v );
VectorAdd( muzzlePoint, v, v );

if ( cgs.glconfig.hardwareType != GLHW_RAGEPRO ) {
// ragepro can't alpha fade, so don't even bother with smoke
vec3_t up;

contents = trap_CM_PointContents( muzzlePoint, 0 );
if ( !( contents & CONTENTS_WATER ) ) {
VectorSet( up, 0, 0, 8 );
CG_SmokePuff( v, up, 32, 1, 1, 1, 0.33f, 900, cg.time, 0, LEF_PUFF_DONT_SCALE, cgs.media.shotgunSmokePuffShader );
}
}

// do the shotgun pellets
                        // Phoenix - use the predicted view angles with our new shotgunpattern.
CG_ShotgunPattern( muzzlePoint, cg.predictedPlayerState.viewangles, cg.oldTime % 256, cg.predictedPlayerState.clientNum );
//Com_Printf( "Predicted shotgun pattern\n" );
}
}

In theory that should fix the problem.
Logged


I fly into the night, on wings of fire burning bright...
Orbital-S2D
 

Shambler
*****
Posts: 100

RnR Boss

« Reply #50 on: 2016-04-08, 02:02 »

that seems to have worked well! thanks
Logged

GET THAT GUY GET THAT GUY, PEW PEW PEW!
Pages: 1 2 [3]
  Print  
 
Jump to: