Author Topic: AIing Trouble  (Read 5865 times)

Offline Urjak

  • *
  • Posts: 2753
  • Rep: 6
  • Shell Spinner King
    • http://www.youtube.com/wa
    • View Profile
    • Awards
AIing Trouble
« Reply #40 on: April 22, 2009, 09:05:31 AM »
Okay, I will.
Any comments would be appreciated. :D

Offline Reier

  • Rieir
  • *
  • Posts: 8564
  • Rep: 8
  • I GOT 3RD IN RAW1
    • https://www.youtube.com/c
  • Awards old BOTM Winner
    • View Profile
    • Awards
AIing Trouble
« Reply #41 on: April 22, 2009, 09:15:24 AM »
You're having the Iron Spagetti effect?
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 Madiaba

AIing Trouble
« Reply #42 on: April 22, 2009, 04:03:26 PM »
Urj, your drive motors are not strong enough to control your bot, against the torque of the spinner assembly. Check the wheels too.
In this vid, the bot has a colored dot on the front of the chassis. I pointed the nose forward at start, but it doesn't stay that way....
Look:
https://gametechmods.com/?do=ra2ube&ACT=video&id=Urjaks_spinner
 
So, you'll have to tweak it a bit.....
.
 
 
(Didn't forget you, ACAM's....)
.
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 Urjak

  • *
  • Posts: 2753
  • Rep: 6
  • Shell Spinner King
    • http://www.youtube.com/wa
    • View Profile
    • Awards
AIing Trouble
« Reply #43 on: April 22, 2009, 05:20:35 PM »
So basically, there is no way to AI that Sheck Spinner?
Any comments would be appreciated. :D

Offline roboman2444

  • Ultra Heavyweight
  • Posts: 1212
  • Rep: 0
  • Linux, Nexuiz, Quake, and Darkplaces lover.
    • View Profile
    • http://www.freewebs.com/teamrckm
    • Awards
AIing Trouble
« Reply #44 on: April 23, 2009, 05:25:56 PM »
Are any of you good enough at aiing to make a sns translate.(move as it spins)
I have tried and i cant.
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
AIing Trouble
« Reply #45 on: April 27, 2009, 05:36:19 AM »
well, as you asked me, i also tried... and i can't : as soon as you go straight ... you bot stop spinning !

if you want this kind of bots you will have to do it with DSL and it is more a matter of components than of AI.

Anyway, i share you the result of my works : quiet unuseful : a tactics + AI that work (worst) as a Whipper but without whip zone !

Tactics (to add in Tacticts.py) :
Code: [Select]

class SnSV1(AI.Tactic):
    name = "SnSV1"
    # Tactic based on Charge    
    def __init__(self, ai):
        AI.Tactic.__init__(self, ai)
       
        self.regroupPos = None
        self.regroupDir = True
        self.regroupTime = 0
   
    def Evaluate(self):
        self.priority = 0
        self.target_id, range = self.ai.GetNearestEnemy()
       
        if self.target_id != None:
            heading = self.ai.GetHeadingToID(self.target_id, False)
           
            # better turn than move : priority higher if no heading
            self.priority = 50 + (abs(heading) * 20)
           
            clear_path = self.ai.IsStraightPathClear(self.ai.GetLocation(), plus.getLocation(self.target_id))
            if not clear_path: self.priority -= 35
               
    def Execute(self):
        if self.target_id != None:
            self.ai.enemy_id = self.target_id
           
            heading = self.ai.GetHeadingToID(self.target_id, False)
            target_loc = plus.getLocation(self.target_id)
            clear_path = self.ai.IsStraightPathClear(self.ai.GetLocation(), target_loc)

            distance = (vector3(target_loc) - vector3(self.ai.GetLocation())).length()
            speed = self.ai.GetSpeed()
           
            # if we're close but not moving very fast, turn as fast as possible
            if (distance < 5 ) and clear_path:
                self.ai.Throttle(120)
                self.ai.Turn(100)
            elif distance > 5 or  not clear_path:
                self.ai.DriveToLocation(plus.getLocation(self.target_id))
            else:
                # stop charging if we're near the edge!
                if plus.getGameType() == &quot;TABLETOP&quot;:
                    a = Arenas.currentArena
                    loc = vector3(self.ai.GetLocation())
                   
                    # check to see if we're already over
                    dist, over, h = a.DistanceToEdge(loc.asTuple())
                    if over: return False
                   
                    # now check to see if we're heading over
                    angle = self.ai.GetHeading(False)
                    dir = vector3(math.sin(angle), 0, math.cos(angle))
                    speed = self.ai.GetSpeed()
                   
                    look_ahead = .5
                   
                    loc += dir * speed * look_ahead        
                   
                    dist, over, h = a.DistanceToEdge(loc.asTuple())
                    if over: return False
   
                # drive as fast as we can toward the target
                self.ai.AimToHeading(heading)                
                self.ai.Throttle(100)
                self.regroupPos = None
           
            return True
        else:
            return False
 


and the AI :
Code: [Select]

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

