[Auto-Guiding Rockets] -- Beta 1

Discussions about Coding and Scripting

Re: Auto-Guiding Rockets -- [WIP]

Postby sektor2111 » Thu Sep 08, 2016 10:35 pm

How about talking to a tree ? It sounds more comfortable :ironic: .

Aside, ladies and gentlemen, mutator with rocket and some... other things looks operational somehow... rockets seems interested to avoid wall in small locations rather than tracking an enemy but at least we don't have a spammer console...
THIS is indeed something and it looks like the dog bow wow was helpful for managing unidentifiable errors - finally indentifiable.
So, Gustavo, you have finally done something operational - THIS is how things must be done... :agree1:
A few corrections for a later time are also good points.
Last edited by sektor2111 on Thu Sep 08, 2016 10:45 pm, edited 4 times in total.
Underground Location.
User avatar
sektor2111
Godlike
 
Posts: 2364
Joined: Sun May 09, 2010 6:15 pm
Location: Into personal private location.
Personal rank: 0.11

Re: Auto-Guiding Rockets -- [WIP]

Postby darksonny » Thu Sep 08, 2016 10:38 pm

sektor2111 wrote:How about talking to a tree ? It sounds more comfortable :ironic: .

I dont have a magic chrystal ball sorry, I cant read your mind
darksonny
Experienced
 
Posts: 89
Joined: Sat Sep 13, 2008 10:24 pm

Re: Auto-Guiding Rockets -- [WIP]

Postby Dr.Flay » Thu Sep 08, 2016 10:41 pm

Thank you sektor. Shame nobody flagged it, and shame that me and Geko missed it.
darksonny, clean your post because It is very offensive. Sektor was out of line, but there is no need to make things worse.
You already self-censored some words but not others. If you don't make it presentable, I will have to edit it.

Gustavo, pay attention to the chaos you create.
There is only so much damage limitation I am prepared to do. I clean up stupid mistakes by companies for money.
Here I do it because I am a mug with a bit of spare time.
User avatar
Dr.Flay
Site Staff
 
Posts: 2959
Joined: Thu Aug 04, 2011 9:26 pm
Location: Kernow, UK
Personal rank: Chaos Evangelist

Re: Auto-Guiding Rockets -- [WIP]

Postby darksonny » Thu Sep 08, 2016 10:45 pm

Dr.Flay wrote:Thank you sektor. Shame nobody flagged it, and shame that me and Geko missed it.
darksonny, clean your post because It is very offensive. Sektor was out of line, but there is no need to make things worse.
You already self-censored some words but not others. If you don't make it presentable, I will have to edit it.

Gustavo, pay attention to the chaos you create.
There is only so much damage limitation I am prepared to do. I clean up stupid mistakes by companies for money.
Here I do it because I am a mug with a bit of spare time.


This forum is your not mine, edit whatever you think its wrong, but please don't put in my mouth anything like that word "phaedophilia" that's your invention (or a lie). For the rest im fine with you decision.
darksonny
Experienced
 
Posts: 89
Joined: Sat Sep 13, 2008 10:24 pm

Re: Auto-Guiding Rockets -- [WIP]

Postby sektor2111 » Thu Sep 08, 2016 10:56 pm

I'm not sure if this is a chaos or a lesson in how to properly finish a mutator without mooing snippets. Without this circus for sure Gustavo would not finish his work letting another thread in air. So I'm really glad to see that finally he did something functional. It could be done without so much noise but probably this way was more helpful.
Updates are gonna be welcomed too if they are about to be real not only stories.
Underground Location.
User avatar
sektor2111
Godlike
 
Posts: 2364
Joined: Sun May 09, 2010 6:15 pm
Location: Into personal private location.
Personal rank: 0.11

Re: Auto-Guiding Rockets -- [WIP]

Postby Terraniux » Thu Sep 08, 2016 11:12 pm

This is thread makes me nothing but smile, that picture of Gustavo is so geniously funny :D :lol2:

