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

Offline Clickbeetle

  • *
  • Posts: 3375
  • Rep: 21
  • In Soviet Russia, bugs stomp YOU!
  • Awards BOTM Winner
    • View Profile
    • Beetle Bros site
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #120 on: July 11, 2009, 07:51:37 PM »
Try this?  There were some random spaces in your bindings and you don't need range on a poker...

Code: [Select]
   list.append(("Stinger","Omni",{'invertible':True,'nose':math.pi,'topspeed':99,'throttle':130,'turnspeed':2.5,'turn':60,'radius':0.3,'weapons':(1,2,3,4)}))
Also, check for spaces after "Fire" and "weapon" for the control and smart zone names.

To lack feeling is to be dead, but to act on every feeling is to be a child.
-Brandon Sanderson, The Way of Kings

Offline Sage

  • *
  • Posts: 6182
  • Rep: 11
  • RA2 Wizard & GTM's Favorite Stock Builder 2015
  • Awards Sage's Favorite BOTM Winner
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #121 on: July 12, 2009, 12:04:02 AM »
Quote from: Clickbeetle;50655
Try this?  There were some random spaces in your bindings and you don't need range on a poker...

Code: [Select]
   list.append(("Stinger","Omni",{'invertible':True,'nose':math.pi,'topspeed':99,'throttle':130,'turnspeed':2.5,'turn':60,'radius':0.3,'weapons':(1,2,3,4)}))Also, check for spaces after "Fire" and "weapon" for the control and smart zone names.


There was ONE extra space after the weapon. ONE. thanks click.
You got my vote for RA2 Wizard. Always and forever.

Offline Reier

  • Rieir
  • *
  • Posts: 8579
  • Rep: 8
  • I GOT 3RD IN RAW1
    • https://www.youtube.com/c
  • Awards old BOTM Winner
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #122 on: September 15, 2009, 05:08:17 PM »
Bump, but I need help.



What would be a good AI for that? It needs to Ram/push and blast with the flamethrowers. Any help?
ALERT- Another WS coming up...
voted best bot builder two times and counting babayy. the best ra2 builder who has never won an actual tournament match
ReiAI pack for Ironforge
My drawings, and my webcomics
Why online PVP will save RA2
The problem with competitive IRL in RA2
I'm fine with hugging reier

Offline roboman2444

  • Ultra Heavyweight
  • Posts: 1212
  • Rep: 0
  • Linux, Nexuiz, Quake, and Darkplaces lover.
    • View Profile
    • http://www.freewebs.com/teamrckm
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #123 on: September 15, 2009, 05:15:13 PM »
pretty good but i dont think u need the wedge.
it would probably just get in the way.
edit: for the ai something like a hammer / stock spinner would work well. go straight towards the other bots and when close enough turn on wep.
you should talk to someone more experienced though.
Real life robotics team www.teamrckm.tk
Real life game studio www.v2games.tk


Offline Reier

  • Rieir
  • *
  • Posts: 8579
  • Rep: 8
  • I GOT 3RD IN RAW1
    • https://www.youtube.com/c
  • Awards old BOTM Winner
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #124 on: September 15, 2009, 05:15:52 PM »
I need help with the AI, not the bot. Besides, I made it months ago and it's been updated.
ALERT- Another WS coming up...
voted best bot builder two times and counting babayy. the best ra2 builder who has never won an actual tournament match
ReiAI pack for Ironforge
My drawings, and my webcomics
Why online PVP will save RA2
The problem with competitive IRL in RA2
I'm fine with hugging reier

Offline roboman2444

  • Ultra Heavyweight
  • Posts: 1212
  • Rep: 0
  • Linux, Nexuiz, Quake, and Darkplaces lover.
    • View Profile
    • http://www.freewebs.com/teamrckm
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #125 on: September 15, 2009, 05:29:44 PM »
thats why i edited
Real life robotics team www.teamrckm.tk
Real life game studio www.v2games.tk


Offline Reier

  • Rieir
  • *
  • Posts: 8579
  • Rep: 8
  • I GOT 3RD IN RAW1
    • https://www.youtube.com/c
  • Awards old BOTM Winner
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #126 on: September 15, 2009, 05:36:21 PM »
That didn't help at all.
ALERT- Another WS coming up...
voted best bot builder two times and counting babayy. the best ra2 builder who has never won an actual tournament match
ReiAI pack for Ironforge
My drawings, and my webcomics
Why online PVP will save RA2
The problem with competitive IRL in RA2
I'm fine with hugging reier