class SnSV1(AI.SuperAI):
    "SnSV1!"
    name = "SnSV1"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
       
        self.tactics.append(Tactics.SnSV1(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("")
           
        return AI.SuperAI.Activate(self, active)
 
    def LostComponent(self, id):
        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(SnSV1)


line in bindings.py is like this :
Code: [Select]

    list.append( ("Bomb", "SnSV1", { 'turnspeed' : 1.7, 'topspeed' : 12.0, 'weapons': (8, 12, 14, 15) }) )


Offline roboman2444

  • Ultra Heavyweight
  • Posts: 1212
  • Rep: 0
  • Linux, Nexuiz, Quake, and Darkplaces lover.
    • View Profile
    • http://www.freewebs.com/teamrckm
    • Awards
AIing Trouble
« Reply #46 on: April 27, 2009, 03:23:07 PM »
Thanks!
Real life robotics team www.teamrckm.tk
Real life game studio www.v2games.tk


Offline Urjak

  • *
  • Posts: 2753
  • Rep: 6
  • Shell Spinner King
    • http://www.youtube.com/wa
    • View Profile
    • Awards
AIing Trouble
« Reply #47 on: April 30, 2009, 09:21:16 AM »
I may have come up with a possible solution to my flail shell spinner problem. What if I treated it like a sit n' spin when its motors is running, and when it moves toward the opponent, it shuts its weapon motor off, thus allowing it to drive properly, then reactivate the motor and start spinning again when the opponent comes in range.

It seem like Madiaba's sit n' spin AI would almost work, but I was concerned about the weapon wiring being an analogue. Anyway, I was just wondering about you guy's take on my new idea.
Any comments would be appreciated. :D

Offline Naryar

  • Posts: 23267
  • Rep: 20
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
AIing Trouble
« Reply #48 on: April 30, 2009, 09:47:08 AM »
Quote from: Urjak;35972
I may have come up with a possible solution to my flail shell spinner problem. What if I treated it like a sit n' spin when its motors is running, and when it moves toward the opponent, it shuts its weapon motor off, thus allowing it to drive properly, then reactivate the motor and start spinning again when the opponent comes in range.

You mean making a shell spinner/SnS hybrid ?

Yes it is possible, all the HS/SnS hybrids i've seen use it.

However it could make your spinner weaker against fast bots...

Offline Urjak

  • *
  • Posts: 2753
  • Rep: 6
  • Shell Spinner King
    • http://www.youtube.com/wa
    • View Profile
    • Awards
AIing Trouble
« Reply #49 on: April 30, 2009, 10:22:17 PM »
Personally, having controlled movement while AIied is more important then loss of effectivity, though I do see your point.
Any comments would be appreciated. :D

Offline Urjak

  • *
  • Posts: 2753
  • Rep: 6
  • Shell Spinner King
    • http://www.youtube.com/wa
    • View Profile
    • Awards
AIing Trouble
« Reply #50 on: July 19, 2009, 06:32:11 PM »
Okay.... I have another AIing dilema.

I have a one-wheeled SnS, and in order for it to be able to driver toward the opponent it has to only have the forward/backward analogue wired. The problem is, once the opponent is in the whipzone, I need the bot to start spinning around. The AI won't do this because it needs the Left/right analogue also wired.

Does anyone know how to get my SnS to function properly?
Any comments would be appreciated. :D

Offline Sage

  • *
  • Posts: 6179
  • Rep: 11
  • RA2 Wizard & GTM's Favorite Stock Builder 2015
  • Awards Sage's Favorite BOTM Winner
    • View Profile
    • Awards
AIing Trouble
« Reply #51 on: July 19, 2009, 06:51:28 PM »
Quote from: Urjak;52973
Okay.... I have another AIing dilema.
 
I have a one-wheeled SnS, and in order for it to be able to driver toward the opponent it has to only have the forward/backward analogue wired. The problem is, once the opponent is in the whipzone, I need the bot to start spinning around. The AI won't do this because it needs the Left/right analogue also wired.
 
Does anyone know how to get my SnS to function properly?

I believe the FBS_2.py used in the RAW pack for Pinball might work cause it uses the drive motors to spin, not a seperate button. Just an idea.
You got my vote for RA2 Wizard. Always and forever.

Offline Urjak

  • *
  • Posts: 2753
  • Rep: 6
  • Shell Spinner King
    • http://www.youtube.com/wa
    • View Profile
    • Awards
AIing Trouble
« Reply #52 on: July 19, 2009, 06:52:18 PM »
Thing is.... will it use the Forward Analogue input to spin?
Any comments would be appreciated. :D

Offline JoeBlo

AIing Trouble
« Reply #53 on: July 19, 2009, 09:07:50 PM »
wire it to spin clockwise and anticlockwise on a analog called "spin" and keep your "forward" control.. then get yourself FBS_1.py and the robot will never stop spinning unless it starts being counted out in which case it will stop and drive forward or back then start spinning again.. just make sure the direction you want it to spin is the first "action" of the analog "spin"

Edit: sage beat me to it but what I said, that's basically how Super SnS and Destiny were AI'd in Clash Cubes 2

Offline Urjak

  • *
  • Posts: 2753
  • Rep: 6
  • Shell Spinner King
    • http://www.youtube.com/wa
    • View Profile
    • Awards
AIing Trouble
« Reply #54 on: July 20, 2009, 12:14:18 PM »
Okay guys, thanks for the help. My bot is now succesfuly Aied!
Any comments would be appreciated. :D