I want something like that too :mrgreen:
Smeerkat's UED2.0 Tutorials : https://www.youtube.com/watch?v=YAZ9Wmg ... AEpNhw0gjE Must Watch!
Crystal Unreal - Terraniux's UT website & Portfolio
http://crystalunreal.com
https://www.youtube.com/user/Terraniux1 My Youtube channel
UT99 PAPERCRAFT: viewtopic.php?f=8&t=11679
User avatar
Terraniux
Experienced
 
Posts: 126
Joined: Mon Jan 05, 2009 8:08 pm
Personal rank: Normal

Re: Auto-Guiding Rockets -- [WIP]

Postby Gustavo6046 » Sat Sep 10, 2016 8:39 pm

sektor2111 wrote:rockets seems interested to avoid wall in small locations rather than tracking an enemy


So, if you find out some way of detecting the spaciest direction perpendicular to the wall then I'd be glad to code so that the rockets can avoid walls by turning by 90°! :D
I wish the Ballas were in UT99.
User avatar
Gustavo6046
Masterful
 
Posts: 602
Joined: Mon Jun 01, 2015 7:08 pm
Location: What if I say ""?
Personal rank: Unroyal?

Re: Auto-Guiding Rockets -- [WIP]

Postby sektor2111 » Sat Sep 10, 2016 9:13 pm

Let me introduce a bit of logic because you might follow secondary option as primary, which doesn't looks efficient either.

IF rocket has a direct sight with VICTIM tell me for which reason must be busy with wall, just TRACK the damn target. If target is suddenly hiding or was dodging away of sight, get busy to avoid A WALL because default seekingrocket is tracking target even if a wall will destroy it soon. THAT's the point, too busy with walls, almost ignoring pawns even if they are a perfect target.

These are only my thoughts for that after testing it around 3 minutes, then I have to mention spam. What if 6 players are firing 10 rockets ? This has to be reduced somehow because is not the best thing happening. Else I did not test it VIA net yet...
Underground Location.
User avatar
sektor2111
Godlike
 
Posts: 2364
Joined: Sun May 09, 2010 6:15 pm
Location: Into personal private location.
Personal rank: 0.11

Re: Auto-Guiding Rockets -- [WIP]

Postby Gustavo6046 » Sat Sep 10, 2016 9:42 pm

TRACK the damn target? Ok! :agree1: I just made a class (NavigationHelper):
Code: Select all
//=============================================================================
// NavigationHelper.
//=============================================================================
class NavigationHelper expands Pawn;

var   NavigationHelper   Next;
var   Actor            This;

simulated function LoadPathToward(Actor Target, NavigationHelper Root)
{
   local NavigationHelper NH;

   Next = Spawn(class'NavigationHelper');
   Next.This = FindPathToward(Target);

   Log(self@"spawned"@Next@"to find path towards"@Target);
   
   for ( NH = Root; NH != None; NH = NH.Next )
      if ( NH.This == Next.This && NH != Next )
         return;

   if ( Next.This == None || Next.This == Target )
   {
      Next.This = Target;
   
      return;
   }

   Log(self@"takes next path:"@Next@"with"@Next.This);
   Next.LoadPathToward(Target, Root);
}

simulated function Actor Helped()
{
   Next.Helped();
   Destroy();

   return Next.This;
}

Which the autorockets use to track their target:
Code: Select all
//=============================================================================
// AutoRocket.
//=============================================================================
class AutoRocket expands UT_SeekingRocket;

var()   float         SeekAcceleration, SeekSpeed, TargetAcquiringRadius, WallAvoidSpeed, WallPredictionFactor, WallAvoidSlowdown, ShootDensity, ShootDistance, ShootDistanceFactor, MinHomePathDistance;
var()   bool         bShootAtTarget, bIgnoreIgnorers;
var()   class<Actor>   ProjectileClass;
var      Pawn         User;
var      Actor         HomeTarget;
var      int            Slowdown;
var      bool         bFoundUser;

replication
{
   reliable if ( Role == ROLE_Authority )
      User,
      Slowdown,
      bFoundUser;
}

simulated event bool PercentChance(float Percentage)
{
   return FRand() * 100 < Percentage;
}

simulated event Vector EstimateLocation(Actor Other)
{
   return Other.Location + (Other.Velocity / VSize(Velocity)) * 0.5;
}

