Announcement

Collapse
No announcement yet.

RTS prototype

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

    RTS prototype


    #2
    Nice work!

    Comment


      #3
      Nice, i would love to see the AI code

      Comment


        #4
        The path finding seems solid, good work.

        Comment


          #5
          Originally posted by Neongho View Post
          Nice, i would love to see the AI code

          Hey. I just followed the Mougli AI tutorial:

          Code:
          class CMAIController extends AIController;
          
          var Vector TargetLocation;
          var Vector TempDest;
          
          event PostBeginPlay()
          {
              super.PostBeginPlay();
           
              NavigationHandle = new(self) class'NavigationHandle';
          }
          
          event Possess(Pawn inPawn, bool bVehicleTransition)
          {
              super.Possess(inPawn, bVehicleTransition);
              Pawn.SetMovementPhysics();
          }
          
          function MoveToTarget(Vector v)
          {
          	TargetLocation = v;
          	TargetLocation.Z += Pawn.EyeHeight;
          	GoToState('MoveToLocation');
          }
          
          function float GetPathLength()
          {
          	//TODO
          	return 0;	
          }
          
          state MoveToLocation
          {	
          	function bool FindNavMeshPath()
              {
                  // Clear cache and constraints (ignore recycling for the moment)
                  NavigationHandle.PathConstraintList = none;
                  NavigationHandle.PathGoalList = none;
           
                  // Create constraints
                  class'NavMeshPath_Toward'.static.TowardPoint( NavigationHandle,TargetLocation );
                  class'NavMeshGoal_At'.static.AtLocation( NavigationHandle, TargetLocation,32 );
           
                  // Find path
                  return NavigationHandle.FindPath();
              }
          	
          Begin:
              if( NavigationHandle.PointReachable(TargetLocation) )
              {	
          		MoveToDirectNonPathPos(TargetLocation,None,32);
          		GotoState('Idle');
              }
          	else if( FindNavMeshPath() )
              {
                  NavigationHandle.SetFinalDestination(TargetLocation);
                  FlushPersistentDebugLines();
                  NavigationHandle.DrawPathCache(,TRUE);
            
                  // move to the first node on the path
                  if(NavigationHandle.GetNextMoveLocation( TempDest, Pawn.GetCollisionRadius()))
                  {
                  	DrawDebugLine(Pawn.Location,TempDest,255,0,0,true);
                      DrawDebugSphere(TempDest,16,20,255,0,0,true);
                      MoveTo( TempDest, None,32);
                  }
              }
              else
              {
                  GotoState('Idle');
              }
              goto 'Begin';
          
          }
          
          auto state Idle
          {
          Begin:
          }
          
          
          defaultproperties
          {
          	
          }

          Comment


            #6
            Any notes for selection system?

            Comment


              #7
              Originally posted by lentinant View Post
              Any notes for selection system?
              For single selection i just used a trace. For box selection i iterate through all pawns and project all bounding box points to the screen. Then i check if they are inside the box or not

              Comment


                #8
                Upload a video that all they are walking.

                Comment


                  #9
                  I am also working on something similar to this and yours look great, good job man.

                  Comment

                  Working...
                  X