Offline roboman2444

  • Ultra Heavyweight
  • Posts: 1212
  • Rep: 0
  • Linux, Nexuiz, Quake, and Darkplaces lover.
    • View Profile
    • http://www.freewebs.com/teamrckm
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #127 on: September 15, 2009, 05:39:37 PM »
hmmmm i think it did.
oh well no flame wars
Real life robotics team www.teamrckm.tk
Real life game studio www.v2games.tk


Offline philetbabe

  • *
  • Posts: 497
  • Rep: 2
  • Drop D
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #128 on: September 16, 2009, 02:27:32 AM »
Quote from: Reier;66326
That didn't help at all.

there is an AI called omniRam that works like a rammer but also support SZ (called weapon) and 'Fire' command.
this AI should be delivered in that AI chart .zip.
 
there is also a AI called RangeOmni that uses the 'engage' tactic (most common one) but that call the 'fire' command when bot is heading ennemy and ennemy is in a given range (no use of SZ there).
« Last Edit: October 13, 2009, 11:34:26 PM by Madiaba »

Offline Naryar

  • Posts: 23283
  • Rep: 21
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
AI-ing (.py files, coding, R+D, and help)
« Reply #129 on: September 16, 2009, 03:11:36 AM »
Just wire the flamethrower to the drive (ForwardBack command), so it can use the flamethrower glitch (the flamethrower does not loses strength if it is wired on an analog)

And Omni.py is better for that IMO because a flamethrower bot works better when pinning.

See Red Drake 4.

Edit: However, an AI with a 'Spin' command using an analog control (rather than a button or switch like in the normal 'Spin' command) would be good.

Online apanx

AI-ing (.py files, coding, R+D, and help)
« Reply #130 on: September 16, 2009, 04:20:57 AM »
From chopper.py

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.triggers: [B][COLOR=Blue]self.Input(trigger, 0, 1)[/COLOR][/B]
           
        return AI.SuperAI.Tick(self)


Change it to

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.triggers: [B][COLOR=#0000ff]self.Input(trigger, 0, 100)[/COLOR][/B]
           
        return AI.SuperAI.Tick(self)


Wire positive analog control named Fire to flame thrower.

Bot flames when enemy is in smartzone named weapon
« Last Edit: September 16, 2009, 10:40:43 AM by apanx »

Offline Madiaba

AI-ing (.py files, coding, R+D, and help)
« Reply #131 on: September 16, 2009, 06:50:59 AM »
In case you get lost easily in the coding in [code] tags because it doesn't show the font formatting well, Apanx is showing how to change the trigger to actuate an analog control, where there was a switch. Switches are either 'off/on' i.e. "0/1", (nothing between). But with the analog it is variable, and so they changed the parameter range to between '0-100' for variable input, i.e. '50' would be 1/2 power.
So he changed,
for trigger in self.triggers: self.Input(trigger, 0, 1)
.........to,
for trigger in self.triggers: self.Input(trigger, 0, 100)
.
On a switch, '1' would be on 100% input, but on an analog it would be only 1% input.
 
(Always thankful for your help and input, Apanx.)
.
« Last Edit: September 16, 2009, 07:15:59 AM by Madiaba »
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Scrap Daddy

AI-ing (.py files, coding, R+D, and help)
« Reply #132 on: September 20, 2009, 08:47:36 PM »
My AIed bots refuse to move. They fire their weapons and stuff but just don't move. Here's a pic of my controls and my bindings. whats up?


   
Code: [Select]
list.append(("Epidemic","Poker",{'invertible':True,'radius':0.5,'topspeed':99,'throttle':130,'weapons':(1,2,3,4,5)}))

Offline infiniteinertia

  • *
  • Posts: 1853
  • Rep: 6
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #133 on: September 20, 2009, 08:57:01 PM »
Forward
#MakeStockGreatAgain


#BANtheHS The Movement

Offline Scrap Daddy

AI-ing (.py files, coding, R+D, and help)
« Reply #134 on: September 20, 2009, 09:12:27 PM »
GRAAGAHGHGSA

maybe i shouldnt have tried to ai these last night ;P

Offline Naryar

  • Posts: 23283
  • Rep: 21
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
AI-ing (.py files, coding, R+D, and help)
« Reply #135 on: September 20, 2009, 10:04:20 PM »
Quote from: Scrap Daddy;67563
GRAAGAHGHGSA


LOL

Offline infiniteinertia

  • *
  • Posts: 1853
  • Rep: 6
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #136 on: September 21, 2009, 04:34:30 PM »
Quote from: Scrap Daddy;67563
GRAAGAHGHGSA

maybe i shouldnt have tried to ai these last night ;P


I feel ya :P
#MakeStockGreatAgain


#BANtheHS The Movement

Offline 123savethewhales

  • *
  • Posts: 2923
  • Rep: 30
  • Friendship is Magic
  • Awards BOTM Winner
    • View Profile
    • Awards
AI-ing (.py files, coding, R+D, and help)
« Reply #137 on: September 25, 2009, 02:20:21 AM »
Humm, I took out all the conditions and simply put a permanent if statement for fire, but even so the weapon still shuts off from time to time (example: when the enemy's timer goes on). How come?

Setting analog to 999 is way fun and solve all the problems (yeah flames shooting half screen), but that's sorta like cheating.

Edit: I decide to post the final version of the AI here.  Thanks for all the help.

Quote
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class Omni2(AI.SuperAI):
    "Omni2 strategy"
    name = "Omni2"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.zone = "weapon"
        self.triggers = ["Fire"]
       
        if 'triggers' in args: self.triggers = 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.zone, 1)
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):

        self.Input("Spin", 0, 100)

        return AI.SuperAI.Tick(self)

    def InvertHandler(self):
        # fire weapon once per second (until we're upright!)
        while 1:
            for trigger in self.triggers: 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:
            self.RemoveTactic("Engage")
           
               
            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)
   
