Author Topic: AI-ing (.py files, coding, nose-orienting R+D, and help)  (Read 160206 times)

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17537
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #880 on: August 21, 2011, 08:50:17 AM »
i ai-ed a pushy bot with a snowplow that fails. it's wired correctly, it faces the right way, but this is what it does.

it drives toward me, backs up, then drives staright into a corner. help?

is the turning named "LeftRight"?
Does it have car steering (fail)? if so, put 'car': True in the binding line.

Offline Preytor_4

  • Ultra Heavyweight
  • Posts: 3089
  • Rep: 1
  • The estranged cousin of Click and FB.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #881 on: August 21, 2011, 10:35:12 AM »
Lower your turn speed, you probably have it too high..

What is it?

2.5

Offline JoeBlo

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #882 on: August 21, 2011, 10:36:43 AM »
hmm.. what is the turn value?

is the robot fast to drive too?

Offline Preytor_4

  • Ultra Heavyweight
  • Posts: 3089
  • Rep: 1
  • The estranged cousin of Click and FB.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #883 on: August 21, 2011, 10:40:59 AM »
hmm.. what is the turn value?
30
is the robot fast to drive too?
It has NPCF IIRC

Offline JoeBlo

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #884 on: August 21, 2011, 10:55:50 AM »
Bump it from 30 to 60 as it might be trying to correct itself all the time..

NPCF doesnt help much :P what weightclass?

For example.. a LW is going to be super fast so the turning need to be backed off.. try 60 first and see how you go.. 

Offline Preytor_4

  • Ultra Heavyweight
  • Posts: 3089
  • Rep: 1
  • The estranged cousin of Click and FB.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #885 on: August 21, 2011, 10:58:04 AM »
NPCF doesnt help much :P what weightclass?

It's a HW HS 4WD

EDIT: I switched it from 30 to 60, and it seems to turn even more left and right

Offline freeziez

  • Ultra Heavyweight
  • Posts: 4720
  • Rep: 2
  • He's Mr. White Christmas, he's Mr. Snow...
    • youtube.com/freeziezGTM
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #886 on: August 21, 2011, 12:28:37 PM »
What's the radius? That always seems to help me.
obligatory battlebots 5 comment

GTM Awards 2011

Best Tournament: B4ttlebots (freeziez)
Best New Tournament Host: freeziez
Most Suprising Tournament: B4ttlebots (freeziez)

Offline Preytor_4

  • Ultra Heavyweight
  • Posts: 3089
  • Rep: 1
  • The estranged cousin of Click and FB.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #887 on: August 21, 2011, 12:31:10 PM »
What's the radius? That always seems to help me.

I believe .5

Offline Wolfsbane

  • Heavyweight
  • Posts: 583
  • Rep: -5
  • Pokemens.
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
  • Skype: suicideladder
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #888 on: August 21, 2011, 01:47:36 PM »
what about my pushy bot that's scared to fight?
Man this needed an update. Anyways, Your local autistic idiot signing out.

Offline freeziez

  • Ultra Heavyweight
  • Posts: 4720
  • Rep: 2
  • He's Mr. White Christmas, he's Mr. Snow...
    • youtube.com/freeziezGTM
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #889 on: August 21, 2011, 02:08:58 PM »
What's the radius? That always seems to help me.

I believe .5

Try lowering it to .2
obligatory battlebots 5 comment

GTM Awards 2011

Best Tournament: B4ttlebots (freeziez)
Best New Tournament Host: freeziez
Most Suprising Tournament: B4ttlebots (freeziez)

Offline Preytor_4

  • Ultra Heavyweight
  • Posts: 3089
  • Rep: 1
  • The estranged cousin of Click and FB.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #890 on: August 21, 2011, 02:11:29 PM »

Offline Wolfsbane

  • Heavyweight
  • Posts: 583
  • Rep: -5
  • Pokemens.
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
  • Skype: suicideladder
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #891 on: August 21, 2011, 09:38:31 PM »
does anyone care about my scared snowplow pushing bot?
Man this needed an update. Anyways, Your local autistic idiot signing out.

