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

Offline RedAce

  • Host of The Award Winning Deathmatch Series
  • *
  • Posts: 3966
  • Rep: 21
  • Yep, I'm that RedAce guy.
  • Awards BOTM Winner
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
  • Skype: redaceofsp4des
  • Discord: ThatRedAceGuy#3618
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1180 on: February 27, 2016, 04:18:42 PM »
I'm using omni.py and I want my bot to fire its weapon once inverted, in order to self-right. How would I do this?
Make a sepearte button labeled "Srimech" or use OmniS.py made by Joeblo.

Edit: 2slow.  D:

Offline Badger

  • Permanent Artifact
  • Giga Heavyweight
  • Posts: 6318
  • Rep: 3
  • I wish to be with my people
  • Awards BOTM Winner Donated money for site hosting 2019
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1181 on: February 27, 2016, 04:26:41 PM »
ty senpais
also lol at most toxic guy around calling others out on this sh**
Google Drive with my newer bots

Offline Silverfish

  • The Hardest Part of Ending is Starting Again
  • Super Heavyweight
  • Posts: 843
  • Rep: 3
  • Welcome to the quiet before the storm hits...
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1182 on: February 27, 2016, 04:33:30 PM »
If it's a popup, just change the variable RunUpsideDown to 1 and invertible to true (use popup.py). otherwise, i have no idea.
Tourney stuffs:

"We need a new way to defeat them... Something they haven't seen. Something... no one... has ever seen..."
-Gelorum, Acceleracers: Ignition

Youtube(cuz I can't use the normal link): https://www.youtube.com/channel/UCZ8zJZecbrpqiZK2eLnKLAA

Offline Calmarius

  • Antweight
  • Posts: 24
  • Rep: 0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1183 on: April 28, 2016, 04:24:23 PM »
Hi there,

I'm using popup.py for my popup bot (which I took from the starcore 4 ai pack, I don't know where can I find the latest version of it), and noticed that weapons fire only when the chassis of the opponent enters the smart zone but not when the chassis is inside it. This means if my popup bot shoves up the opponent before the razors retract, the opponent can sit on the top of my bot without firing the weapons.

Is it possible to fix this, somehow or do you know an update version of this file?

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 #1184 on: April 28, 2016, 05:39:10 PM »
So once a bot is on top of the popup it no longer fires? That's never happened with popup.py for me. What's your AI line?
Better than GK since 2009.
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything

Offline Calmarius

  • Antweight
  • Posts: 24
  • Rep: 0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1185 on: April 29, 2016, 12:55:34 AM »
By AI line you mean the line in the bindings.py?

    list.append(("BWOD Micro 2","Popup",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1,2,3)}))

To demonstrate it, add a huge smart zone for the weapon, when the opponent enters the smart zone, the weapons fire once, and won't fire again until the robot exits the smart zone an reenter again. So it looks like an event handling problem to me.


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 #1186 on: April 29, 2016, 02:30:46 AM »
I can't test for myself as I don't have access to a PC right now. Do you have the same issue with other ai's popups (for example those that came with the AI pack). If so it might be an old version of the AI. I'm sure popups work fine in BBEANS AI if you want to look at that.
Better than GK since 2009.
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1187 on: April 29, 2016, 06:31:36 PM »
Hi there,

I'm using popup.py for my popup bot (which I took from the starcore 4 ai pack, I don't know where can I find the latest version of it), and noticed that weapons fire only when the chassis of the opponent enters the smart zone but not when the chassis is inside it. This means if my popup bot shoves up the opponent before the razors retract, the opponent can sit on the top of my bot without firing the weapons.

Is it possible to fix this, somehow or do you know an update version of this file?
Let me have a look at the popup.py

Offline Naryar

  • Posts: 23283
  • Rep: 21
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1188 on: April 29, 2016, 06:41:40 PM »
Apanx :O

All hail !

Offline Calmarius

  • Antweight
  • Posts: 24
  • Rep: 0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1189 on: May 01, 2016, 12:58:54 PM »
Quote
Let me have a look at the popup.py

Here it is:

Code: [Select]
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class Popup(AI.SuperAI):
    "Like Omni, but fires its weapon only upon smartzone contact with an opponent's chassis."
    name = "Popup"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.zone1 = "weapon"
        self.triggers1 = ["Fire"]
        self.triggers2 = ["Srimech"]

        if 'zone' in args: self.zone = args['zone']
       
        if 'triggers' in args: self.triggers1 = args['triggers']
        if 'triggers' in args: self.triggers2 = args['triggers']

        self.tactics.append(Tactics.Engage(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)
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):
        # fire weapon

        targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
                and not plus.isDefeated(x.robot)]
                       
        bReturn = AI.SuperAI.Tick(self)
       
        return bReturn

    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.triggers2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0
               
    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Engage 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 == "Engage"]
            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 and self.weapons:
            if chassis:
                if direction == 1:
                    for trigger in self.triggers1: self.Input(trigger, 0, 1)
        return True
   
