Author Topic: Smart avoiding bahavior  (Read 3570 times)

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Smart avoiding bahavior
« on: September 09, 2014, 12:35:19 PM »
I'm trying to get a bot to swim the hell out of the way when it gets hit by hostile fire, but none of the combinations I try are effective. It either ends up making crazy turns are swim directly at the bot shooting at it. Any suggestions?

This is the best I've found so far but it's not good enough:

Code: [Select]
cond
 *.shflav -1 =
 *.shflav -6 = or
start
 *.aim *.shang .setaim store
 100 .up store
stop
The internet is corrupt and controlled by criminally minded people.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Re: Smart avoiding bahavior
« Reply #1 on: September 09, 2014, 05:57:23 PM »
I suppose this is the best there is:

 *.shang sub .setaim store
 *.maxvel .up store
The internet is corrupt and controlled by criminally minded people.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Smart avoiding bahavior
« Reply #2 on: September 09, 2014, 06:01:38 PM »
[Warning]Nooby qustion [/Warning]

Testlund, what does shang do?

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Smart avoiding bahavior
« Reply #3 on: September 09, 2014, 06:29:25 PM »
Oh, shot angle, got it.  8)

Sorry, I was cooking, wanted a quick anws.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Smart avoiding bahavior
« Reply #4 on: September 11, 2014, 11:46:13 PM »
I suppose this is the best there is:

 *.shang sub .setaim store
 *.maxvel .up store

You probably want to use *.shang - .setaim store
That is, sub is a binary command, so it's going to pull two values from teh stack.  If there's only one, it'll get a 0 value, and do what you expect, but if there's still a number on the stack for whatever reason it won't do what you expect.  The - command is a unary command, and negates the top value of the stack.

See the wiki page on negate for more (well, not really :)) details.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Re: Smart avoiding bahavior
« Reply #5 on: September 12, 2014, 05:09:04 AM »
I tried your suggestion but it doesn't seem to make any difference. The problem is that it will turn for each shot that hits it, but it doesn't go on to the next line that tells it to move away.

Here is one that works fairly well:

*.refxpos *.refypos angle sub .setaim store
 32 .up store

If I replace "sub" here with "-" I get a weird result where the bot just keeps switching back and forth if it sees something.

What makes it particularly problematic is that the dna is dependent on what other instructions are written and in what order they occur. Sometimes it just ignores instructions.
The internet is corrupt and controlled by criminally minded people.