simulated event HomeAt(Actor Other)
{
   Velocity *= VSize(Velocity cross (EstimateLocation(Other) - Location)) * SeekAcceleration;
   Acceleration += (EstimateLocation(Other) - Location) * SeekSpeed;
   Acceleration /= 2;
}

simulated event Actor WillHitWall(optional out Vector Location, optional out Vector OutNormal)
{
   return Trace(Location, OutNormal, Self.Location + Velocity * WallPredictionFactor);
}

simulated event bool MonsterFriendly(ScriptedPawn Other)
{
   return Other != None && Other.AttitudeTo(User) == ATTITUDE_Friendly;
}

simulated event bool CheckSeekable(Pawn Other, Pawn FireAgent)
{
   return (
      Other != None
      &&
      (
         FireAgent == None
         ||
         (
            FireAgent != None
            && FastTrace(Other.Location)
            && Other != FireAgent
            && !Other.IsInState('Dying')
            &&
            (
               !MonsterFriendly(ScriptedPawn(Other))
               &&
               (
                  !Level.Game.bTeamGame
                  || Other.PlayerReplicationInfo == None
                  || FireAgent.PlayerReplicationInfo == None
                  || Other.PlayerReplicationInfo.Team != FireAgent.PlayerReplicationInfo.Team
               )
            )
         )
      )
   );
}

function BeginPlay()
{
   if ( Owner == None )
      return;

   if ( Pawn(Owner) != None )
      User = Pawn(Owner);

   else
      User = Pawn(Owner.Owner);

   if ( User == None )
      return;
}

simulated function SetTarget(Pawn Other)
{
   Seeking = Other;

   Log(self@"is now seeking after:"@Other);
}

simulated function bool CanHome()
{
   return Seeking != None && FastTrace(Seeking.Location) && ( Pawn(Seeking) == None || !Pawn(Seeking).IsInState('Dying') || ScriptedPawn(Seeking) == None || ( User != None && ScriptedPawn(Seeking).AttitudeTo(User) == ATTITUDE_Friendly ) );
}

simulated event Timer()
{
   local Pawn P;
   local Pawn Target;
   local ut_spriteSmokePuff B;
   local Actor A;
   local Vector WallNorm, WallLoc;

   SetRotation(Rotator(Velocity));

   A = WillHitWall(WallLoc, WallNorm);

   if ( A != None && !CanHome() && ( LevelInfo(A) != None || !CheckSeekable(Pawn(A), User) ) && ((VSize(WallLoc - Location) / VSize(Velocity * 0.1)) / 256) * 0.1 > (WallNorm dot Velocity) )
   {
      Velocity /= WallAvoidSlowdown;
      Slowdown *= WallAvoidSlowdown;
      Acceleration -= WallAvoidSpeed * 2 * (WallNorm dot Velocity) * WallNorm;
   }

   else if ( Slowdown > 1 )
   {
      Velocity *= Slowdown;
      Slowdown = 1;
   }

   else bFoundUser = True;

   if ( CanHome() )
   {
      if ( HomeTarget == None || ( VSize(HomeTarget.Location - Location) < MinHomePathDistance && HomeTarget != Seeking ) )
      {
         HomeTarget = Spawn(class'NavigationHelper');

         NavigationHelper(HomeTarget).LoadPathToward(Seeking, NavigationHelper(HomeTarget));
         HomeTarget = NavigationHelper(HomeTarget).Helped();

         return;
      }

      HomeAt(HomeTarget);

      if ( bShootAtTarget && PercentChance(ShootDensity) && ProjectileClass != None )
         Spawn(ProjectileClass, Owner, '', Location + Vector(Rotation) * (CollisionRadius + ShootDistance + ProjectileClass.default.CollisionRadius) * ShootDistanceFactor );
   }

   else if ( Seeking == None || !FastTrace(Seeking.Location) )
   {
      foreach RadiusActors(class'Pawn', P, TargetAcquiringRadius)
      {
         if ( Target == None || VSize(P.Location - Location) < VSize(Target.Location - Location) )
         {
            Target = P;

            if ( CheckSeekable(Target, User) )
               SetTarget(Target);
         }
      }
   }

   if ( (Level.bHighDetailMode && !Level.bDropDetail) || (FRand() < 0.5) )
   {
      b = Spawn(class'ut_SpriteSmokePuff');
      b.RemoteRole = ROLE_None;
   }
}

