Announcement

Collapse
No announcement yet.

Net Position!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Net Position!

    I have modified version of the rocketlauncher, the Alt-Fire has an extra mode that shoots a grenade type projectile. Everything works fine, except for the position of the grenade in net games.

    The effects, timers all work perfectly, except when the grenade is lauched it's position is not relevant. It's a bit like the Flak shell, but bounces, and when i use any other projectile in place of mine, it works fine, so what is needed to update the correct postion of my grenade, since most projectiles work from the base class without any net stuff or replication.
    My grenade is simply a modified version of the assault grenade, not much changed except some physics.

    I can post code, but I can't seem to find out what the diffrence is when I only changed some hitwall() code..

    #2
    what is bNetTemporary for your proj?

    try it false?

    By default projectiles have bNetTemporary=True, which means the data channel between server and client is closed right after the projectile was replicated to the client.

    Comment


      #3
      I have tried the following:

      bNetTemporary=False
      RemoteRole=ROLE_SimulatedProxy
      bAlwaysRelevant=True
      bReplicateMovement=True
      bUpdateSimulatedPosition=True

      Nothing seems to work, all I have done is modifiy the hit wall function() and changed some speed and rotation variables in PostBeginPlay()

      All functions a simulated, just like the FlakShell and Grenade. :cry:

      As you can see by this vid, [http://members.optusnet.com.au/~nijelm/UT2004RT.WMV] the grenade stops too early, when I followed it going past me.

      Comment


        #4
        mm
        Its difficult to say without seeing the code for the projectile.

        Is it a subclass of grenade? flakshell etc......

        Is there a replication statement? esp. for the delaytimer

        If you don't want to post it here , you can pm me.

        Comment


          #5
          No problem.

          Code:
          //=============================================================================
          // Rocket Grenade.
          //=============================================================================
          class RocketGrenade extends Projectile;
          
          var float ExplodeTimer;
          var bool bCanHitOwner, bHitWater;
          var xEmitter Trail;
          var() float DampenFactor, DampenFactorParallel;
          var class<xEmitter> HitEffectClass;
          var float LastSparkTime;
          var bool bTimerSet;
          
          replication{
              reliable if (Role==ROLE_Authority)
          	   ExplodeTimer;
          }
          
          simulated function Destroyed(){
          	if ( Trail != None )
          		Trail.mRegen = false;
          	Super.Destroyed();
          }
          
          simulated function Timer(){Explode(Location, vect(0,0,1));}
          simulated function Landed( vector HitNormal ){HitWall( HitNormal, None );}
          simulated function ProcessTouch( actor Other, vector HitLocation ){
          	if ( !Other.bWorldGeometry && (Other != Instigator || bCanHitOwner) ){
          		Explode(HitLocation, Normal(HitLocation-Other.Location));
          	}
          }
          
          simulated function PostBeginPlay(){
          	local PlayerController PC;
          	local rotator RandRot;
          
          	Super.PostBeginPlay();
          	if ( Level.NetMode != NM_DedicatedServer){
          		PC = Level.GetLocalPlayerController();
          		if ( (PC.ViewTarget != None) && VSize(PC.ViewTarget.Location - Location) < 5500 )
          			Trail = Spawn(class'GrenadeSmokeTrail', self,, Location, Rotation);
          	}
          	if ( Role == ROLE_Authority ){
          		Velocity = Speed * Vector(Rotation);
          		RandRot.Pitch = FRand() * 1500 - 750;
          		RandRot.Yaw = FRand() * 1500 - 750;
          		RandRot.Roll = FRand() * 1500 - 750;
          		Velocity = Velocity >> RandRot;
          		RandSpin(25000);
          		bCanHitOwner = false;
          		if (Instigator.HeadVolume.bWaterVolume){
          			bHitWater = true;
          			Velocity = 0.6*Velocity;
          		}
          	}
          }
          
          simulated function PostNetBeginPlay(){
          	if ( Physics == PHYS_None ){
          		SetTimer(ExplodeTimer, false);
          		bTimerSet = true;
          	}
          }
          
          simulated function HitWall( vector HitNormal, actor Wall ){
          	local PlayerController PC;
          	if ( (Pawn(Wall) != None) || (GameObjective(Wall) != None) ){
          		Explode(Location, HitNormal);
          		return;
          	}
          	if (!bTimerSet){
          		SetTimer(ExplodeTimer, false);
          		bTimerSet = true;
          	}
          	bCanHitOwner = True;
          	Velocity = 0.74*(( Velocity dot HitNormal ) * HitNormal * (-1.25 - FRand()) + Velocity);
          	speed = VSize(Velocity);
          	if ( (Level.NetMode != NM_DedicatedServer) && (Speed > 150) )
          		PlaySound(ImpactSound, SLOT_Misc, FMax(0.5, speed/800) );
          	if ( Velocity.Z > 400 )
          		Velocity.Z = 0.5 * (400 + Velocity.Z);
          	else if ( speed < 20 ) {
          		bBounce = False;
          		PrePivot.Z = -1.5;
          		SetPhysics(PHYS_None);
          		DesiredRotation = Rotation;
          		//DesiredRotation.Roll = 0;
          		DesiredRotation.Pitch = 0;
          		bRotateToDesired=True;
          		SetRotation(DesiredRotation);
          		if ( Trail != None ) Trail.mRegen = false; // stop the emitter from regenerating
          	} else {
          		if ( !Level.bDropDetail && (Level.DetailMode != DM_Low) && (Level.TimeSeconds - LastSparkTime > 0.5) && EffectIsRelevant(Location,false) )   {
          			PC = Level.GetLocalPlayerController();
          			if ( (PC.ViewTarget != None) && VSize(PC.ViewTarget.Location - Location) < 6000 )
          				Spawn(HitEffectClass,,, Location, Rotator(HitNormal));
          		  LastSparkTime = Level.TimeSeconds;
          	   	}
          	}
          }
          
          simulated function Explode(vector HitLocation, vector HitNormal){
          	local PlayerController PC;
          	PlaySound(sound'WeaponSounds.BExplosion3',,2.5*TransientSoundVolume);
              	Spawn(class'NewExplosionA',,,HitLocation + HitNormal*20,rotator(HitNormal));
              	PC = Level.GetLocalPlayerController();
          	Spawn(class'ExplosionCrap',,, HitLocation + HitNormal*20, rotator(HitNormal));
          	BlowUp(HitLocation);
          	Destroy();
          }
          
          simulated function BlowUp(vector HitLocation){
          	DelayedHurtRadius(Damage,DamageRadius, MyDamageType, MomentumTransfer, HitLocation );
          	if ( Role == ROLE_Authority )
          		MakeNoise(1.0);
          }
          
          
          defaultproperties{
          	ExplodeTimer=3.200000
          	DampenFactor=0.5000000
          	DampenFactorParallel=0.850000
          	HitEffectClass=XEffects.WallSparks
          	Speed=1300.000000
          	MaxSpeed=1500.000000
          	TossZ=0.000000
          	Damage=95.000000
          	DamageRadius=150
          	CollisionRadius=7.000000
          	CollisionHeight=7.000000
          	MomentumTransfer=75000.000000
          	MyDamageType=DamTypexRocketGrenade
          	ImpactSound=ProceduralSound'WeaponSounds.PGrenFloor1.P1GrenFloor1'
          	ExplosionDecal=XEffects.RocketMark
          	DrawType=DT_Mesh'
          	Mesh=Mesh'PUT_Anims.RocketShell'
          	Physics=PHYS_Falling
          	DrawScale=0.85
          	AmbientGlow=100
          	ForceType=FT_Constant
          	FluidSurfaceShootStrengthMod=3.000000
          	bBounce=True
          	bFixedRotationDir=True
          //	bNetTemporary=False
          //	RemoteRole=ROLE_SimulatedProxy
          //	bAlwaysRelevant=True
          //	bReplicateMovement=True
          //	bUpdateSimulatedPosition=True
           }
          This is just a small modified grenade code. If i use the grenade instead of mine, it works, which means there must be something here.

          Comment


            #6
            Ok, I tried it and it seems to work ok.

            The only way I could break it, was to leave out the serverpackages line in the ini.

            Comment


              #7
              Well try recording a demo and play it back, the position of grenade is not correct, this also happens on listen server.

              Comment


                #8
                Ok, I'll post the vid tonight.

                Comment

                Working...
                X