Offline System32

  • *
  • Posts: 4663
  • Rep: 4
  • Reality
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #892 on: August 23, 2011, 01:41:30 PM »
I'm not the best coder, but I've come up with a basic AI for a rammer that leaps onto an opponent and then reverses.
Code: [Select]
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class Jumper(AI.SuperAI):
    "AI that leaps onto the opponent to attack, then backs up."
    name = "Jumper"
    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.zone1 = "Zone1"
        self.zone2 = "Zone2"
  self.zone3 = "leap"
  self.triggers1 = ["Leap"]
        self.botinzone1 = 0
        self.botinzone2 = 0
        self.backupFunction = self.Backup
        if 'zone1' in args: self.zone1 = args['zone1']
        if 'zone2' in args: self.zone2 = args['zone2']
 
  if 'leap2' in args: self.triggers1 = args['leap2']
        self.tactics.append(Tactics.Ram(self))
       
    def Activate(self, active):
        if active:
            if AI.SuperAI.debugging:
                self.debug = Gooey.Plain("watch", 0, 75, 100, 75)
                tbox = self.debug.addText("line0", 0, 0, 100, 15)
                tbox.setText("Throttle")
                tbox = self.debug.addText("line1", 0, 15, 100, 15)
                tbox.setText("Turning")
                tbox = self.debug.addText("line2", 0, 30, 100, 15)
                tbox.setText("")
                tbox = self.debug.addText("line3", 0, 45, 100, 15)
                tbox.setText("")
           
            self.RegisterSmartZone(self.zone1, 1)
            self.RegisterSmartZone(self.zone2, 2)
            self.RegisterSmartZone(self.zone3, 3)
        else:
            # get rid of reference to self
            self.backupFunction = None
           
        return AI.SuperAI.Activate(self, active)
    def Tick(self):
                       
        bReturn = AI.SuperAI.Tick(self)
       
        # call this now so it takes place after other driving commands
        if self.backupFunction: self.backupFunction(len(targets) > 0)
       
        return bReturn
       
    def Backup(self, bTarget):
        # back up if a bot gets under us (I ripped this from Arrowhead, sorry madiba)
        if self.botinzone1 == 1:
            self.Throttle(0)
            self.Input("Fire1", 0, 100)
        else:
            self.Input("Fire1", 0, 0)
           
        if self.botinzone2 == 1:
            self.Throttle(0)
            self.Input("Fire2", 0, 100)
        else:
            self.Input("Fire2", 0, 0)
    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Ram tactic and switch to Shove
        if id in self.weapons: self.weapons.remove(id)
       
        if not self.weapons:
            tactic = [x for x in self.tactics if x.name == "Ram"]
            if len(tactic) > 0:
                self.tactics.remove(tactic[0])
               
                self.tactics.append(Tactics.Shove(self))
                self.tactics.append(Tactics.Charge(self))
           
        return AI.SuperAI.LostComponent(self, id)
               
    def DebugString(self, id, string):
        if self.debug:
            if id == 0: self.debug.get("line0").setText(string)
            elif id == 1: self.debug.get("line1").setText(string)
            elif id == 2: self.debug.get("line2").setText(string)
            elif id == 3: self.debug.get("line3").setText(string)
    def SmartZoneEvent(self, direction, id, robot, chassis):
        if id == 1:
            if robot > 0:
                if direction == 1:
                    self.botinzone1 = 1
                if direction == -1:
                    self.botinzone1 = 0
        elif id == 2:
            if robot > 0:
                if direction == 1:
                    self.botinzone2 = 1
                if direction == -1:
                    self.botinzone2 = 0
        elif id == 3:
            if robot > 0:
                if direction == 1:
                    for trigger in self.triggers1: self.Input(trigger, 0, 1)
        return True
   
AI.register(Jumper)
I just need some help to see if it actually works.
Put this onto your signature if you were part of this crappy fad in '03.

Offline Squirrel_Monkey

  • Squirrel_Monkeyweight
  • *
  • Posts: 7587
  • Rep: 7
  • [Insert clever and witty comment here]
    • 0SquirrelMonkey0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #893 on: August 27, 2011, 12:37:23 PM »
DP: Something weird happening. I just AI'd a spinner and it won't spin! The control is named"Spin", it's a button, it works under human control. The bot uses Spinner.py and has a ranfe of 99. Yet the weapon doesn't spin under AI. I must be missing something obvious here.
Anyone got any help?
Better than GK since 2009.
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17537
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #894 on: August 27, 2011, 12:42:41 PM »
check for extra spaces, misspellings, maybe an undercase S (wiring is case-sensitive)

Offline freeziez

  • Ultra Heavyweight
  • Posts: 4720
  • Rep: 2
  • He's Mr. White Christmas, he's Mr. Snow...
    • youtube.com/freeziezGTM
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #895 on: August 27, 2011, 12:42:50 PM »
DP: Something weird happening. I just AI'd a spinner and it won't spin! The control is named"Spin", it's a button, it works under human control. The bot uses Spinner.py and has a ranfe of 99. Yet the weapon doesn't spin under AI. I must be missing something obvious here.
Anyone got any help?

Dunno.

1. Try a switch
2. Omni.py
3. Range? :P

All I can think of. :P
obligatory battlebots 5 comment

GTM Awards 2011

Best Tournament: B4ttlebots (freeziez)
Best New Tournament Host: freeziez
Most Suprising Tournament: B4ttlebots (freeziez)

Offline Squirrel_Monkey

  • Squirrel_Monkeyweight
  • *
  • Posts: 7587
  • Rep: 7
  • [Insert clever and witty comment here]
    • 0SquirrelMonkey0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #896 on: August 27, 2011, 12:44:11 PM »
I've tried Omni.py. No luck.
G.K. tried to AI it and had the same problem!
Better than GK since 2009.
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17537
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #897 on: August 27, 2011, 12:47:53 PM »
erm... is there a "weapons" line in the bindings?

did you try re-wiring the motor?

Offline Squirrel_Monkey

  • Squirrel_Monkeyweight
  • *
  • Posts: 7587
  • Rep: 7
  • [Insert clever and witty comment here]
    • 0SquirrelMonkey0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #898 on: August 27, 2011, 12:52:38 PM »
No weapons line, would that affect it?

And I'll try re-wiring the motor.
Better than GK since 2009.
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything

Offline nightcracker

  • *
  • Posts: 505
  • Rep: 7
  • Script kiddo
    • View Profile
    • NC Labs
    • Awards
  • Skype: orsonpeters
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #899 on: August 27, 2011, 03:09:14 PM »
I just added a folder called Team36 to Pys AI and added this to Teams.txt:

Code: [Select]
index 36
NC's creatures
"Crunch, gnaw and claw"
AI\oldies.bmp
Robots: 0
Robot In Event: -1
0
16
16
0
0
0
0
0
100000
true
0
false
0
-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
0
0

Next I put my TheTroll5.bot in that folder and renamed it to bot0.bot. It is wired with Forward, LeftRight, Fire and Srimech.

So far it all worked. But when I add my bindings.py entry it crashes:

Code: [Select]
list.append(("The Troll5","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'turn':30,'weapons':(1,2,3,4)}))
What am I doing wrong?