AI.register(Popup)

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1190 on: May 01, 2016, 01:21:21 PM »
This code is messed up. It contains superfluous stuff under Tick. You can't specify Weapon trigger separately from Srimech trigger. SmartZoneEvent is only triggered when something enters or leaves the Smartzone.
If you want to use it. Remove this part
Code: [Select]
    def SmartZoneEvent(self, direction, id, robot, chassis):
        if id == 1 and self.weapons:
            if chassis:
                if direction == 1:
                    for trigger in self.triggers1: self.Input(trigger, 0, 1)
        return True

Replace this part
Code: [Select]
    def Tick(self):
        # fire weapon


        targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
                and not plus.isDefeated(x.robot)]
                       
        bReturn = AI.SuperAI.Tick(self)
       
        return bReturn

With this
Code: [Select]
    def Tick(self):
        # fire weapon
        if self.weapons:
            targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
                and not plus.isDefeated(x.robot)]
                       
            if len(targets) > 0:             
                for trigger in self.triggers1: self.Input(trigger, 0, 1)
           
        return AI.SuperAI.Tick(self)

Also, separate Weapon triggers from Srimech triggers, Replace this:
Code: [Select]
        if 'triggers' in args: self.triggers2 = args['triggers']With
Code: [Select]
        if 'srimech' in args: self.triggers2 = args['srimech']
And make smartzone name changeable in bindings, replace this:
Code: [Select]
        if 'zone' in args: self.zone = args['zone']With
Code: [Select]
        if 'zone' in args: self.zone1 = args['zone']

Offline Calmarius

  • Antweight
  • Posts: 24
  • Rep: 0
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1191 on: May 03, 2016, 02:45:48 PM »
Ok made the changes except the SmartZoneEvent thing.

The goal of the popup.py is hitting other bot only when the chassis is within the smart zone. Do you have info what does the arguments for this SmartZoneEvent method mean?

Offline yugitom

  • *
  • Posts: 2378
  • Rep: 17
  • Google Garry's Wars
    • TheYuGiTom
    • View Profile
    • Awards
  • Skype: nanwiththeplan
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1192 on: May 03, 2016, 03:00:35 PM »
The goal of the popup.py is hitting other bot only when the chassis is within the smart zone.
Isn't that just Omni? Or, any other .py with smart zones involved?

Offline 090901

  • alcoholic in denial
  • *
  • Posts: 7006
  • Rep: 22
  • :mrgreen:
  • Awards Donated money for site hosting 2019 GTMCS2 Divison Winner GTMCS Division Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1193 on: May 03, 2016, 03:56:13 PM »
get the newest version of popup.py that is on the beetlebros site in the AI essentials pack. (link to it on the main page of gtm) and use that one and use a binding line with 'NoChassisTime"

Offline Badger

  • Permanent Artifact
  • Giga Heavyweight
  • Posts: 6318
  • Rep: 3
  • I wish to be with my people
  • Awards BOTM Winner Donated money for site hosting 2019
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1194 on: May 03, 2016, 04:16:35 PM »
What does nochassistime actually do?
also lol at most toxic guy around calling others out on this sh**
Google Drive with my newer bots

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1195 on: May 03, 2016, 05:31:18 PM »
What does nochassistime actually do?

It waits for specified time (1=0.5secs) before activating trigger if enemy robot is in zone, but the chassis is outside. If not specified, it is 1 sec .

Ok made the changes except the SmartZoneEvent thing.

The goal of the popup.py is hitting other bot only when the chassis is within the smart zone. Do you have info what does the arguments for this SmartZoneEvent method mean?
Yes but the code for SmartZoneEvent is messed up. It won't work. It is updated in the later pack. The changes in Tick won't do anything if SmartZoneEvent is not fixed.
direction, is 1 when stuff enters and -1 when stuff leaves zone
id, ID of smartzone, usually 1 for robots, unused in robot AI code, more important for arenas.
robot, ID of robot in zone
chassis, true if chassis of robot is in zone.

The newer Popup.py is better, but some of the old changes still apply if you want to separate Weapon from Srimech triggers.

Offline Badger

  • Permanent Artifact
  • Giga Heavyweight
  • Posts: 6318
  • Rep: 3
  • I wish to be with my people
  • Awards BOTM Winner Donated money for site hosting 2019
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1196 on: June 20, 2016, 05:10:23 AM »
Yo can someone explain the differences between all the meltybrain .pys? I remember one version I used seemed to try to flank the other bot, but the version I'm using ATM just charges straight at them.
also lol at most toxic guy around calling others out on this sh**
Google Drive with my newer bots

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1197 on: June 20, 2016, 09:58:39 AM »
Not sure which ones you mean.
Please link them and I'll check them out.

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 #1198 on: June 20, 2016, 10:01:33 AM »
Wow, apanx is here still.
I didn't know there was more than one meltybrain py to begin with.
Better than GK since 2009.
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything

Offline Badger

  • Permanent Artifact
  • Giga Heavyweight
  • Posts: 6318
  • Rep: 3
  • I wish to be with my people
  • Awards BOTM Winner Donated money for site hosting 2019
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1199 on: June 20, 2016, 10:05:22 AM »
https://gametechmods.com/uploads/files/8061FBS PYs.7z

Mainly wondering the differences between the first 3 and the analogue one.
also lol at most toxic guy around calling others out on this sh**
Google Drive with my newer bots