gametechmods

Robot Arena => General Support => Topic started by: Urjak on November 27, 2008, 11:50:15 AM

Title: AIing Trouble
Post by: Urjak on November 27, 2008, 11:50:15 AM
Okay, I have an AI issue I was hoping someone knew how to fix. The issue is that one of my bots, a popup-ish bot, will not self-right when he is in a certain position, even though when human controlled he has no problem doing it. Here is the position he is in:

(https://gametechmods.com/uploads/images/80145AI_Help.JPG)

Here are all the specifics of my problem:

* In the bindings.py, I have him set for invertible, but also gave him a srimech.

* This is in DSL, as you can see.

* When human controlled, I can fire my weapon when in this position, and get in to a verticle position. In this position, my wheels touch the gorund, and I can spin them and self-right the bot.

* When computer controlled, and in the verticle position, the AI can self-right the bot. But when in the bad position, the AI will not fire the weapon to allow the bot back into the verticle position.

If there is any info I have left out that is needed please tell me. Any help would be greatly appreciated. :|
Title: AIing Trouble
Post by: Madiaba on November 27, 2008, 12:18:59 PM
Urj, if you can PM me the bot to actually see it working, I'll get to it later today.
Title: AIing Trouble
Post by: Urjak on November 27, 2008, 12:21:54 PM
Okay, I will. Thanks.
Title: AIing Trouble
Post by: philetbabe on November 27, 2008, 12:40:24 PM
Quote from: Urjak;22922
Okay, I will. Thanks.

if your bot is invertible this mean you can drive it while inverted. this is not the case.

More over it 's a kind of cheat because many AI continue to fight bot invertible that are inverted (and give them a chance to get back on their wheels) while they let them get immobilized when they are not invertible.

By the way :
- tell you're bot is not invertible
- verify that your Srimech control start with 'S' and not 's'
- at last, verify the AI you use get this code
Code: [Select]
  def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.zone = "weapon"
        self.triggers = ["Fire"]
self.trigger2 = ["Srimech"]
 ...

   def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0
Title: AIing Trouble
Post by: Urjak on November 27, 2008, 12:45:20 PM
There is one issue though. It does not complelty self-right when it fires. It gets back to a verticle position, and with out thinking it is invertible, it will just stay there and not turn its wheels, thus not allowing to completly self-right.
Title: AIing Trouble
Post by: Madiaba on November 27, 2008, 12:47:44 PM
Phil covered most of it; 'Thanks'. You might also check the start/end locations of the bm's.
If there's still probs, PM it.
Title: AIing Trouble
Post by: Madiaba on November 27, 2008, 01:26:59 PM
Urj, even when I removed your upper 'Angled side panel' the burst motors will hardly even flip your bot over past all the wedges stuff on the front of your bot. They would have to lift it allot higher to get past it all. And that after I raised your 2 Mag snappers up higher in the chassis.
You're going to have to redesign the bot to enable it to flip itself easier/better. If you could decrease the length of your wedgies, then it might SRM ok and consistently. Then try it again.
Other than that, nice, fast, effective bot.
Title: AIing Trouble
Post by: Urjak on November 27, 2008, 01:35:30 PM
Thanks for the help. But I am not trying to flip my bot all the way over. I am trying to get the AI flip it back to the Verticle position, which I know it can do, then turn the bots wheels to self-right. My issue is I can't get it to activate the bots weapon to put it into the verticle position. But if it is in the verticle position, the AI can self-right it.
Title: AIing Trouble
Post by: Madiaba on November 27, 2008, 01:43:28 PM
I see.  Unfortunately, neither the SRM nor the driving work well in a vertical position.
If you know how, you could write a py that in an inverted situation, the SRM kicks in and then also actuates the drive wheels to go forward/backward for x number of seconds, to finish the uprighting.
I don't have the time to do it, else I would for you. But I think Phil (and a couple others) might be able to do it for you, if they've time.
Title: AIing Trouble
Post by: philetbabe on November 27, 2008, 01:46:04 PM
Hack the AI (save it before):
add a command to turn your wheels when inverted :
Code: [Select]

   def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                self.Input(trigger, 0, 1)
                self.Input('LeftRight', 0, 100)
            for i in range(0, 8):
                self.Input('LeftRight', 0, 100)

and if you want to do it clean, copy your AI under 'myAIName.py'

change the InvertHandler function as above and change also :
Code: [Select]
class MyAIName(AI.SuperAI):
    "MyAIName strategy"
    name = "MyAIName"
...
AI.register(MyAIName)

and if you want to turn the other direction : self.Input('LeftRight', 0, -100)

Well if that works it may be your FIRST AI !
Title: AIing Trouble
Post by: Madiaba on November 27, 2008, 01:57:46 PM
Cool, Phil. It might be better, Phil to divert the wheel 'input' out of "def InvertHandler", back under "def Tick" where the SRM mode would activate a 'Timer', so that when the bot is pointing upward/vertical and the SRM may/may not be activated, that the wheels will still do their spinning for a time, to either (1) finish the self-right, or (2) get back into the "def InvertHandler" mode to try again... and not be left in limbo.
Title: AIing Trouble
Post by: Urjak on November 27, 2008, 02:02:54 PM
Thanks for all the help guys, I will defianlty try this out. :D
Title: AIing Trouble
Post by: WhamettNuht on November 29, 2008, 04:45:52 PM
I have a bot of a prblem as well.
My Beauty 2 replica selfrights when on its flipper, but when it gets on its back, it wont fire again.
Can someone help me aswell?
Title: AIing Trouble
Post by: philetbabe on November 30, 2008, 08:08:27 AM
Quote from: WhamettNuht;23048
I have a bot of a prblem as well.
My Beauty 2 replica selfrights when on its flipper, but when it gets on its back, it wont fire again.
Can someone help me aswell?


show picture with explanation and tell what AI you use please.
Title: AIing Trouble
Post by: Clickbeetle on November 30, 2008, 10:06:08 PM
When a bot is on its back ('back' here meaning not upside down, but balanced on the rear end, I'm assuming) the AI doesn't think it's still upside down, so it will try driving.  As far as I know there's no way for the AI to detect this situation (well, there probably is, but I don't know it) short of putting something on the back of your bot so it can't balance there.
Title: AIing Trouble
Post by: Urjak on January 31, 2009, 12:16:12 PM
For the sake of not creating a new thread, I have another AI problem.

My AIed sit n' Spin will not stop spinning and move if it is being counted out for staying still, thus it will always lose its matches through immobility. If you have any help or other information for me to specifiy, please post.
Title: AIing Trouble
Post by: Sage on January 31, 2009, 12:55:46 PM
Quote from: Urjak;27851
For the sake of not creating a new thread, I have another AI problem.

My AIed sit n' Spin will not stop spinning and move if it is being counted out for staying still, thus it will always lose its matches through immobility. If you have any help or other information for me to specifiy, please post.


if you downloaded the RAW bots pack, it came with an FBS.py (or something like that) which i used for pinball. it works a lot better than pillar. try using that.
Title: AIing Trouble
Post by: Madiaba on January 31, 2009, 04:36:10 PM
Thanks, Sage.
Or here: FBS_1 (http://www.madiaba.gametechmods.com/FBS_1.rar). Almost flawless removal from countdowns, plus a couple other convenient User defined options. Comes with ReadMe very easy instructions too.
Title: AIing Trouble
Post by: Urjak on February 01, 2009, 11:18:35 AM
Okay cool. Thanks for the help! :D
Title: AIing Trouble
Post by: Somebody on February 03, 2009, 06:48:54 PM
I have an AIing problem too (and yes Mad, I would like to solve it myself)

Anyways, I tried to AI my BBEANS 5 bot on Spin Doctor's AI line (I copied the line and replaced BW-Bird of Prey with it). I then changed the name, and put Bot of 1000 Names into the teams files. The bot shows up in game. The bot will start the battle. But when the battle starts, the bot does not run, and is facing sideways. (to its left, if it matters)

Bot of 1000 Names is a 36 weaponed spinner, with Spin Doctor's drive (but shinies instead of slipperbottoms).

The AI line is only set up for 30 weapons, and uses Omni. What should I do?
Title: AIing Trouble
Post by: Sage on February 03, 2009, 07:10:17 PM
Quote from: Somebody;28089
I have an AIing problem too (and yes Mad, I would like to solve it myself)

you need to change the direction in the AI line. theres instructions on how to do that in starcores guide to AIing. if it's not moving, make sure all your controls are named correctly and are in the right spot. remember, the drive has to be in the first two slots.
Title: AIing Trouble
Post by: Scrap Daddy on February 03, 2009, 07:44:43 PM
Quote from: Sage;28091
you need to change the direction in the AI line. theres instructions on how to do that in starcores guide to AIing. if it's not moving, make sure all your controls are named correctly and are in the right spot. remember, the drive has to be in the first two slots.


I don't think thats true, Sage. A lot of bots in starcore aren't like that. (still can't figure out why my ai don't move though!!:angry:)
Title: AIing Trouble
Post by: Sage on February 03, 2009, 08:14:54 PM
Quote from: Scrap Daddy;28092
I don't think thats true, Sage. A lot of bots in starcore aren't like that. (still can't figure out why my ai don't move though!!:angry:)


well, it WAS why your bots didnt move when i AIed them. just saying, no reaosn not to try it.
Title: AIing Trouble
Post by: Madiaba on February 04, 2009, 08:43:11 AM
SD, I have some time to look at your AI folder, now.
What is the problem exactly?
Title: AIing Trouble
Post by: Scrap Daddy on February 04, 2009, 08:54:04 AM
the ai is back down to 3 not 6
Title: AIing Trouble
Post by: Madiaba on February 04, 2009, 10:16:42 AM
Are the slots there, but no 4,5,6 bots?
Or no slots for these 3 bots?
Did you alter the UI folder at all? i.e.:"selectbot_computer.gib"
 
Actually just try me later today on MSN.
..
Title: AIing Trouble
Post by: Somebody on February 04, 2009, 07:22:17 PM
Yes, I just remembered that the controls weren't named. But what do I delete, the math.pi part, or what.
Title: AIing Trouble
Post by: Clickbeetle on February 04, 2009, 11:12:02 PM
Noses (based on the forward heading arrow in the bot lab):

......0 (=pi*2)
........|
pi/2--|----pi*1.5
........|
........pi

If your bot's nose is pi right now, and it's facing to the left, then it should be pi*1.5.  I think.
Title: AIing Trouble
Post by: Naryar on February 05, 2009, 12:31:30 AM
(http://www1.fccj.edu/lchandouts/trigresources/Unit_circle_angles.png)
Title: AIing Trouble
Post by: Somebody on February 05, 2009, 06:22:31 AM
The nose is 'nose' :math.pi/2

And it faces to its left.

Which way is which with the math.pis.
Title: AIing Trouble
Post by: Madiaba on February 05, 2009, 08:13:44 AM
Here, SB, is a more complete picture: Chart (https://gametechmods.com/forums/showthread.php?t=1103&page=2) (scroll down)
Title: AIing Trouble
Post by: Scrap Daddy on February 08, 2009, 11:46:41 AM
The thing that makes AI teams 6 bots instead of 3 is the 'selectbot_computer.gib'. If you're AI teams are back down to 3 just get the new GIB that is in the Starcore AI packs. Moral: Don't mess with the 'selectbot_computer.gib' or you're teams might be 3 bots again.

Thanks to Madiaba for all the help.
Title: AIing Trouble
Post by: Urjak on February 23, 2009, 08:13:45 PM
Okay, I have another AI problem. This is with one of my AWs. He is a rammer who needs to self-right himself. Here is how it should have worked:

1. Bot gets flipped.
2. Bot turns wheels forward.
3. Eventually hits wall.
4. Flips over.

Now, the issue is that my "Srimech" button in the wiring section is a button that I need to be "held down" by the AI to turn the wheels forward. The issue is that the AI doesn't hold it down, and presses it sporadically, thus not allowing it to  hit a wall and flip over.

Any help would be greatly appreciated. :|
Title: AIing Trouble
Post by: Sage on February 23, 2009, 08:15:22 PM
you could put 'invertible:true' and hope it runs into a wall XP

but the srimech doesnt work like that i dont think.
Title: AIing Trouble
Post by: Urjak on February 23, 2009, 08:17:47 PM
Unfourtunatley I can't, because if Invertible is true, he will try to go after the opponet, and not the wall.
Title: AIing Trouble
Post by: Sage on February 23, 2009, 08:21:01 PM
but if its a rammer thats what you want...
Title: AIing Trouble
Post by: Urjak on February 23, 2009, 08:23:16 PM
No, you see it is not fully invertable. It can only sort of move upsidedown.
Title: AIing Trouble
Post by: Urjak on February 23, 2009, 08:34:15 PM
Scratch this, I found a very obvious solution.... increase wheel size. :| Sorry for wasting your time Sage.
Title: AIing Trouble
Post by: Urjak on April 21, 2009, 07:16:45 PM
Okay, for the sake on not creating a new thread, here is my dilema:

Flail Sheck Spinner have this annoying way of spiraling around the arena. If it is human controlled, you can control the spiraling to attack the opponent. The issue is that when AIed, it can't move porperly at all. Thus, even though I want to AI some of my Sheck Spinners for Naryar's DSL AI pack, I cannot.

There may be something obvious that I am missing, but any help would be greatly appreciated.
Title: AIing Trouble
Post by: Madiaba on April 22, 2009, 12:42:33 AM
PM me the bot, Urj, so I can understand a bit better what's what.
Title: AIing Trouble
Post by: Urjak on April 22, 2009, 09:05:31 AM
Okay, I will.
Title: AIing Trouble
Post by: Reier on April 22, 2009, 09:15:24 AM
You're having the Iron Spagetti effect?
Title: AIing Trouble
Post by: Madiaba 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 (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....)
.
Title: AIing Trouble
Post by: Urjak on April 22, 2009, 05:20:35 PM
So basically, there is no way to AI that Sheck Spinner?
Title: AIing Trouble
Post by: roboman2444 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.
Title: AIing Trouble
Post by: philetbabe 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 http://www.youtube.com/watch?v=-aMgfM8Il8s 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) }) )

Title: AIing Trouble
Post by: roboman2444 on April 27, 2009, 03:23:07 PM
Thanks!
Title: AIing Trouble
Post by: Urjak 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.
Title: AIing Trouble
Post by: Naryar 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...
Title: AIing Trouble
Post by: Urjak 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.
Title: AIing Trouble
Post by: Urjak 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?
Title: AIing Trouble
Post by: Sage 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.
Title: AIing Trouble
Post by: Urjak on July 19, 2009, 06:52:18 PM
Thing is.... will it use the Forward Analogue input to spin?
Title: AIing Trouble
Post by: JoeBlo 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
Title: AIing Trouble
Post by: Urjak on July 20, 2009, 12:14:18 PM
Okay guys, thanks for the help. My bot is now succesfuly Aied!