Unless I'm mistaken and there actually is a path-finding function in the NavigationPoint class. :P

Problem are the Ac. Nones in the NavigationHelper class (undoubtedly in that for loop... ;_;)...
I wish the Ballas were in UT99.
User avatar
Gustavo6046
Masterful
 
Posts: 602
Joined: Mon Jun 01, 2015 7:08 pm
Location: What if I say ""?
Personal rank: Unroyal?

Re: Auto-Guiding Rockets -- [WIP]

Postby Barbie » Sun Sep 11, 2016 1:18 am

Gustavo6046 wrote:Problem are the Ac. Nones in the NavigationHelper class (undoubtedly in that for loop
That definitely happens if the current NavigationHelper is the last in the chain - "Next" is None then. But your code accesses "Next.This" within the loop:
Code: Select all
if ( NH.This == Next.This && NH != Next )
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
 
Posts: 1072
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Auto-Guiding Rockets -- [WIP]

Postby Gustavo6046 » Sun Sep 11, 2016 1:38 am

Barbie wrote:
Gustavo6046 wrote:Problem are the Ac. Nones in the NavigationHelper class (undoubtedly in that for loop
That definitely happens if the current NavigationHelper is the last in the chain - "Next" is None then. But your code accesses "Next.This" within the loop:
Code: Select all
if ( NH.This == Next.This && NH != Next )


Oh, thanks! I have fixed them now:
Code: Select all
//=============================================================================
// NavigationHelper.
//=============================================================================
class NavigationHelper expands Pawn;

var   NavigationHelper   Next;
var   Actor            This;

simulated function LoadPathToward(Actor Target, optional NavigationHelper Root)
{
   local NavigationHelper NH;

   if ( Root == None )
      Root = self;

   Next = Spawn(class'NavigationHelper');

   Log(self@"spawned"@Next@"to find path towards"@Target);

   if ( FindPathToward(Target) == None )
   {
      This = Target;
      Next.This = This;
   }

   else
      Next.This = FindPathToward(Target);

   Log(Next@"found next:"@Next.This);
   
   if ( Next.This == Target )
   {
      Log(Next@"found path to target!");
   
      return;
   }

   for ( NH = Root; NH != None; NH = NH.Next )
      if ( NH.This != None && NH.This == Next.This && NH != Next )
      {
         Warn("Avoided recursion because of"@NH.This);

         return;
      }

   Log(self@"takes next path:"@Next@"with"@Next.This);
   Next.LoadPathToward(Target, Root);
}

simulated function Actor Helped(optional bool bThis)
{
   local Actor A, B;

   Log(self@"is self-desctructing");

   if ( Next != None )
      B = Next.Helped();

   else
      A = This;

   if ( bThis )
      A = This;

   else
      A = B;

   Destroy();

   Log("Final path component from"@self$":"@A);

   return A;
}


And also those darn rockets:
Code: Select all
//=============================================================================
// AutoRocket.
//=============================================================================
class AutoRocket expands UT_SeekingRocket;

var()   float         SeekAcceleration, SeekSpeed, TargetAcquiringRadius, WallAvoidSpeed, WallPredictionFactor, WallAvoidSlowdown, ShootDensity, ShootDistance, ShootDistanceFactor, MinHomePathDistance, MinWallAvoidNormal;
var()   bool         bShootAtTarget, bIgnoreIgnorers;
var()   class<Actor>   ProjectileClass;
var      Pawn         User;
var      Actor         HomeTarget;
var      int            Slowdown;
var      bool         bFoundUser;

replication
{
   reliable if ( Role == ROLE_Authority )
      User,
      Slowdown,
      bFoundUser;
}

simulated function float MinHomeNormal()
{
   if ( CanHome() || HomeTarget != None )
      return 0.5 * MinWallAvoidNormal;

   else
      return 0.1 * MinWallAvoidNormal;
}

simulated event bool PercentChance(float Percentage)
{
   return FRand() * 100 < Percentage;
}

simulated event Vector EstimateLocation(Actor Other)
{
   if ( Other == None )
      return Location;

   return Other.Location + (Other.Velocity / VSize(Velocity)) * 0.5;
}

simulated event HomeAt(Actor Other)
{
   Velocity *= VSize(Velocity cross (EstimateLocation(Other) - Location)) * SeekAcceleration;
   Acceleration += (EstimateLocation(Other) - Location) * SeekSpeed;
   Acceleration /= 2;
}

simulated event Actor WillHitWall(optional out Vector Location, optional out Vector OutNormal)
{
   return Trace(Location, OutNormal, Self.Location + Velocity * WallPredictionFactor);
}

simulated event bool MonsterFriendly(ScriptedPawn Other)
{
   return Other != None && Other.AttitudeTo(User) == ATTITUDE_Friendly;
}

simulated event bool CheckSeekable(Pawn Other, Pawn FireAgent)
{
   return (
      Other != None
      &&
      (
         FireAgent == None
         ||
         (
            FireAgent != None
            && FastTrace(Other.Location)
            && Other != FireAgent
            && !Other.IsInState('Dying')
            &&
            (
               !MonsterFriendly(ScriptedPawn(Other))
               &&
               (
                  !Level.Game.bTeamGame
                  || Other.PlayerReplicationInfo == None
                  || FireAgent.PlayerReplicationInfo == None
                  || Other.PlayerReplicationInfo.Team != FireAgent.PlayerReplicationInfo.Team
               )
            )
         )
      )
   );
}

function BeginPlay()
{
   if ( Owner == None )
      return;

   if ( Pawn(Owner) != None )
      User = Pawn(Owner);

   else
      User = Pawn(Owner.Owner);

   if ( User == None )
      return;
}

simulated function SetTarget(Pawn Other)
{
   Seeking = Other;

   Log(self@"is now seeking after:"@Other);
}

simulated function bool CanHome()
{
   return Seeking != None && ( Pawn(Seeking) == None || !Pawn(Seeking).IsInState('Dying') || ScriptedPawn(Seeking) == None || ( User != None && ScriptedPawn(Seeking).AttitudeTo(User) == ATTITUDE_Friendly ) );
}

simulated event Timer()
{
   local Pawn P;
   local Pawn Target;
   local ut_spriteSmokePuff B;
   local Actor A;
   local Vector WallNorm, WallLoc;

   SetRotation(Rotator(Velocity));

   A = WillHitWall(WallLoc, WallNorm);

   if ( A != None && ( LevelInfo(A) != None || !CheckSeekable(Pawn(A), User) ) && ((VSize(WallLoc - Location) / VSize(Velocity * 0.1)) / 256) * MinHomeNormal() > (WallNorm dot Velocity) )
   {
      Velocity /= WallAvoidSlowdown;
      Slowdown *= WallAvoidSlowdown;
      Acceleration -= WallAvoidSpeed * 2 * (WallNorm dot Velocity) * WallNorm;
   }

   else if ( Slowdown > 1 )
   {
      Velocity *= Slowdown;
      Slowdown = 1;
   }

   else bFoundUser = True;

   if ( CanHome() )
   {
      if ( ( !FastTrace(Seeking.Location) && ( HomeTarget == None || !FastTrace(HomeTarget.Location) ) ) || ( HomeTarget != None && VSize(HomeTarget.Location - Location) < MinHomePathDistance && HomeTarget != Seeking ) )
      {
         HomeTarget = Spawn(class'NavigationHelper');

         NavigationHelper(HomeTarget).LoadPathToward(Seeking);
         HomeTarget = NavigationHelper(HomeTarget).Helped(true);

         return;
      }

      else if ( FastTrace(Seeking.Location) )
         HomeTarget = Seeking;

      HomeAt(HomeTarget);

      if ( bShootAtTarget && PercentChance(ShootDensity) && ProjectileClass != None )
         Spawn(ProjectileClass, Owner, '', Location + Vector(Rotation) * (CollisionRadius + ShootDistance + ProjectileClass.default.CollisionRadius) * ShootDistanceFactor);
   }

   else
   {
      HomeTarget = None;

      foreach RadiusActors(class'Pawn', P, TargetAcquiringRadius)
      {
         if ( Target == None || VSize(P.Location - Location) < VSize(Target.Location - Location) )
         {
            Target = P;

            if ( CheckSeekable(Target, User) )
               SetTarget(Target);
         }
      }
   }

   if ( (Level.bHighDetailMode && !Level.bDropDetail) || (FRand() < 0.5) )
   {
      b = Spawn(class'ut_SpriteSmokePuff');
      b.RemoteRole = ROLE_None;
   }
}
I wish the Ballas were in UT99.
User avatar
Gustavo6046
Masterful
 
Posts: 602
Joined: Mon Jun 01, 2015 7:08 pm
Location: What if I say ""?
Personal rank: Unroyal?

Re: Auto-Guiding Rockets -- [WIP]

Postby SilverSound » Fri Sep 23, 2016 4:20 am

While you are at this you should try to make ghost rockets. Rockets that move slow but can go through objects. Just imagine the fun someone would have running away from that. Haha. Can make it a game type maybe even :wink:

I might even try it sometime.
"Woah what?! I wish I was recording that...."
User avatar
SilverSound
Skilled
 
Posts: 167
Joined: Fri Nov 06, 2015 10:12 am
Location: St. Cloud, Florida
Personal rank: Curious

Re: Auto-Guiding Rockets -- [WIP]

Postby Terraniux » Fri Sep 23, 2016 3:46 pm

SilverSound wrote:While you are at this you should try to make ghost rockets. Rockets that move slow but can go through objects. Just imagine the fun someone would have running away from that. Haha. Can make it a game type maybe even :wink:

I might even try it sometime.


Haha yeah. Then I happen to have the most genious map idea for that, 1 big maze, like the mazerunner movies. :lol:
I still have that on my list to make, regardless of gametype.
Smeerkat's UED2.0 Tutorials : https://www.youtube.com/watch?v=YAZ9Wmg ... AEpNhw0gjE Must Watch!
Crystal Unreal - Terraniux's UT website & Portfolio
http://crystalunreal.com
https://www.youtube.com/user/Terraniux1 My Youtube channel
UT99 PAPERCRAFT: viewtopic.php?f=8&t=11679
User avatar
Terraniux
Experienced
 
Posts: 126
Joined: Mon Jan 05, 2009 8:08 pm
Personal rank: Normal

Re: Auto-Guiding Rockets -- Are you satisfied now?

Postby PrinceOfFunky » Fri Sep 23, 2016 4:38 pm

sektor2111 wrote:This young "coder"

We all are "young coders", we never stop learning and you need to do errors to learn new stuff. Even you are like a "young coder", last thing you told me was that if something works it doesn't need any fix, but I think if something works you can still try to optimize the code for a better efficency and efficacy.
User avatar
PrinceOfFunky
Masterful
 
Posts: 579
Joined: Mon Aug 31, 2015 10:31 pm

Re: Auto-Guiding Rockets -- [WIP]

Postby sektor2111 » Fri Sep 23, 2016 6:42 pm

PrinceOfFunky wrote:We all are "young coders", we never stop learning and you need to do errors to learn new stuff
YES, me too, BUT I don't recall which forum I was spamming with USELESS Snipets which mainly doesn't work and are only confusing other young "coders" with None stuff. Learning codes is doable in private and testing them before yelling "awesome" as long as I don't recall stupid useless things to be "awesome". I thought that we clarified this problem since that dude (IpTables if I well recall ID) came for clarification toward a game-type "in work" which was looking the mostly coded by community (due to constant issues appearance) and not by the author who started it. All of us have to learn but without spamming and trying to annoy others, right ? I guess so.

Edit: BTW, because of bump here. This super duper rocket I don't see if has an update because is busy with walls rather than tracking a Pawn-Target but suddenly author went to another job leaving this to hang unfinished (as usual).
Underground Location.
User avatar
sektor2111
Godlike
 
Posts: 2364
Joined: Sun May 09, 2010 6:15 pm
Location: Into personal private location.
Personal rank: 0.11

PreviousNext

Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 1 guest