AI.register(Omni2)

I never thought making the AI hold one button would be so hard.

There's also the option of making a custom component that is exactly the same as the original flamethrower but doesn't use any gas.  So long as we maintain the same design as the non cheat part (retaining the same amount of co2 tanks as you would normally, and not add in any pistons to use the gas), it would bypass the AIing problem without giving the AI any additional advantages.  I will use this along with the omni2.py until someone have a better idea.

bobflamerAI.txt
Quote
name = BFFF Flamethrower AI
preview = bffff_preview.bmp
dir = bob
model = bobflamer.gmf
type = weapons
base = Flamethrower
description = description = A BFFF Flamethrower that uses only 1 gas to bypass AI problems.  For the sake of fairness it is recommanded that you put in the amount of CO2tanks as you would normally need.
attachsound = sounds\cmp_generic.wav
standard = 1
hidden = 2
firesound = sounds\flame_thrower.wav
airmaxinoutrate = -1
hitpoints = 500

Probably just a nitpick, but since AI can have over 100 Throttle on "forward" or "turn", it should be consider cheating to use forward/leftright as the firing mechanism since it will give it extra reach.
« Last Edit: October 01, 2009, 11:06:16 AM by 123savethewhales »

Online apanx

AI-ing (.py files, coding, R+D, and help)
« Reply #138 on: September 26, 2009, 07:31:36 AM »
Why the bot turns off weapon sometimes:

This is because immobile bots are not counted to the enemy list, so when the only enemy is immobile, the bot detects no more enemies and the Engage tactic that is selected using
Code: [Select]
self.tactics.append(Tactics.Engage(self))
tells the bot to shut down.

You could replace the Engage tactic with your own tactic that does not shutdown by following thses instructions.
https://gametechmods.com/forums/showthread.php?t=2207

While it may seem that the AI might cheat by inputting values over 100 in turn and throttle. The code shows these strings in the routines for them

Code: [Select]
       throttle = min(max(throttle, -100), 100)
        turning = min(max(turning, -100), 100)


Which caps the input at 100 and -100

Offline Naryar

  • Posts: 23283
  • Rep: 21
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
AI-ing (.py files, coding, R+D, and help)
« Reply #139 on: September 26, 2009, 08:01:03 AM »
Well i did put for laughs one of my NAR AI rammer's throttle at 3000 and it DID have an effect...