Announcement

Collapse
No announcement yet.

Deploying Ghost Turret problem

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

  • replied
    Thanks Acecutter69. I'm so nearly finished with this. I've got a issue where I'm asking the server to check if it's ok to spawn the real turret. The problem with this is there is a noticeable delay from the client pressing the button, to it going off to the server, to do the check, then sending the response back to the client, THEN the client starts to swap animset/weapon etc. It's only about 1/2 a second, but it feels odd.

    I moved the check to the server in the first place because the Ghost turret is spawned on the server, and the client didn't have a reference to it.

    Would it be acceptable to get the client to work out whether the real turret can be spawned? And then tell the server to spawn it? If i did that, then as soon as the player presses the button, it can move on to swapping back to the correct animset/weapon etc without having to wait for a response from the server.

    Cheers

    Leave a comment:


  • replied
    yeah sounds like that could be the problem, my general rule for dealing with replication. If the server knows it then the server owns it. Basically, if the server needs to be aware of something and it is, then it will overwrite anything you do in the client, at least in the other clients, so always make sure things are in sync

    Leave a comment:


  • replied
    Ah i think I've worked it out! I'm not telling the server i want to go to the DeployTurret state

    Leave a comment:


  • replied
    Thanks again AceCutter69! I've managed to tweak my pathing extents and I'm now using ForEach TraceActors(), which is giving me results I can work with.

    Just one last hurdle to overcome. In my Player Controller class, when the pawn is in the deploy turret state(where he's just carrying it and walking around), on a Network game, after about a second, it leaves the State for no reason. I don't have to press anything and it exits the state. I've managed to track it down to the PlayerMove() function in my DeployTurret state, which calls ReplicateMove(), much like the way it's called by the PlayerMove() function in my PlayerWalking state. If i comment the ReplicateMove() function out, it doesn't leave the state.
    I've had a quick look through ReplicateMove() which calls ProcessMove () but I haven't been able to find anything that would tell it to leave the DeployTurret State and go to the PlayerMove State.

    Any suggestions how I can find out which function is telling it to leave my Turret Deploy state on network games please?

    Leave a comment:


  • replied
    thats why i suggested the 2 placement thing, trace works nicely on a straight line but can be weird with extends. my suggesting is use the double actor thing, just trace down from the test actor to get the base normal and align the actor

    Leave a comment:


  • replied
    Thanks Ace Cutter, this is all starting to come together nicely. I even have the turret snapping to the angles of the floor on slopes and stuff. Just one last thing, I'm still having trouble with the trace. I'm using a pathing extent, and it still doesn't realise it's intersecting other objects:

    Code:
    Simulated function bool CanSpawnHere()
    {
    local vector HitLocation, Normal, StartTrace, EndTrace; //create our variables for the trace
    local Vector PathingExtent;
    local Actor TraceHitActor;
    
    	PathingExtent.X = 45;
    	PathingExtent.Y = 45.f;
    	PathingExtent.Z = 44.f;
    
    	StartTrace = Location; 
    	EndTrace =  Location + (Vect(0.f, 0, -1.f) * 2); 
    	TraceHitActor = Trace(HitLocation,Normal,EndTrace,StartTrace,True,PathingExtent,); 
    
    if (TraceHitActor!=none)
         {
        
    
          if (TraceHitActor.isA('udnpawn')) 
          {
           return true;
          }
    
    	  else
    	  {
    		 DebugMessagePlayer("Something in the way"@TraceHitActor);
           return false;
    	  }
         }
    
    
    return true;
    
    }
    I've even doubled the size of the pathing extent. Should i try using a different type of trace function?

    Thanks

    Leave a comment:


  • replied
    the last variable of the spawn function is a bool to tell it to ignore placement collision when spawning. You can find the spawn function in the actor class if im not mistaken, if not its in the object class

    Leave a comment:


  • replied
    Also, when i do try to spawn the proper aiming and firing turret right next to my pawn, i get this error:

    [0031.80] DevSpawn: SpawnActor destroyed [SpaceMarine_Turret_4] after spawning because it was encroaching on another Actor

    How do i tell it to ignore that actor at spawn time?

    Thanks

    Leave a comment:


  • replied
    Thanks, so I've got the attach stuff working now by passing a reference of the pawn i want to attach to along to the turret and then telling the turret to setbase to a socket on the pawn.

    My next question is about the trace stuff. My problem is that as the pawn is holding the turret, the turret keeps saying that the pawn is a blocking actor. I've got around this by using a Isa(), and then telling it to ignore it, but then this doesn't work because it doesn't seem to take into account any other actors (like barrels) that would prevent it from spawning.

    Code:
    Simulated function bool CanSpawnHere()
    {
    local vector HitLocation, Normal, StartTrace, EndTrace; //create our variables for the trace
    local Vector PathingExtent;
    local Actor HitActor;
    
    	PathingExtent.X = 25;
    	PathingExtent.Y = 25.f;
    	PathingExtent.Z = 44.f;
    
    	StartTrace = Location; //set the startpoint for our trace to the current pawn's location.
    	EndTrace =  Location + (Vect(0.f, 1.f, 0.f) * 20); 
    	HitActor = Trace(HitLocation,Normal,EndTrace,StartTrace,True,PathingExtent,); 
    
     if (HitActor!=none)
         {
         DebugMessagePlayer("Something in the way"@HitActor);
    
          if (HitActor.isA('udnpawn')) 
          {
           return true;
          }
    
    	  else
    	  {
           return false;
    	  }
         }
    
    return true;
    
    }
    Any help please?

    thanks

    Leave a comment:


  • replied
    i dont think set base takes sockets, you need a bone name, what you can do though is place the turret on the socket, then attach it to the bone the socket is attached to

    Leave a comment:


  • replied
    Thanks AceCutter69, I might try that. But i'd really like to understand why SetBase() isn't working for me...

    Leave a comment:


  • replied
    K for this I used a double actor trick.

    The whole idea lies in using the setlocation function. Now you would have to have a "placer" actor. This one is responsable for showing the player the designated deploy area, the second one is an invisible sorta copy of it. Now you would on each frame try to set the location of the invisible one to the visible one, then evaluate the difference of the 2 locations, if its not 0, that means setlocation found a near spot it could use rather than the actual location, in this case you shouldnt deploy, on the other case then go ahead, just make sure to delete the checkers

    Leave a comment:


  • replied
    My turret class looks like this:

    Code:
    class SpaceMarine_Turret_Deployment extends UDNPawn HideCategories(AI,Camera,Debug,Pawn,Physics)
       placeable;
    
    var(Turret) SkeletalMeshComponent TurretMesh;         //SkelMeshComp for the turret
    var Material CanDeployMat, CanNotDeployMat;
    
    
    simulated function PostBeginPlay()
    {	
    	SetPhysics(PHYS_None);
    
    	//Turn off Collision
        SetCollision(false, false,true);
    }
    
    //We need to check if the turret can be spawned where its positioned.
    simulated function Tick(Float Delta)
    {
    
    if(CanSpawnHere())
    {
    Mesh.SetMaterial(0, CanDeployMat);
    }
    
    else
    {
    Mesh.SetMaterial(0, CanNotDeployMat);
    }
    
    }
    
    Simulated function bool CanSpawnHere()
    {
    local vector HitLocation, Normal, StartTrace, EndTrace; //create our variables for the trace
    local Vector PathingExtent;
    local Actor HitActor;
    
    	PathingExtent.X = 25;
    	PathingExtent.Y = 25.f;
    	PathingExtent.Z = 44.f;
    
    	StartTrace = Location; //set the startpoint for our trace to the current pawn's location.
    	EndTrace =  Location + (Vect(0.f, 1.f, 0.f) * 20); 
    	HitActor = Trace(HitLocation,Normal,EndTrace,StartTrace,True,PathingExtent,); //fire the trace! Also store the actor which was hit into 'HitActor'
    
    DrawDebugLine (StartTrace, EndTrace, 255, 0, 255, true);
    
     if (HitActor!=none)
         {
         //DebugMessagePlayer("Something in the way"@HitActor);
         return false;
         }
    
    return true;
    
    }
    
    
    
    defaultproperties
    {
      Begin Object Name=MyLightEnvironment
      End Object
      LightEnvironment=MyLightEnvironment
      Components.Add(MyLightEnvironment)
      
      Begin Object class=SkeletalMeshComponent name=SkelMeshComp0
            SkeletalMesh=SkeletalMesh'TurretContent.TurretActor'
            PhysicsAsset=PhysicsAsset'TurretContent.TurretMesh_Physics'
    		
    	Materials(0)=Material'TurretContent.Deployment_Material'
            LightEnvironment=MyLightEnvironment
       End Object
       Components.Add(SkelMeshComp0)
       TurretMesh=SkelMeshComp0
       Mesh=SkelMeshComp0
    
      Health=20
    
    Components.Remove(BackPackMeshComponent)
    Components.Remove(PawnSkeletalMeshComponent)
    
    Begin Object Name=CollisionCylinder
            CollisionRadius=25         
            CollisionHeight=44
            BlockNonZeroExtent=false
            BlockZeroExtent=false
            BlockActors=false
            CollideActors=false
        End Object
        CollisionComponent=CollisionCylinder
        Components.Add(CollisionCylinder)
    
    
     CanDeployMat=Material'TurretContent.Deployment_Material'
     CanNotDeployMat=Material'TurretContent.Deployment_Material_Red';
    
    bHardAttach=true
    //bNoEncroachCheck=true;
    
    RemoteRole=ROLE_SimulatedProxy
    bAlwaysRelevant=true
    
    }
    the idea being thats it's coloured transparent blue if it isn't encroaching on another actor and red if it is and therefore can't be deployed.
    Thanks

    Leave a comment:


  • started a topic Deploying Ghost Turret problem

    Deploying Ghost Turret problem

    When i press up on the controller i spawn a turret, but there is no indication where abouts, or how far away from the pawn it will spawn, it just appears. So i want to do what they do on many a game and have a semi transparent "Ghost" turret attached to the pawn, which shows the player where it is due to be deployed.

    I've set up the ghost turret class, and in my Player controller I'm spawning it like this:

    Code:
    exec function SpawnGhostTurret ()
    {
    myPawn = UDNPawn(Pawn);	
    
    TurretDeployment = Spawn(TurretDeploymentClass,self,,myPawn.Location, myPawn.Rotation);
    
    if(TurretDeployment!=none)
    {
    TurretDeployment.SetBase(Mypawn,, MyPawn.Mesh,MyPawn.PlayerIdentifierSocket);
    }
    
    }
    The problem is the turret isn't attaching to my pawn, it kinda bounces off my pawb and stays there. In the turret class I've got bHardAttach set to true.
    Any ideas what I'm doing wrong please?

    Thanks
Working...
X