# nose is "front" of bot-
#Nose paradigm: All 360 rotational degrees for "math.pi" are represented by the factor '2'.
#thus: '2'=360degrees, '1'=180degrees, '0.5'=90degrees, '0.25'=45degrees.
#The direction of change(CW/CCW)is determined by the "-" or "+" before the statement.
#thus: '+' causes rotation CCW, '-' causes rotation CW.
#Format examples:
# " 'nose':math.pi*0.25 " will rotate the bot 45degrees/CCW.
# " 'nose':-math.pi*0.25 " will rotate the bot 45degrees/CW.
# " 'nose':math.pi*0.5 " will rotate the bot 90degrees/CCW.
# " 'nose':-math.pi*0.5 " will rotate the bot 90degrees/CW.
# " 'nose':math.pi*0.75 " will rotate the bot 135degrees/CCW.
# " 'nose':-math.pi*0.75 " will rotate the bot 135degrees/CW.
# (Make sure there is a comma(,)after the the value # (to separate it from the next characteristic and its value).
#(-----notes-----)
# Note1: "math.pi" AND 'nose':math.pi*1.0 " AND " 'nose': -math.pi*1.0 " will rotate the bot 180 degrees.
# (The first two are the same, and the last two just rotate different directions to get 180 degrees.}
# Thus there is no real reason to have a factor greater than '1',
# since after that you just move into the other half of the circle covered by the other '+' or '-' sign.
# Note2: "math.pi*0" or "math.pi*2" = the same as no new heading.
Attaching Smart Zones ...
where '2' is the component sequential assembly number. Use Apanx's Exporter to find the motor's number, and add it here.
Nice work, Phil.
So to save you from dupping work, look at this AI.py that I wrote specifically for ACAMS Machine-gun mounted atop a self-aiming servo motor, and also has automatic repeating fire
...,'weapons':(1,2,3,4,5,6,7,8,9)}))
def Activate(self, active):
if active:
...
goon = 1
i = 0
self.weapons = []
while goon == 1:
if i == self.GetNumComponents(): break # to verifiy if i == ... or i > ...
currentType = self.GetComponentType(i)
if currentType == "Weapon": self.weapons.append (i)
i = i+ 1
return AI.SuperAI.Activate(self, active)
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.SpinTrigger = "Spin"
self.ServoTrigger = "Servo"
...
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 len(self.weapons) < 4 :
# i have 2 motors mounted on a tri-bar extender.
# the last bar contains a hammer.
# my self.weapons list contains the Id of the weapons.
# when only 3 weapons remains, i swith my controler
# to make my servomotor spin much like a normal motor
# so the AI that controls the servo become useless
# my bot turn to a 'normal spinner'
self.SpinTrigger = "Servo"
self.ServoTrigger = "NOP" # does nothing
self.SpinSpeed = 100
return AI.SuperAI.LostComponent(self, id)
Fields of investigation : does the lostcomponent function is called for each component lost or only for weapons ? What happens if one put Id of motors or other components in its self.weapons list ?I've used lostcomponent function for SRMs, meaning that if it lost it's vertical pole it would try to fire the weapons to self-right. I also did the same for lost armor, changing instead to an basic/crude 'evasive' strategy I wrote.
Would anybody happen to have the "Pillar" AI that is used on Speed KING from the RAW bots pack? It won't work and my game doesn't have it.SB, you might try the AI.py 'FBS_1' above. I built on 'Pillar' by hacking through the immobilization coding to improve it. This is now more consistent at getting FBS's out of immobilization countdowns, and also has several optional features for custom tweakings.
Guys, I got a Biii...iiig problem..
how good/bad is directional spinner ai?
That's a great question, looking at the code i do not see much difference between spinner and directionnal spinner. Is there really a difference ? where is it defined ?The only significant difference that I can see is that Spinner uses the RobotInRange function to do something while DirectionalSpinner doesn't.
Here it is and I paralleled like sections so you can see for yourselves:
I sent the bots. What do you want to do with them?
Here's a handy AI.py: 'OmniRam_EnergyMiser'. It is a version of 'OmniRam' with an appended energy(Battery) saver
# nose is "front" of bot-
#Nose paradigm: All 360 rotational degrees for "math.pi" are represented by the factor '2'.
#thus: '2'=360degrees, '1'=180degrees, '0.5'=90degrees, '0.25'=45degrees.
#The direction of change(CW/CCW)is determined by the "-" or "+" before the statement.
#thus: '+' causes rotation CCW, '-' causes rotation CW.
#Format examples:
# " 'nose':math.pi*0.25 " will rotate the bot 45degrees/CCW.
# " 'nose':-math.pi*0.25 " will rotate the bot 45degrees/CW.
# " 'nose':math.pi*0.5 " will rotate the bot 90degrees/CCW.
# " 'nose':-math.pi*0.5 " will rotate the bot 90degrees/CW.
# " 'nose':math.pi*0.75 " will rotate the bot 135degrees/CCW.
# " 'nose':-math.pi*0.75 " will rotate the bot 135degrees/CW.
# (Make sure there is a comma(,)after the the value # (to separate it from the next characteristic and its value).
#(-----notes-----)
# Note1: "math.pi" AND 'nose':math.pi*1.0 " AND " 'nose': -math.pi*1.0 " will rotate the bot 180 degrees.
# (The first two are the same, and the last two just rotate different directions to get 180 degrees.}
# Thus there is no real reason to have a factor greater than '1',
# since after that you just move into the other half of the circle covered by the other '+' or '-' sign.
# Note2: "math.pi*0" or "math.pi*2" = the same as no new heading.
Take this and paste it to the top of your Bindings.py for easy reference....
>
> Here is the SOW.bot, AI.py, and Bindings line I posted above:
Does anyone know what AI has been used for bots like Inf's Spyguy or Sorrow's Anduril ? (maybe PillarPlus) And how can they be used - i need to AI Corona and i'm clueless about what to do.
> CB tweaked FBS_1 to add a few more features. I think they're useful. Here it is:
https://gametechmods.com/uploads/files/FBS_2.rar (https://gametechmods.com/uploads/files/FBS_2.rar)
(Thanks, CB for your input. And sorry I didn't look at it until now...)
..
look here), or in the hand of good builder may be used as anti gut ripper in DSL.
.. Thanks for continuing the work...
https://gametechmods.com/uploads/files/3830AI-Chart-2.rar (https://gametechmods.com/uploads/files/3830AI-Chart-2.rar)
ok i checked it.
what is the thing that would tell if the desired heading is in front or behind a robot
...
no Im talking in the actual coding for a robot. like if the enemy was in one direction the robot could fire its weapon towards that direction without smartzones
# 22- Exile
list.append(("Exile Wip","Omni",{'range':99,'radius':1,'topspeed':100,'weapons':(1,2,3)}))
list.append(("X-ile","Omni",{'invertible':False,'nose':math.pi,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
list.append(("Exile","Popup",{'invertible':False,'nose':math.pi,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
list.append(("AW-Birth of Exile","Rammer",{'topspeed':99,'invertible':True,'nose':math.pi,'throttle':130,'radius':0.1,'range':99,'weapons':(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)}))
list.append(("BW-Growth of Exile","Rammer",{'invertible':True,'nose':math.pi,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
list.append(("Exile's Rath","Omni",{'invertible':False,'nose':math.pi,'range':99,'radius':0.1,'topspeed':100,'throttle':180,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
I have a question to ask. This is for the bots with AGODed weapons.
Is it possible for an AI'ed bot to move its weapons during the intro or the countdown? Because I usually press the pause button before the match starts, and spin the weapons so that the bots return to its natural position without flopping around.
We're going to make all of the AI.py available as an appendage to the Tutorial....
list.append(("Haymaker","PillarPlus",{'nose':math.pi,'invertible':True,'range2':12,'radius':2,'topspeed':100,'throttle':130,'turn':20,'turnspeed':2,'weapons':(11,12)}))
list.append(("Iron Spaghetti","PillarPlus",{'nose':math.pi*2,'range':99,'range2':6,'radius':1,'topspeed':100,'throttle':130,'turn':2,'turnspeed':0.1,'weapons':(21,25,26,27,33,34,35,36)}))
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)}))
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.
That didn't help at all.
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)
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)
list.append(("Epidemic","Poker",{'invertible':True,'radius':0.5,'topspeed':99,'throttle':130,'weapons':(1,2,3,4,5)}))
GRAAGAHGHGSA
GRAAGAHGHGSA
maybe i shouldnt have tried to ai these last night ;P
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)
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
self.tactics.append(Tactics.Engage(self))
throttle = min(max(throttle, -100), 100)
turning = min(max(turning, -100), 100)
class scheduler:
"A 'brain' to schedule a set of actions."
resume = 0
done = 1
abort = 99
def __init__(self):
self.actions = []
def setActions(self, actions):
self.actions = actions
def tick(self):
"Run the top action and pop them off as they're completed."
if len(self.actions) > 0:
result = apply(self.actions[0][0], self.actions[0][1])
if result == scheduler.abort:
return False
elif result == scheduler.done:
# this step is done, move to next
self.actions.pop(0)
return len(self.actions) > 0
else:
return True
else:
return False
... Since all I want is for the bot to hold the weapon button from start to finish without modifying the driving behaviors, is there any way to get around that? ...
Easy to follow method: If you simply want to use the regular AI tactics for AI steering and control, and yet have your weapon(s) fire continuously, then you can:
1. put this line under 'Tick':
....def Tick(self):
........self.Input("AlwaysFire", 0, 100) #Analog for flamethrower.
2. then name your in-game analog control the same name: 'AlwaysFire'.
.
def Tick(self):
self.Input("Spin", 0, 100)
return AI.SuperAI.Tick(self)
def Tick(self):
if 1 == 1:
self.Input("Spin", 0, 100)
return AI.SuperAI.Tick(self)
-I know that the 'input' command DOES work fine standing alone under 'Tick'..
-I've also have seen a difference when enlarging the analog value for a fire. Made a couple cool AI like that, a while ago though.
-As far as the flamethower's intermittentness, I did notice sometimes on a few freak AI I made that there were 'lapses', for lack of a better word, of consistant firing. One of the lapses that bugs many, including me, is the lapse in consistent cannon fire. I considered that the 2 (fire lapse and cannon lapse) might be related since they both use the co2 means of simulated power...but I never followed up on it.
def Tick(self):
# fire weapon
if self.weapons:
self.Input("Spin", 0, 100)
return AI.SuperAI.Tick(self)
I have an AI.py I wrote a while back, for a 'Photon Blaster' bot. I'll PM it to you...
Look it over well and let me know of anything needing explained.
BTW: Nice to see you diving into the game...
.
self.Input("Flame", 0, 130)
If your bot has the same amount of weapons the one to be replaced has, then it's fine.
If you are aing and you want to replace a bot does the weopons numbers at the end matter at all
So, what are these numbers in the weapons list contained in binding.py ?
I have a question. instead of simply changing from one default tactic to the next, is it possible to change from 1 py to the next after all weapon breaks. For example, suppose I want to start with omni, after all my front weapon breaks, I want to change to FBS_1, how would I approach this problem?
def ImmobilityWarning(self, id, on): # Sees anytime the "ImmobilityWarning" is turned ON or turned OFF by a bot.
.
def ImmobilityWarning(self, id, on):
if on: # Only sees when the "ImmobilityWarning" is turned ON by a bot.
.
def ImmobilityWarning(self, id, on):
if on:
if id == self.GetID():
.
def ImmobilityWarning(self, id, on):
if on:
if id == 3:
if id == 2:
.
def ImmobilityWarning(self, id, on):
if on:
if id == 0: a-command
if id == 1: b-command
if id == 2: c-command
if id == 3: d-command
if id == self.GetID(): e-command
.
def ImmobilityWarning(self, id, on):
if id == 0: a-command
if id == 1: b-command
if id == 2: c-command
if id == 3: d-command
if id == self.GetID(): e-command
.
def ImmobilityWarning(self, id, on):
if id == self.GetID():
if on:
self.Turn ON Immobile system...
if not on:
self.Turn OFF Immobile system...
.
def ImmobilityWarning(self, id, on):
if id == self.GetID():
self.Counter += 1
if self.Counter == 1:
self.Turn ON Immobile system...
if self.Counter == 2:
self.Turn OFF Immobile system...
self.Counter = 0
.... i need a py file that will play a sound when something passes thru a smartzone.I thought CB answered your question....
oh and it has to loaded for every bot. not just the ai.
so say its a boxing match, and one of the robots hits the other in a certain area(the smartzone). a sound would play like "bullseye!"
Is there a way to make an AI for flail spinners that would use something along the lines of Melty brain to move? i know that I can drive those spinners but AI doesn't work for it.So you want a SnS AI that can rotate its weapons and chassis while still moving toward the opponent... I think all you would need to do is add these (don't repeat things if they are already there, though). Later if I have time, I'll do some actual testing and uploading but I'm pretty sure I have everything you need listed below: (I took it directly from Omni.py so it could be optimized a little better but it should work like this)
def __init__(self, **args):
self.triggers = ["Fire"]
self.spin_range = 3.0
def Tick(self):
# fire weapon
if self.weapons:
# spin up depending on enemy's range
enemy, range = self.GetNearestEnemy()
if enemy is not None and range < self.spin_range:
self.Input("Spin", 0, 1)
elif self.GetInputStatus("Spin", 0) != 0:
self.Input("Spin", 0, 0)
there might be a way without coding...Hope this helps.
just have the smartzone not a smartzone, but an actual component. and the sound that the components would make when something hits it or it hits something would be said sound.
is this practical? This would be completely possible. All that I think you would need to do is include 'damagesounds = sounds\Whatever.wav' in the text file (although, I've never tried do this with cannons, I'm pretty sure it would still work).
the only problem is that i need it to do damage to the chassis when it gets hit... because the smartzone would just let the bullet thing through and hit the chassis. I'm not sure exactly but I think by removing the collisions (from either the GMF or the text file) would result in damagesounds, piercing and concussion to not work.
If you were to add a little bit of possibly laggy programming to the Arena.py, I think you could make any damage done to the other components (could be made to work with only specific components, too) result in damage to the chassis or both the chassis and the component.
oh this is for rdma2 and i need some good gunz(shotgun sniper machinegun, and maybe roket launcher, grenade launcher....) If you haven't already, take a look at Megaturdbomb's cannons and use the resizer that I made and linked to somewhere on these forums (or one of the other two component resizers) to manipulate/distort them into new shapes and sizes that would resemble any of the components that your asking for. Just be sure to change the folders, names, and text files so that it doesn't cause problems for other people...
i also want the robots to respawn when they die, but it would also put +1 pt for the robot who hit it last and -1 to the robot that died. Madiaba and I have been looking for coding that could respawn bots back into their original positions but, currently, it looks like it is coded within the EXE and is only available to the Practice Arena. You could make bots drive/get pushed back or towards a location but just be aware that it is very difficult to flip/turn a bot back into the upright position. Adding and subtracting points is completely possible from within the Arena.py or the AI.py using 'plus.addPoints(BotID, Points)'. To subtract points, just use a negative number.
By checking headings and coordinates between bots, you could make the Arena.py generate the sounds and do the damage but it may get a little laggy at times.
Keyboard input is currently not accessible via python in RA2. You can read up on the subject if you would like here (https://gametechmods.com/forums/showthread.php?t=2200), though... Currently, the closest things to it would be to use the practice arena buttons (which are only available to the practice arena) or some python coding from within the FPS window...
@nicsan2009: I'm not sure I know what you mean...
#We need to write an AI.py in which the builder can control some of the AI.py contents more out in the Bindings.py:
1. Choose AND Change your own AI tactics:
....list.append(("Fabiot","TACTICAL_CONTROL",{ StartTactic: "Engage", NoWeaponsTactic: "Ram", BackUpTactic: "Evade", ....
The 'BackUpTactic' needs some criteri-a/on (maybe 'no weapons'+'higher points' than opponent then scram....)
2. A customizable 'Range' that would trigger any 'Controller-name' command:
....'Range_1_command': 'Fire1', 'Range_1': 1.5, 'Range_2_command': 'Spin', 'Range_2': 5.
3. Attack during 'Immobilization' option:
....'Immobilization_Attack_Y/N': Y, ....
Its impossible unless they`re already being counted out.Sorry, that's what I meant. I wasn't being clear.
awesome so you can make a flipper.py to turn robots over and leave them ?
Is there a possibility of a .py that uses the moving action of the FBS.py to just go to the center of the arena and spin there, instead of chasing the other bot?
Sorry to DP, but I want to show everyone what I did. I added this to popup.py after the bit about not firing until the enemy hits the body:
if self.weapons:
targets = [x.robot for x in self.sensors.itervalues() if x.contacts > 0 \
and not plus.isDefeated(x.robot)]
fire = False
for bot in targets:
if not plus.isUpsideDown(bot) or self.CanDriveUpsideDown(bot):
fire = True
if fire: self.Input(self.trigger, 0, 1)
bReturn = AI.SuperAI.Tick(self)
return bReturn
def CanDriveUpsideDown(self, bot):
MOVE_THRESHOLD = 3.0 <- Tried increasing that to make it less sensitive to random movments?
if bot in self.upTrack:
t = self.upTrack[bot]
if t.invertible: return True
else:
# check to see if he's moved recently
position = plus.getLocation(bot)
time = plus.getTimeElapsed()
if time - t.last_time > 10:
# this record is too old to be reliable
t.last_time = time
t.last_position = position
return False
v0 = vector3(t.last_position)
v1 = vector3(position)
if (v1-v0).length() > MOVE_THRESHOLD: t.invertible = True
return t.invertible
else:
t = UpsideDownTracker()
t.last_position = plus.getLocation(bot)
t.last_time = plus.getTimeElapsed()
self.upTrack[bot] = t
return False
The bot still attacks upside down robots. What have I done wrong?
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 Plow, but waits for chassis contact before firing the weapon. If chassis is not found by a certain time, then fires anyway."
# Use variable 'NoChassisTime' in Bindings.py to set the amount of time in seconds the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.
name = "CheapPopup"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.zone1 = "weapon"
self.triggers1 = ["Fire"]
self.triggers2 = ["Srimech"]
self.botinzone = 0
self.compinzone = 0
self.comptimer = 0
self.NoChassisTime = 8
if 'zone' in args: self.zone = args['zone']
if 'triggers' in args: self.triggers1 = args['triggers']
if 'triggers' in args: self.triggers2 = args['triggers']
if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4
self.tactics.append(Tactics.Engage(self))
self.tactics.append(Tactics.Charge(self))
self.tactics.append(Tactics.Shove(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)]
# if a component is in the smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone == 1 and self.botinzone == 0:
self.comptimer += 1
if self.botinzone == 1:
self.comptimer = 0
if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
for trigger in self.triggers1: self.Input(trigger, 0, 1)
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 Disable(self,btarget):
# Disables opponent by charging it at an angle
# we use a different angle (depending on the size of the opponent!)
# if target is equal in size, the plow weapon charges are more direct
if btarget > self: self.Turn(79)
else: self.Turn(-79)
if btarget < self: self.Turn(35)
else: self.Turn(-35)
if btarget == self: self.Turn(90)
else: self.Turn(-90)
if self.target: self.Turn(360)
return AI.SuperAI.Disable(self, btarget)
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 robot > 0:
if direction == 1:
self.compinzone = 1
if chassis:
self.botinzone = 1
if direction == -1:
self.compinzone = 0
if chassis:
self.botinzone = 0
return True
AI.register(CheapPopup)
Created a new AI:
return AI.SuperAI.LostComponent(self, id)
def Disable(self,btarget): <- Seems to be a space too little, try changing to def Disable(self, btarget):
# Disables opponent by charging it at an angle
Problem: Crashes RA2, and I don't know how. Help?
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class Cheap(AI.SuperAI):
# "Like Omni, but waits for chassis contact before firing the weapon. If chassis is not found by a certain time, then fires anyway. it also attacks from the side, like the Plow AI."
# Use variable 'NoChassisTime' in Bindings.py to set the amount of time in seconds the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.
name = "Cheap"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.zone1 = "weapon"
self.triggers1 = ["Fire"]
self.triggers2 = ["Srimech"]
self.botinzone = 0
self.compinzone = 0
self.comptimer = 0
self.NoChassisTime = 4
if 'zone' in args: self.zone = args['zone']
if 'triggers' in args: self.triggers1 = args['triggers']
if 'triggers' in args: self.triggers2 = args['triggers']
if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4
self.tactics.append(Tactics.Shove(self))
self.tactics.append(Tactics.Charge(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)]
# if a component is in the smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone == 1 and self.botinzone == 0:
self.comptimer += 1
if self.botinzone == 1:
self.comptimer = 0
if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
for trigger in self.triggers1: self.Input(trigger, 0, 1)
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 == "Charge"]
if len(tactic) > 0:
self.tactics.remove(tactic[0])
self.tactics.append(Tactics.Shove(self))
return AI.SuperAI.LostComponent(self, id)
def Disable(self, btarget):
# Disables opponent by charging it at an angle
# we use a different angle (depending on the size of the opponent!)
# if target is equal in size, the plow weapon charges are more direct
if btarget > self: self.Turn(79)
else: self.Turn(-79)
if btarget < self: self.Turn(35)
else: self.Turn(-35)
if btarget == self: self.Turn(90)
else: self.Turn(-90)
if self.target: self.Turn(360)
return AI.SuperAI.Disable(self, btarget)
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 robot > 0:
if direction == 1:
self.compinzone = 1
if chassis:
self.botinzone = 1
if direction == -1:
self.compinzone = 0
if chassis:
self.botinzone = 0
return True
AI.register(Cheap)
targets = [x.robot for x in self.sensors.itervalues() if x.contacts > 0 \
and not plus.isDefeated(x.robot)]
for bot in targets:
if plus.isUpsideDown(bot) and not self.CanDriveUpsideDown(bot):
xxxxxxxxxxxxxx
def Tick(self):
# fire weapon
targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
and not plus.isDefeated(x.robot)]
for bot in targets:
if not plus.isUpsideDown(bot) or self.CanDriveUpsideDown(bot):
fire = True
# if a component is in the smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone == 1 and self.botinzone == 0:
self.comptimer += 1
if self.botinzone == 1:
self.comptimer = 0
if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
for trigger in self.triggers1: self.Input(trigger, 0, 1)
if self.weapons:
targets = [x.robot for x in self.sensors.itervalues() if x.contacts > 0 \
and not plus.isDefeated(x.robot)]
if fire: self.Input(self.trigger, 0, 1)
bReturn = AI.SuperAI.Tick(self)
return bReturn
def CanDriveUpsideDown(self, bot):
MOVE_THRESHOLD = 4.0
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class IgnorePopup2(AI.SuperAI):
"My special popup py that will ignore upside down bots."
# Use variable 'NoChassisTime' in Bindings.py to set the amount of time in seconds the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.
name = "IgnorePopup"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.zone1 = "weapon"
self.triggers1 = ["Fire"]
self.triggers2 = ["Srimech"]
self.botinzone = 0
self.compinzone = 0
self.comptimer = 0
self.NoChassisTime = 8
fire = false
if 'zone' in args: self.zone = args['zone']
if 'triggers' in args: self.triggers1 = args['triggers']
if 'triggers' in args: self.triggers2 = args['triggers']
if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4
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)]
# if a component is in the smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone == 1 and self.botinzone == 0:
self.comptimer += 1
if self.botinzone == 1:
self.comptimer = 0
if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
for trigger in self.triggers1: self.Input(trigger, 0, 1)
if self.weapons:
if fire: self.Input(self.trigger, 0, 1)
for bot in targets:
if not plus.isUpsideDown(bot) or self.CanDriveUpsideDown(bot):
fire = True
bReturn = AI.SuperAI.Tick(self)
return bReturn
def CanDriveUpsideDown(self, bot):
MOVE_THRESHOLD = 4.0
if bot in self.upTrack:
t = self.upTrack[bot]
if t.invertible: return True
else:
# check to see if he's moved recently
position = plus.getLocation(bot)
time = plus.getTimeElapsed()
if time - t.last_time > 10:
# this record is too old to be reliable
t.last_time = time
t.last_position = position
return False
v0 = vector3(t.last_position)
v1 = vector3(position)
if (v1-v0).length() > MOVE_THRESHOLD: t.invertible = True
return t.invertible
else:
t = UpsideDownTracker()
t.last_position = plus.getLocation(bot)
t.last_time = plus.getTimeElapsed()
self.upTrack[bot] = t
return False
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 robot > 0:
if direction == 1:
self.compinzone = 1
if chassis:
self.botinzone = 1
if direction == -1:
self.compinzone = 0
if chassis:
self.botinzone = 0
return True
AI.register(IgnorePopup2)
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class IgnorePopup2(AI.SuperAI):
"My special popup py that will ignore upside down bots."
# Use variable 'NoChassisTime' in Bindings.py to set the amount of time in seconds the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.
name = "IgnorePopup"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.zone1 = "weapon"
self.triggers1 = ["Fire"]
self.triggers2 = ["Srimech"]
self.botinzone = 0
self.compinzone = 0
self.comptimer = 0
self.NoChassisTime = 8
fire = 0
if 'zone' in args: self.zone = args['zone']
if 'triggers' in args: self.triggers1 = args['triggers']
if 'triggers' in args: self.triggers2 = args['triggers']
if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4
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)]
# if a component is in the smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone == 1 and self.botinzone == 0:
self.comptimer += 1
if self.botinzone == 1:
self.comptimer = 0
if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
for trigger in self.triggers1: self.Input(trigger, 0, 1)
if self.weapons:
if fire: self.Input(self.trigger, 0, 1)
for bot in targets:
if not plus.isUpsideDown(bot) or self.CanDriveUpsideDown(bot):
fire = 1
bReturn = AI.SuperAI.Tick(self)
return bReturn
def CanDriveUpsideDown(self, bot):
MOVE_THRESHOLD = 4.0
if bot in self.upTrack:
t = self.upTrack[bot]
if t.invertible: return True
else:
# check to see if he's moved recently
position = plus.getLocation(bot)
time = plus.getTimeElapsed()
if time - t.last_time > 10:
# this record is too old to be reliable
t.last_time = time
t.last_position = position
return False
v0 = vector3(t.last_position)
v1 = vector3(position)
if (v1-v0).length() > MOVE_THRESHOLD: t.invertible = True
return t.invertible
else:
t = UpsideDownTracker()
t.last_position = plus.getLocation(bot)
t.last_time = plus.getTimeElapsed()
self.upTrack[bot] = t
return False
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 robot > 0:
if direction == 1:
self.compinzone = 1
if chassis:
self.botinzone = 1
if direction == -1:
self.compinzone = 0
if chassis:
self.botinzone = 0
return True
AI.register(IgnorePopup2)
I been thinking about how to AI this thing
http://s895.photobucket.com/albums/ac159/123savethewhales/bait0.jpg (http://s895.photobucket.com/albums/ac159/123savethewhales/bait0.jpg)
I think I need
front back invertible (maybe one involving smart zone and alternating the radius back and forth?).
Fire weapon (another smart zone), by alternating between left and right on half second interval (probably using analog), so the flails moves back and forth dealing damage.
The problem is I am not sure how to do any of those things.
Nar, I've not looked through your mod of FBS, yet...
And the other one is just a slightly modded FBS.py that changes spinning direction when inverted - i think i posted in in the RAW 2 thread (since i made it for Iron Storm 5 so the maces spin the right way). I just removed a line that handles the spinning direction if the bot is inverted.Can you send me a copy of this version? I think my SnS can benefit from always spinning at the razor side.
Hax !
Hax !
#45 - srezinwP
list.append(("ymgyP","Spinner",{'range':40,'radius':1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(24,25,26,27,28,29,30,31)}))
list.append(("ecivoN","Rammer",{'invertible':True,'radius':1.5,'range':50,'topspeed':100,'turn':50,'turnspeed':3,'weapons':(10,12,14)}))
list.append(("75.5 ?iouQ tE","Omni",{'radius':1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(32,33,34,35,36,37,38,39,40,41,48,49)}))
list.append(("2 pergE","Omni",{'invertible':True,'radius':1.5,'topspeed':100,'throttle':130,'turn':60,'turnspeed':3,'weapons':(15,16,17,18,19,20)}))
list.append(("2 esallikoboR","Rammer",{'invertible':True,'radius':1,'topspeed':100,'throttle':100,'turn':70,'turnspeed':3,'weapons':(10,11,12)}))
list.append(("SHW - 2 niarT niarreT llA","FBSPlus",{'invertible':True,'direction':1,'spinspeed':20,'radius':0.1,'range':50,'topspeed':100,'turn':70,'turnspeed':5,'weapons':(26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,61,62,63,64)}))
maybe try the .bot files and see if any are misspelled. and the picture wouldn't crash the game, the place where the pic would be would be white if it's misspelled.
I can sent you to bot if you want to take a look at it.
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class Tractor(AI.SuperAI):
"Spins in plow style"
# - Works just like Spinner.py but with plow incoroporated into it.
# - Correct weapon ID numbers will help.
# - No extra stuff needed in the bindings.
name = "Tractor"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.spin_range = 3.0
if 'range' in args:
self.spin_range = args.get('range')
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("")
return AI.SuperAI.Activate(self, active)
def Tick(self):
if self.weapons:
# spin up depending on enemy's range
enemy, range = self.GetNearestEnemy()
if enemy is not None and range < self.spin_range:
self.Input("Spin", 0, 1)
elif self.GetInputStatus("Spin", 0) != 0:
self.Input("Spin", 0, 0)
return AI.SuperAI.Tick(self)
def RobotInRange(self, robot_id):
"Return tuple of (part-of-robot-in-range, chassis-in-range)"
# GetLastDamage returns: component damaged, amount, at time, by player, by component
range = self.GetDistanceToID(robot_id)
if range < self.spin_range:
damage = self.GetLastDamageReceived()
if damage[3] == robot_id and (plus.getTimeElapsed() - damage[2] < 1.0):
return (True, True)
return (False, False)
def LostComponent(self, id):
#print "Lost Component!"
return AI.SuperAI.LostComponent(self, id)
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 Disable(self,btarget):
# Disables opponent by charging it at an angle
# we use a different angle (depending on the size of the opponent!)
# if target is equal in size, the plow weapon charges are more direct
if btarget > self: self.Turn(79)
else: self.Turn(-79)
if btarget < self: self.Turn(35)
else: self.Turn(-35)
if btarget == self: self.Turn(90)
else: self.Turn(-90)
if self.target: self.Turn(360)
return AI.SuperAI.Disable(self, btarget)
AI.register(Tractor)
# 42 - Dark Factory of Mass Production "We don't have a motto yet"
list.append(("Revelation","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
list.append(("Blind Destruction","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
list.append(("Abyssal Designator","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
list.append(("AW-The Prodigy","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
list.append(("BW-Byter","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
list.append(("Evil Intent","FBS_1",{'PreSpinEntrance':5,'SpinDirection':1,'ReMobilizeRoutineTime':20,'nose':math.pi*2,'radius':0.3,'range':99,'topspeed':100,'throttle':130,'turn':90,'turnspeed':4,'weapons':(22,23,24)}))
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class Tractorright(AI.SuperAI):
"Spins in plow style with srimech"
# - Works just like Spinner.py but with plow and srimech incoroporated into it.
# - Correct weapon ID numbers will help.
# - No extra stuff needed in the bindings.
name = "Tractorright"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.spin_range = 3.0
self.trigger2 = ["Srimech"]
if 'range' in args:
self.spin_range = args.get('range')
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("")
return AI.SuperAI.Activate(self, active)
def Tick(self):
if self.weapons:
# spin up depending on enemy's range
enemy, range = self.GetNearestEnemy()
if enemy is not None and range < self.spin_range:
self.Input("Spin", 0, 1)
elif self.GetInputStatus("Spin", 0) != 0:
self.Input("Spin", 0, 0)
return AI.SuperAI.Tick(self)
def RobotInRange(self, robot_id):
"Return tuple of (part-of-robot-in-range, chassis-in-range)"
# GetLastDamage returns: component damaged, amount, at time, by player, by component
range = self.GetDistanceToID(robot_id)
if range < self.spin_range:
damage = self.GetLastDamageReceived()
if damage[3] == robot_id and (plus.getTimeElapsed() - damage[2] < 1.0):
return (True, True)
return (False, False)
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
def LostComponent(self, id):
#print "Lost Component!"
return AI.SuperAI.LostComponent(self, id)
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 Disable(self,btarget):
# Disables opponent by charging it at an angle
# we use a different angle (depending on the size of the opponent!)
# if target is equal in size, the plow weapon charges are more direct
if btarget > self: self.Turn(79)
else: self.Turn(-79)
if btarget < self: self.Turn(35)
else: self.Turn(-35)
if btarget == self: self.Turn(90)
else: self.Turn(-90)
if self.target: self.Turn(360)
return AI.SuperAI.Disable(self, btarget)
AI.register(Tractorright)
I think the proble is with the line defining the trigger or this bitdef 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
Lets play a game...Spot the error in the AI lines!Code: [Select]# 42 - Dark Factory of Mass Production "We don't have a motto yet"
list.append(("Revelation","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
list.append(("Blind Destruction","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
list.append(("Abyssal Designator","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
list.append(("AW-The Prodigy","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
list.append(("BW-Byter","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
list.append(("Evil Intent","FBS_1",{'PreSpinEntrance':5,'SpinDirection':1,'ReMobilizeRoutineTime':20,'nose':math.pi*2,'radius':0.3,'range':99,'topspeed':100,'throttle':130,'turn':90,'turnspeed':4,'weapons':(22,23,24)}))
I can't find it and it might not be something wrong with the AI. It doesn't crash like it usually does when there is an AI mistake. It stops loading when the screen gets to 3/4 of the bar on the loading screen of NAR AI. I can't even get out of it either, I have to restart my computer.
I was trying to make tractor compatable with a srimech, but there's something wrong, and I can't see it.Code: [Select]import plus
I think the proble is with the line defining the trigger or this bit
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class Tractorright(AI.SuperAI):
"Spins in plow style with srimech"
# - Works just like Spinner.py but with plow and srimech incoroporated into it.
# - Correct weapon ID numbers will help.
# - No extra stuff needed in the bindings.
name = "Tractorright"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.spin_range = 3.0
self.trigger2 = ["Srimech"] #There's your problem right there; this line needs to be indented once more.
if 'range' in args:
self.spin_range = args.get('range')
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("")
return AI.SuperAI.Activate(self, active)
def Tick(self):
if self.weapons:
# spin up depending on enemy's range
enemy, range = self.GetNearestEnemy()
if enemy is not None and range < self.spin_range:
self.Input("Spin", 0, 1)
elif self.GetInputStatus("Spin", 0) != 0:
self.Input("Spin", 0, 0)
return AI.SuperAI.Tick(self)
def RobotInRange(self, robot_id):
"Return tuple of (part-of-robot-in-range, chassis-in-range)"
# GetLastDamage returns: component damaged, amount, at time, by player, by component
range = self.GetDistanceToID(robot_id)
if range < self.spin_range:
damage = self.GetLastDamageReceived()
if damage[3] == robot_id and (plus.getTimeElapsed() - damage[2] < 1.0):
return (True, True)
return (False, False)
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
def LostComponent(self, id):
#print "Lost Component!"
return AI.SuperAI.LostComponent(self, id)
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 Disable(self,btarget):
# Disables opponent by charging it at an angle
# we use a different angle (depending on the size of the opponent!)
# if target is equal in size, the plow weapon charges are more direct
if btarget > self: self.Turn(79)
else: self.Turn(-79)
if btarget < self: self.Turn(35)
else: self.Turn(-35)
if btarget == self: self.Turn(90)
else: self.Turn(-90)
if self.target: self.Turn(360)
return AI.SuperAI.Disable(self, btarget)
AI.register(Tractorright)Quotedef 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
Edit: I've given up for the time being as it isn't working.
list.append(("Revelation","Kheper",{'nose':math.pi*2,'invertible':False,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
list.append(("Kheper","Kheper",{'nose':math.pi/2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
I haven't looked though the py but should the ServoID be the same ?Well, Click said ServoID is what tells the .py where to get the motor angle from and since they are the same they SHOULD be. Unless im misunderstanding what its supposed to do.
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class SZSpinner(AI.SuperAI):
"Like Omni, but does not use a range value for a spinning weapon ; instead uses a smartzone"
name = "SZSpinner"
#IMPORTANT NOTE: This is a WIP and it might not work properly.
#Just like said, this is an Omni AI that activates it's spinning weapon via a smartzone (that you need to name "spinner") rather than a range value.
#For very short spinup time robots (jugglers, drums, face spinners, etc) that only really need to spin their weapons when the opponent is on them.
#Brought to you by Naryar and inspired by Madiaba's Arrowhead.py.
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.zone = "weapon"
self.zone1 = "spinner"
self.triggers = ["Fire"]
self.trigger2 = ["Srimech"]
self.reloadTime = 0
self.reloadDelay = 3
self.botinzone1 = 0
if 'triggers' in args: self.triggers = args['triggers']
if 'reload' in args: self.reloadDelay = args['reload']
self.triggerIterator = iter(self.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)
self.RegisterSmartZone(self.zone1, 2)
return AI.SuperAI.Activate(self, active)
def Tick(self):
# fire weapon
if self.weapons:
# spin up if enemy is in smartzone.
if self.botinzone1 == 1:
self.Input("Spin", 0, 100)
else:
self.Input("Spin", 0, 0)
targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
and not plus.isDefeated(x.robot)]
# slight delay between firing
if self.reloadTime > 0: self.reloadTime -= 1
if len(targets) > 0 and self.reloadTime <= 0:
try:
trigger = self.triggerIterator.next()
except StopIteration:
self.triggerIterator = iter(self.triggers)
trigger = self.triggerIterator.next()
self.Input(trigger, 0, 1)
self.reloadTime = self.reloadDelay
return AI.SuperAI.Tick(self)
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
def LostComponent(self, id):
# if we lose all our weapons, stop using the Engage tactic and switch to Shove (absolutely worthless, that said)
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)
AI.register(SZSpinner)
Right now, self.botinzone1 isn't getting changed so the bot won't spin.
if you have power saving in mind why not take a look at EcoOmni ?
list.append( ("Locktite","Poker",{'nose':math.pi\2,'topspeed':12.0,'throttle':110,'turn':80,'turnspeed':4.5,'weapons':(1,)}))In this coding there's '\' that should be '/'.
list.append( ("Snow plow", "Rammer",{'nose':math.pi,'topspeed':20.0,'throttle':140,'turnspeed':6.0,'weapons':(1,)}))
list.append( ("EMERGANCY 2", "Spinner", {'radius':0.4,'topspeed':20.0,'throttle':110,'weapons':(1,)}))
list.append(("Sowobot","LaserGuidedV3",{'servonose':-1,'range':80,'radius':1,'servospeed':60,'topspeed':99,'mayFire':True,'throttle':130,'weapons':(20,21,22,23)}))
I was AI'ing a bot with LaserGuidedV3 but whenever I test it, the servo spins away from the bot
Here's the bot:
And bindings:Code: [Select]list.append(("Sowobot","LaserGuidedV3",{'servonose':-1,'range':80,'radius':1,'servospeed':60,'topspeed':99,'mayFire':True,'throttle':130,'weapons':(20,21,22,23)}))
I have also tried servonose:1, nothing really changes.
Help would be appreciated.
Line 973: list.append( ("head on", "LaserGuidedV3",{ 'servonose':1, 'range':80, 'radius':2.5, 'servorange':2.8,'delta':0.25, 'servospeed':50, 'topspeed':99, 'mayFire':True, 'throttle':130,'weapons':(1,2,3,4,5,6,7,8,9)}))
Line 974: list.append( ("BJM servo", "LaserGuidedV3",{ 'nose':math.pi,'range':80, 'radius':3, 'servorange':2,'servonose':-1,'delta':0.15, 'servospeed':60, 'topspeed':99, 'mayFire':False, 'throttle':130,'weapons':(1,2,3,4,5,6,7,8,9)}))
list.append(("Verbal Abuse to Bodily Harm","VertSpinner2",{'radius':1.2,'turnspeed':2.5,'topspeed':99,'turn':75,'throttle':100,'range':99,'weapons':(32,33,34,35,36,37,38,39),'sweapons':(30,31)}))
Are the controllers named Forward and LeftRight?Yeah
Are the controllers named Forward and LeftRight?Yeah
I figured out what happened, Sparkey has a weird way of controlling bots.
:idea2: Or are you weird because you don't...
*The fabric of space tears releasing waves of philosophy*
Couple ideas:
1. You can code your py to fire the piston a short interval after the burstmotor (hammer).
2. You can attach a SZ to the piston that will move/swing with the arm, and fire only when an enemy is under it's pointytips. (BFE)
3. You can see if you can get a legit return from "self.GetMotorAngle(CompID)" - This returns the angle of a motor in radians, but I've never tried it on a 'burst' motor so not sure what you'll get back. If you get a valid return, then since the angle of the BM is adjustable, you'll also have to play around to find out where you have the parameters of the burstmotor set for your bot's application (start position, and fired position [in radians: 0-6.28]).
Here's some basic coding adapted from a servomotor:
self.burstangle = self.GetMotorAngle(Component ID) [/color]#Find angle of burst motor.
if self.burstangle > ?: #If angle of burst motor is beyond it's 'start' position (by whatever amount),
self.Input("Fire_1", 0, 1) #Then fire the piston.
list.append(("Kikeroga","Pillar",{'invertible':True,'topspeed':99,'throttle':130,'turnspeed':2.5,'turn':60,'radius':0.3,'range':99,'weapons':(27,28,29,30,31,32,34,35,36,37,38,39,40,41,42,43,44,45,46)}))
Can anyone see what's wrong with this AI line?Code: [Select]list.append(("Kikeroga","Pillar",{'invertible':True,'topspeed':99,'throttle':130,'turnspeed':2.5,'turn':60,'radius':0.3,'range':99,'weapons':(27,28,29,30,31,32,34,35,36,37,38,39,40,41,42,43,44,45,46)}))
It's missing 33, but I'm not sure whether that causes the problem or not.
Once again, the weapons entry do not matter on such an AI.
Once again, the weapons entry do not matter on such an AI.
again I dont know about pillar but pillarplus will change to shove is it looses weapons
I think pillar did not supported a spinning weapon system, but not sure...
list.append(("USS Enterprise","Spinner",{'nose':math:.pi,'range':100,'radius':1,'topspeed':100,'throttle':130,'turn':70,'turnspeed':5,'weapons':(1,2,3,4,5,6,7,8)}))
lol didnt see that :P damn stupid eyeslol, I looked over it a couple times before I noticed it too.
def Tick(self):
self.Input("Spin", 0, 1)
return AI.SuperAI.Tick(self)
if you set a large enough range omni should spin straight away ?It spins once the 3 ticks countdown end. But prespin helps keep this bot balance. I wanted the switch to be turn on before the match starts (during the countdown).
but the game stops this motion before match starts anyway ?I would think so too. But the result varies from the AI to when I manually flicking the switch before the timer starts. I am not sure what it is though.
but still you will have to consult mad and he knows how to break the RA2 rules in python :P
I dont know.. Scrap used it in a NarAI bot if I remember.. if not I can send you a copy
if you set a large enough range omni should spin straight away ?It spins once the 3 ticks countdown end. But prespin helps keep this bot balance. I wanted the switch to be turn on before the match starts (during the countdown).
I now know why Joe has an affinity toward you... ;)
How would I AI a full body popup?Been there, done that. I just used popup.py.
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class PinnerPlus(AI.SuperAI):
"Pushes without backing up"
name = "PinnerPlus"
# Designed for true pushers, though does NOT back up repeatedly like Pusher.py does. This has a spin function too.
# In-built average Throttle, Topspeed, Turn and Turnspeed values for easier AI-ing. Also invertible.
# Brought to you by G.K.
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.tactics.append(Tactics.Engage(self))
self.max_Throttle = 130
self.top_speed = 99
self.bInvertible = True
self.max_turn = 40
self.max_turn_speed = 3
self.spin_range = 40.0
if 'range' in args:
self.spin_range = args.get('range')
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 Tick(self):
if self.weapons:
# spin up depending on enemy's range
enemy, range = self.GetNearestEnemy()
if enemy is not None and range < self.spin_range:
self.Input("Spin", 0, 1)
elif self.GetInputStatus("Spin", 0) != 0:
self.Input("Spin", 0, 0)
return AI.SuperAI.Tick(self)
def LostComponent(self, id):
#print "Lost Component!"
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(PinnerPlus)
Here's PinnerPlus.py, Pinner with added support for a spinning weapon:
You know that Omni does the exact same thing as Pinner right?
Just use Omni and don't wire any controls and you've got yourself a Pinner. Wire a spinner control and you've got yourself a PinnerPlus.
list.append(("Red Dragon","Omni",{'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,12,13,14)}))
# 32 - RAW
list.append(("Cryoseism","Omni",{'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
list.append(("LOL WUT","SpinupOmni",{'radius':1.2,'range':99,'spinuptime':5,'topspeed':99,'throttle':130,'turn':100,'turnspeed':1.8,'weapons':(19,20,21)}))
list.append(("Krakatau","Omni",{'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
list.append(("Steel Reign","Omni",{'invertible':True,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
list.append(("Reindeer","Pinner",{'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
list.append(("Army Of One","Omni",{'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,)}))
does anyone see any problems with these bindings? I AI'ed them and now the game crashes :S
And RAI isn't necessary.
What about the Robot Name? Is it the same in the bot lab and in the bindings?
The idea is to ram, then start SnSing. Then when the countdown goes off, run away, ram again, and then SnS.
Hey, guys, not stealing SD's idea or anything, but I'd like an AI that does this for a robot for the 128 bot tourney::.The idea is to ram, then start SnSing. Then when the countdown goes off, run away, ram again, and then SnS.
I guess it depends if he wants it to SnS first or ram.
some where in the first few pages of this thread I think
it has 2 range valuesWhy, does it mean anything?
list.append(("Fuel","Omni",{'nose':math.pi,'range':99,'radius':1.0,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2,'weapons':(16,17,18)}))
list.append(("Iron Storm 5","FBSInvertDir",{'invertible':True,'direction':-1,'spinspeed':22,'topspeed':99,'throttle':130,'turnspeed':2.5,'turn':60,'radius':0.6,'weapons':(666,1337,9001)}))
does the robot have 18 components ?
you have made a mistake elsewhere (like the robot name) does it have a space after the name or something ?
Do you have the right parts, because fuel has parts that come with Nar AI 2.2Ya, i have the parts, but a bigger problem has sprung up.
Do you have the right parts, because fuel has parts that come with Nar AI 2.2Ya, i have the parts, but a bigger problem has sprung up.
I deleted the line in bindings, even copied a new bindings in (it was nar ai 2.2), deleted the team from the teams.txt, deleted the team folder with the bot in it, now it wont start up at all! i know this is the wrong place to post it, i will post in technical support now. but i suspect it it something to do with bindings... still, HELP!
Nope. Just make sure that your SZ isn't too big and too far from the extended position of the weapon rack.
list.append(("Robot1","FBS_1",{ 'PreSpinEntrance':0, 'SpinDirection(1/-1)':1, 'ReMobilizeRoutineTime(10-60)':10, 'range':99, 'radius':0.1, 'topspeed':100, 'throttle':100, 'turn':60, 'turnspeed':2.5, 'weapons':(1,)}))
'PreSpinEntrance':0
Controls for FBS_1 are:
self.Input("LeftRight", 0, 0)
self.Input("Ahead", 0, 100) # then Go.
self.Input("Spin", 0, 0)
Note that 'Forward' is not used.... Instead is 'Ahead'.
i have a qustion. How would you add a team to the default 14 teams. i wanna make team 15 but every time i try my game crashesYes, but I have no brain at this hour for me... I'll let another show you, else I'll help you out shortly...
figured it was an underlying thing like thatYea, 'Forward' uses the tactics to drive, and may be fighting the spinning, and thus slowing it down at times...
any difference with the 2 ?
Yea, 'Forward' uses the tactics to drive, and may be fighting the spinning, and thus slowing it down at times...
list.append(("Killdozer II","OmniRam",{'invertible':True,'topspeed':130,'throttle':130,'turnspeed':30,'turn':65,'radius':0.3,'range':99,'weapons':(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26)}))
list.append(("Rusty Seringe","OmniRam",{'invertible':True,'topspeed':130,'throttle':130,'turnspeed':30,'turn':65,'radius':0.3,'range':99}))
list.append(("AW-Ice Drop","Omni",{'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(17)}))
#55 - MW BBEANS
list.append(("Ecam","Rammer",{'radius':1,'topspeed':100,'throttle':100,'turn':50,'turnspeed':1,'weapons':(7,9)}))
list.append(("Encroaching Darkness","Popup",{'radius':5,'topspeed':40,'throttle':40,'turn':50,'turnspeed':1.7,'weapons':(18,19,20,21,22)})
#56 - MW BBEANS
list.append(("Adult's Work 2","Omni",{'invertible':True,'range':99,'radius':1,'topspeed':99,'throttle':130,'turn':100,'turnspeed':3.5,'weapons':(16,17,18,19,20,21)}))
list.append(("Bringer of bad news","Poker",{'topspeed':100,'radius':1,'throttle':130,'range':99,'turn':100,'turnspeed':2.5,'weapons':(8,12)}))
list.append(("El Torado","OmniRam",{'range':99,'radius':1,'topspeed':99,'throttle':130,'turn':60,'turnspeed':3.5,'weapons':(4,5)}))
#57 - MW BBEANS
list.append(("El Torado 2","OmniRam",{'range':99,'radius':1,'topspeed':99,'throttle':130,'turn':60,'turnspeed':3.5,'weapons':(7,8)}))
list.append(("Adult's Work","Omni",{'invertible':True,'range':99,'radius':1,'topspeed':99,'throttle':130,'turn':100,'turnspeed':3.5,'weapons':(12,13,14,15,16,17)}))
list.append(("Zaphod Stock","Omni",{'radius':1.2,'topspeed':99,'throttle':130,'range':40,'turn':60,'turnspeed':4.5,'weapons':(17,18,19,20,21,22,25,26)}))
BTW I have just cleaned it up a bit.
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class PopupMultiZone(AI.SuperAI):
"Like Popup strategy, up to 4 zones and the classical Fire/Weapon/Srimech"
name = "PopupMultiZone"
# up to 4 zones named weapon1, weapon2, weapon3 and weapon4
# and the associated triggers : Fire1, Fire2, fire3, Fire4
# weaponX is associated with FireX ie : ennemy in customzone weapon3 -> do the action associated with Fire3
# You may also change the default tactics (engage) by specify in the bindings.py 'tactic': XXX
# with XXX = "Charge", "Engage", "Shove", "Ram"
# Ripped off Popup.py and OmniMultiZone.py by Naryar
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.trigger2 = ["Srimech"]
self.botinzone1 = 0
self.compinzone1 = 0
self.botinzone2 = 0
self.compinzone2 = 0
self.botinzone3 = 0
self.compinzone3 = 0
self.botinzone4 = 0
self.compinzone4 = 0
self.comptimer1 = 0
self.comptimer2 = 0
self.comptimer3 = 0
self.comptimer4 = 0
self.NoChassisTime = 8
if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4
self.triggerIterator = iter(self.triggers)
if 'tactic' in args:
self.theTactic = args['tactic']
if self.theTactic == "Charge" : self.tactics.append(Tactics.Charge(self))
elif self.theTactic == "Ram" : self.tactics.append(Tactics.Ram(self))
elif self.theTactic == "Shove" : self.tactics.append(Tactics.Shove(self))
elif self.theTactic == "Engage" : self.tactics.append(Tactics.Engage(self))
else: self.tactics.append(Tactics.Engage(self))
else: 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("weapon1", 1)
self.RegisterSmartZone("weapon2", 2)
self.RegisterSmartZone("weapon3", 3)
self.RegisterSmartZone("weapon4", 4)
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)]
# if a component is in the first smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone1 == 1 and self.botinzone1 == 0:
self.comptimer1 += 1
if self.botinzone1 == 1:
self.comptimer1 = 0
if self.weapons and (self.botinzone1 == 1 or (self.comptimer1 >= self.NoChassisTime and self.compinzone1 == 1)):
for trigger in self.triggers1: self.Input("Fire1", 0, 1)
# if a component is in the second smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone2 == 1 and self.botinzone2 == 0:
self.comptimer2 += 1
if self.botinzone2 == 1:
self.comptimer2 = 0
if self.weapons and (self.botinzone2 == 1 or (self.comptimer2 >= self.NoChassisTime and self.compinzone2 == 1)):
for trigger in self.triggers1: self.Input("Fire2", 0, 1)
# if a component is in the third smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone3 == 1 and self.botinzone3 == 0:
self.comptimer3 += 1
if self.botinzone3 == 1:
self.comptimer3 = 0
if self.weapons and (self.botinzone3 == 1 or (self.comptimer3 >= self.NoChassisTime and self.compinzone3 == 1)):
for trigger in self.triggers1: self.Input("Fire3", 0, 1)
# if a component is in the fourth smart zone but not the chassis, wait to find chassis before firing weapons
if self.compinzone4 == 1 and self.botinzone4 == 0:
self.comptimer4 += 1
if self.botinzone4 == 1:
self.comptimer4 = 0
if self.weapons and (self.botinzone4 == 1 or (self.comptimer4 >= self.NoChassisTime and self.compinzone4 == 1)):
for trigger in self.triggers1: self.Input("Fire4", 0, 1)
bReturn = AI.SuperAI.Tick(self)
return bReturn
return AI.SuperAI.Tick(self)
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
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 robot > 0:
if direction == 1:
self.compinzone1 = 1
if chassis:
self.botinzone1 = 1
if direction == -1:
self.compinzone1 = 0
if chassis:
self.botinzone1 = 0
elif id == 2 and self.weapons:
if robot > 0:
if direction == 1:
self.compinzone2 = 1
if chassis:
self.botinzone2 = 1
if direction == -1:
self.compinzone2 = 0
if chassis:
self.botinzone2 = 0
elif id == 3 and self.weapons:
if robot > 0:
if direction == 1:
self.compinzone3 = 1
if chassis:
self.botinzone3 = 1
if direction == -1:
self.compinzone3 = 0
if chassis:
self.botinzone3 = 0
elif id == 4 and self.weapons:
if robot > 0:
if direction == 1:
self.compinzone4 = 1
if chassis:
self.botinzone4 = 1
if direction == -1:
self.compinzone4 = 0
if chassis:
self.botinzone4 = 0
return True
AI.register(PopupMultiZone)
did i did it right ?
Would like some feedback on that one... did i did it right ?
I'd like it so my latest AW can self-right.
What else?Paypal so people can give me monies when I do stuff for them :gawe:
Any .py to convert to a crawler if the wheels fall off?Thanks, Joe...
I want to AI this:
(https://gametechmods.com/uploads/images/13291S=FTW.PNG)
Any .py to convert to a crawler if the wheels fall off?
I want to AI this:
*picture*
Did you even got trigonometry lessons joey ? It's math.pi*11/10
Did you even got trigonometry lessons joey ? It's math.pi*11/10
Did you even 'get' english lessons Naryar? :p
only teasing you
Did you even got trigonometry lessons joey ? It's math.pi*11/10
# nose is "front" of bot-
#Nose paradigm: All 360 rotational degrees for "math.pi" are represented by the factor '2'.
#thus: '2'=360degrees, '1'=180degrees, '0.5'=90degrees, '0.25'=45degrees.
#The direction of change(CW/CCW)is determined by the "-" or "+" before the statement.
#thus: '+' causes rotation CCW, '-' causes rotation CW.
#Format examples:
# " 'nose':math.pi*0.25 " will rotate the bot 45degrees/CCW.
# " 'nose':-math.pi*0.25 " will rotate the bot 45degrees/CW.
# " 'nose':math.pi*0.5 " will rotate the bot 90degrees/CCW.
# " 'nose':-math.pi*0.5 " will rotate the bot 90degrees/CW.
# " 'nose':math.pi*0.75 " will rotate the bot 135degrees/CCW.
# " 'nose':-math.pi*0.75 " will rotate the bot 135degrees/CW.
# (Make sure there is a comma(,)after the the value # (to separate it from the next characteristic and its value).
#(-----notes-----)
# Note1: "math.pi" AND 'nose':math.pi*1.0 " AND " 'nose': -math.pi*1.0 " will rotate the bot 180 degrees.
# (The first two are the same, and the last two just rotate different directions to get 180 degrees.}
# Thus there is no real reason to have a factor greater than '1',
# since after that you just move into the other half of the circle covered by the other '+' or '-' sign.
# Note2: "math.pi*0" or "math.pi*2" = the same as no new heading.
list.append(("Scarlet Transmission","FBS_1",{'invertible':True,'SpinDirection(1/-1)':1,'ReMobilizeRoutineTime(10-60)':60,'PreSpinEntrance':20,'range':30,'radius':0.1, 'topspeed':100, 'throttle':130, 'turn':60, 'turnspeed':3,'weapons':(0,)}))
'tactic':Ram
the right thing to put in the binding line to change tactics?
list.append(("AW - Thorny Devil","FBS_2",{'fbs_range':15,'right': "1",'invertible':True,'nose':math.pi,'radius':0.2,'range':99,'topspeed':99,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(1)}))
(http://library.thinkquest.org/20991/media/alg2_radians.gif)
math.pi*2 is the default heading when you dont change it.. so as I said if you provided the correct details with (just past 180)
Would it be possible for a medic Ai? A bot with the medic Ai would follow its tag team partner and slowly heal it but doesnt heal itself.Yes. It would require roughly three things:
# 35 - The Pandorica "The Pandorica will open, and silence will fall."
list.append(("Pacey Macey","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1,2,3)}))
list.append(("Iron Filings","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1,2,3)}))
list.append(("Mouldy Cheese 2","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1,2,3)}))
list.append(("Scorcher VIII","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1,2,3)}))
list.append(("The guy with the ballast","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1,2,3)}))
list.append(("A VS :O","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1,2,3)}))
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class THZPlus(AI.SuperAI):
"Frenzy strategy + FBS immobility management. Also backs up weapon when not in use and uses NoChassisTime variable like Popup.py"
#Original Frenzy.py improved by JoeBlo, re-improved by Naryar
name = "THZPlus"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.zone = "whipzone"
self.tactics.append(Tactics.Engage(self))
self.whipTimer = 0
self.whipDir = 1
self.whipDirCount = 4
self.botinzone = 0
self.compinzone = 0
self.comptimer = 0
self.NoChassisTime = 8
self.canFire = 0
self.ImmobileCounter = 0
self.ThisAI_bImmobile = 0
self.BU_ImmobileTimer_A = 0
self.BU_ImmobileTimer_B = 0
self.ReMobilizeRoutineTime = 40
self.ThisAIBot_XFactorA = 0
self.ThisAIBot_ZFactorA = 0
self.ThisAIBot_XFactorB = 0
self.ThisAIBot_ZFactorB = 0
self.whipFunction = self.WhipBackAndForth
if 'zone' in args: self.zone = args['zone']
if 'whip' in args:
if args['whip'] != "around": self.whipFunction = self.WhipBackAndForth
if 'NoChassisTime' in args: self.NoChassisTime = args.get('NoChassisTime') * 4
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)
else:
# get rid of reference to self
self.whipFunction = None
return AI.SuperAI.Activate(self, active)
def Tick(self):
# fire weapon
targets = []
if self.weapons:
targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
and not plus.isDefeated(x.robot)]
if self.compinzone == 1 and self.botinzone == 0:
self.comptimer += 1
if self.botinzone == 1:
self.comptimer = 0
if self.weapons and (self.botinzone == 1 or (self.comptimer >= self.NoChassisTime and self.compinzone == 1)):
canFire = 1
else:
canFire = 0
bReturn = AI.SuperAI.Tick(self)
# call this now so it takes place after other driving commands
if self.whipFunction and self.ThisAI_bImmobile == 0: self.whipFunction(len(targets) > 0)
if self.ThisAI_bImmobile == 1: # If Immobility is on: -------------------------------------
self.ImmobileCounter += 1 # Then start counting....
if self.ImmobileCounter >= self.ReMobilizeRoutineTime*0.2: # go backward for a designated time.
self.Throttle(100)
self.Input("LeftRight", 0, 0)
self.Input("Forward", 0, -100)
if self.ImmobileCounter >= self.ReMobilizeRoutineTime*0.6: # go forward for a designated time.
self.Input("LeftRight", 0, 0)
self.Throttle(100)
self.Input("Forward", 0, 100)
if self.ImmobileCounter >= self.ReMobilizeRoutineTime: # Reset everything:
self.ThisAI_bImmobile = 0 # default Reset (if timer goes too long).
self.ImmobileCounter = 1
else:
self.ThisAI_bImmobile = 0
self.ImmobileCounter = 0
# BackUp Immobile routine (continually running).... calculate difference of position between 2 calls
self.BU_ImmobileTimer_A +=1
if self.BU_ImmobileTimer_A >= 1:
self.ThisAIBot_XFactorA = plus.getLocation(self.GetID())[0] #
self.ThisAIBot_ZFactorA = plus.getLocation(self.GetID())[2]
if self.BU_ImmobileTimer_A == 16:
self.ThisAIBot_XFactorB = plus.getLocation(self.GetID())[0]
self.ThisAIBot_ZFactorB = plus.getLocation(self.GetID())[2]
self.BU_ImmobileTimer_A = 0 # Reset.
if self.ThisAIBot_XFactorA > self.ThisAIBot_XFactorB - .07 and self.ThisAIBot_XFactorA < self.ThisAIBot_XFactorB + .07 and self.ThisAIBot_ZFactorA > self.ThisAIBot_ZFactorB - .07 and self.ThisAIBot_ZFactorA < self.ThisAIBot_ZFactorB + .07:
self.BU_ImmobileTimer_B +=1
if self.BU_ImmobileTimer_B ==50:
self.ThisAI_bImmobile = 1
self.BU_ImmobileTimer_B = 0
else:
self.BU_ImmobileTimer_B = 0 # Reset
return bReturn
def InvertHandler(self):
# fire weapon once per second (until we're upright!)
while 1:
if self.whipDir > 0:
self.Input("Hammer", 0, -1000)
else:
self.Input("Hammer", 0, 1000)
self.whipDirCount -= 1
if self.whipDirCount < 0:
self.whipDirCount = 4
self.whipDir = -self.whipDir
self.whipTimer -= 1
for i in range(0, 8):
yield 0
def WhipBackAndForth(self, bTarget):
if bTarget and canFire = 1: self.whipTimer = 8
if self.whipTimer > 0:
# Whip back and forth!
if self.whipDir > 0:
self.Input("Hammer", 0, -100)
else:
self.Input("Hammer", 0, 100)
self.Throttle(0)
self.whipDirCount -= 1
if self.whipDirCount < 0:
self.whipDirCount = 4
self.whipDir = -self.whipDir
self.whipTimer -= 1
if self.whipTimer = 0:
self.Input("Hammer", 0, -100)
def WhipAround(self, bTarget):
if bTarget: self.whipTimer = 4
elif self.whipTimer == 0: self.whipDir = -self.whipDir
if self.whipTimer > 0:
# Whip around!
if self.whipDir > 0: self.Turn(0)
else: self.Turn(0)
self.Throttle(0)
self.whipTimer -= 1
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 ImmobilityWarning(self, id, on): # keep track of our own immobility warning
if on and id == 0 or id == 1 or id == 2 or id == 3:
if id == self.GetID():
self.ThisAI_bImmobile = 1
if self.ImmobileCounter == 0: # ID protector(Keeps other bots from changing "self.ThisAI_bImmobile = 1", until it runs its course of 'freeing' this AI.
if not id == self.GetID():
self.ThisAI_bImmobile = 0
AI.register(THZPlus)
Which direction is Clockwise on FBSPlus?
I have one last question. How do you add a srimech? My brain is failing me.
list.append(("The Perfect Song","OmniRam",{'invertible':True,'nose':math.pi,'radius':0.1,'topspeed':99,'throttle':130,'turn':40,'turnspeed':1,'weapons':(5,6)}))
Before 'nose' there should be a { like this {'nose'.No
list.append(("Drumbelina","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'range':99,'turn':50,'turnspeed':2,'weapons':(1)}))
list.append(("Huge SnS","FBS_1",{'invertible':True,'PreSpinEntrance':0,'SpinDirection(1/-1)':1,'ReMobilizeRoutineTime(10-60)':10,'radius':0.1,'throttle':130,'topspeed':99,'turn':60,'turnspeed':5,'weapons':(13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)}))
Spin (Analog) wired to drive and weapon motors (if required)
Ahead (Analog) same as what Forward would normally do
LeftRight (Analog)
Prespin entrance was set at 15
list.append(("Huge SnS","FBS_1",{'invertible':True,'PreSpinEntrance':1,'SpinDirection(1/-1)':-1,'ReMobilizeRoutineTime(10-60)':10,'radius':0.1,'throttle':130,'topspeed':99,'turn':60,'turnspeed':5,'weapons':(13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)}))
list.append(("Huge SnS","FBS_1",{'invertible':True,'PreSpinEntrance':1,'SpinDirection(1/-1)':-1,'ReMobilizeRoutineTime(10-60)':60,'range':99,'radius':0.1,'throttle':100,'topspeed':99,'turn':60,'turnspeed':5,'weapons':(1,)}))
Sorry the exchange rate for that is awful, $AUD would be better :P
I need help with an custom AI. Basically, the chassis spins vertically while moving with torque reaction. Since the chassis will be spinning vertically, the AI will need to do this
1. A custom inverted handler that switch it's facing 180 degrees. (The back is the front when inverted, so the bot moves in the same direction while the chassis spins).
Here's is the bot for those interested.
https://gametechmods.com/Robot_Exchange/DSL_LW/123savethewhales_LWBigWheel.bot (https://gametechmods.com/Robot_Exchange/DSL_LW/123savethewhales_LWBigWheel.bot)
def Throttle(self, throttle):
# if we're car steering and we're not moving much, throttle up
if self.bCarSteering and self.last_turn_throttle != 0:
speed = self.GetSpeed()
if speed > 0 and speed < self.top_speed / 3: throttle = self.last_throttle + 10
elif speed < 0 and speed > -self.top_speed / 3: throttle = self.last_throttle - 10
throttle = min(max(throttle, -100), 100)
if self.bInvertible and self.IsUpsideDown(): throttle = -throttle
self.set_throttle = throttle
self.Input('Forward', 0, throttle)
self.DebugString(0, "Throttle = " + str(int(throttle)))
Now I hope I don't regret unleashing this scourge upon the tournament scene... :frown:
Edit2: Can you show the binding you used for this?
So is/ will someone work on my .py? If not, don't worry.
k, thx.So is/ will someone work on my .py? If not, don't worry.
I will have a crack at THz to SnS... still waiting for my real money though D:
send me the robot too...
Edit2: Can you show the binding you used for this?
list.append(("LW - Big Wheel","TRFBD",{'invertible':True,'range':5,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':1,'weapons':(0,)}))
list.append(("Frontal Assult","Flipper",'nose':math.pi*2,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':6,'weapons':(18,19)}))
Glad to see you back phil.Ditto. :bigsmile:
Your name looks intimidating in red, I must say...Glad to see you back phil.Ditto. :bigsmile:
2011 should be known as the year of the returning members or something.Catchy
b) How are you achieving the downwards motion? Just applying a force from the AI script?yes just poor force : i've tried to build a ai only relaying on force (no hover craft component), but if it was easy to move the bot, its chassis was extremly instable, never staying horizontal. Force are only applied on the G point on the bot, not uniformaly on the chassis.
#define identifier of servo-Piston
goon = 1
i = 0
while goon == 1:
if i == self.GetNumComponents(): break
currentType = self.GetComponentType(i)
if currentType == "ServoPiston":
self.PistonFound += 1
if self.PistonFound == 1 : self.PistonOne = i
else:
self.PistonTwo = i
break
i = i+ 1
...
pos1 = self.GetPistonPosition(self.PistonOne)
pos2 = self.GetPistonPosition(self.PistonTwo)
if self.IsUpsideDown() :
self.InverterTime = self.reloadDelay
if (pos1 < -0.2 ) or (pos2 < -0.2 ) :
self.Input("SPExtend", 0, 1)
else :
self.Input("SPExtend", 0, 0)
self.Input("SPRetract", 0, 0)
else :
if (pos1 > -0.15 ) or (pos2 > -0.15 ) :
self.Input("SPRetract", 0, 1)
if (self.InverterTime <= 0) :
self.Input("SPExtend", 0, 0)
self.Input("SPRetract", 0, 0)
self.Input("Inverter", 0, 1)
self.InverterTime = self.reloadDelay
When my bot loads in the game, it says runtime error. What do I do?
Anyway, here is a picture of my bot:
I now I made correct bindings.
Robots:
byRobots: 0 1 2 3 4 5
if you've gor 6 bots for your team. list.append(("Gicquel","Popup",{'radius':1,'topspeed':100,'throttle':130,'turn':100,'turnspeed':2,'weapons':(0)}))
Here's a game of spot the binding error! :DCode: [Select]list.append(("Gicquel","Popup",{'radius':1,'topspeed':100,'throttle':130,'turn':100,'turnspeed':2,'weapons':(0)}))
Also, I can't seem to find the link to those weightless smartzones.
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class SZSpinnerPopup(AI.SuperAI):
"Like Omni, but does not use a range value for a spinning weapon ; instead uses a smartzone"
name = "SZSpinnerPopup"
#Just like said, this is an AI that activates it's spinning weapon via a smartzone (that you need to name "spinner") rather than a range value.
#For very short spinup time robots (jugglers, drums, face spinners, etc) that only really need to spin their weapons when the opponent is on them.
#This version is similar to Popup.py, only the chassis of an opponent will trigger the spinning.
#Brought to you by Naryar and inspired by Madiaba's Arrowhead.py.
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.zone = "weapon"
self.triggers = ["Spin"]
self.trigger2 = ["Srimech"]
self.botinzone = 0
if 'triggers' in args: self.triggers = args['triggers']
self.triggerIterator = iter(self.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)
self.RegisterSmartZone(self.zone1, 2)
return AI.SuperAI.Activate(self, active)
def Tick(self):
# fire weapon
if self.weapons:
# spin up if enemy is in smartzone.
if self.botinzone1 == 1:
self.Input("Spin", 0, 1)
else:
self.Input("Spin", 0, 0)
targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
and not plus.isDefeated(x.robot)]
return AI.SuperAI.Tick(self)
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
def LostComponent(self, id):
# if we lose all our weapons, stop using the Engage tactic and switch to Shove (absolutely worthless, that said)
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 == 0 and self.weapons:
if chassis:
if direction == 1:
self.botinzone == 1;
return True
AI.register(SZSpinnerPopup)
lol
Just use Popup, name the spinner command "fire" and the SZ "weapon". Works for BountyHunter and LSoDG (AKA my BTTB4 entry)
(http://pic.phyrefile.com/l/lo/loz/2011/08/12/PI3.jpg)
I think you need a new python [sic] for this. I would go and take a look at SpinupOmni.py (Heaven's Windmill's .py file) if i were you Badnik.
Other.py (LittleMetalFriend) is the way to go.
Other.py (LittleMetalFriend) is the way to go.
Do you even know what are you talking about ? I don't think so. Lemme check...
*goes to see Other.py*
No you don't. Other.py activates two analog controls when the enemy bot is in a smartzone, and has an additional spin motor support.
*goes to see SpinupOmni.py*
And this one has a function you might be interested in Badnik. It's called getTimeElapsed. The whole py sends a null throttle value to the bot until a certain time is elapsed, and at that time the null value goes away, leaving place to normal driving. I bet you can mod the py a little so it gives negative throttle for a few seconds.
Yes, it worked for that bot, but not for the thing Badnik's trying to AI.
Yes, it worked for that bot, but not for the thing Badnik's trying to AI.
He's trying to AI the exact same bot. :P
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?
Lower your turn speed, you probably have it too high..
What is it?
hmm.. what is the turn value?
30
is the robot fast to drive too?
It has NPCF IIRC
NPCF doesnt help much :P what weightclass?
What's the radius? That always seems to help me.
What's the radius? That always seems to help me.
I believe .5
What's the radius? That always seems to help me.
I believe .5
Try lowering it to .2
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.
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?
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?
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
list.append(("The Troll5","Omni",{'radius':0.1,'topspeed':99,'throttle':130,'turn':30,'weapons':(1,2,3,4)}))
Name: The Troll5
Shouldn't it be called Bot0.bot?
No weapons line, would that affect it?
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?
I had a dream that I got that advice last night, but it was from Sage for some reason.No weapons line, would that affect it?
Yes, the AI is told to only spin if it still has weapons. If there is no 'weapons' line, the AI doesn't know that it has any weapons and it won't spin. If you don't want to actually have any real weapons set, just use 'weapons':(0,)
:rage
I had a dream about Sage last night.
FBS.py
"Rammer",{'invertible':True,'radius':2,'topspeed':100,'throttle':120,'turn':60,'turnspeed':4}))No weapons line, would that affect it?
Yes, the AI is told to only spin if it still has weapons. If there is no 'weapons' line, the AI doesn't know that it has any weapons and it won't spin. If you don't want to actually have any real weapons set, just use 'weapons':(0,)
The reason the AI never stops spinning once they start is because button controls are almost impossible to turn off once activated.
Edit:
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?
What .py are you using? Does it eventually drive out of the corner or does it just stay there? Does the AI ever turn? It may also help to post the bindings you're using. Answer those questions and someone may be able to help.
list.append(("Yus","Omni",{'nose':math.pi,'radius':1,'topspeed':99,'throttle':130,'turn':60,'turnspeed':1,'weapons':(24,25,26,27,28,29,32,33,34,35,36,37)}))
How would I AI this:you add a control board
(https://gametechmods.com/uploads/images/31161screenshot_77.png)
There is no control board and therefore no controls.
list.append(("HoverVore","InMyArms2",'nose':math.pi*2,'servodelta':0.15,'servospeed':100,'servonose':1,'servoopenangle':10,'servocloseangle':0.5,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':5,'weapons':(2,)}))
list.append(("Return To Sender","FBSPlus",{'nose':math.pi,'spinspeed':7,'range':99,'radius':0.1,'topspeed':99,'throttle':130,'turn':70,'turnspeed':4,'weapons':(20,21,22,23,24,25,26)}))
list.append(("Ion-","FBSPlus",{'nose':math.pi,'spinspeed':7,'range':99,'radius':0.1,'topspeed':99,'throttle':130,'turn':70,'turnspeed':4,'weapons':(20,21,22,23,24,25,26)}))
is there a .py that uses ramming spikes on the front, but after those break off to use a spinning weapon on the back ?
but does it support spinning weapons ?is there a .py that uses ramming spikes on the front, but after those break off to use a spinning weapon on the back ?
You got BBEANS Stock Ai? If so try SwitchDirRam.
list.append(("Raging Inferno","SwitchDirRam",{'nose':math.pi,'ThresholdSpeed':0,'SightRange':0,'radius':1,'range':99,'topspeed':100,'throttle':100,'turn':100,'turnspeed':3.5,'weapons':(2,3,4,5,6,7,8,9,10,11,12,13,),'sweapons':(21,)}))
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class FBSInvertPlus(AI.SuperAI):
"Spins!"
name = "FBSInvertPlus"
#Like FBSPlus, but does not change the direction when inverted.
#For Melty Brain type SnS/HS that are more efficient when spinning in a certain direction.
#Brought to you by Naryar and ripped off Apanx's FBS.py
#Modified by Clickbeetle to reduce lag
#Edited by Badnik96 to support spinning weapons
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.tactics.append(Tactics.Engage(self))
self.spinspeed = 6.0 #Turningspeed to achieve before moving
self.accuracy = 0.01 #Radians
self.rampupfactor = (math.pi / 2 - self.accuracy) * (math.pi / 2 - (math.pi - self.accuracy) ) * -1
self.direction = 1 # 1 or -1
self.tickFactor = 3.75
if 'direction' in args: self.direction = args.get('direction')
if 'spinspeed' in args: self.spinspeed = args.get('spinspeed')
if 'accuracy' in args: self.accuracy = args.get('accuracy')
if 'Ticks' in args: self.tickFactor = args.get('Ticks')
def Activate(self, active):
plus.AI.__setattr__tickInterval__(self, 0.125/self.tickFactor)
print self.rampupfactor
if active:
if AI.SuperAI.debugging:
self.debug = Gooey.Plain("watch", 430, 75, 250, 165)
tbox = self.debug.addText("line0", 0, 0, 250, 15)
tbox.setText("Throttle")
tbox = self.debug.addText("line1", 0, 15, 250, 15)
tbox.setText("Turning")
tbox = self.debug.addText("line2", 0, 30, 250, 15)
tbox.setText("")
tbox = self.debug.addText("line3", 0, 45, 250, 15)
tbox.setText("")
tbox = self.debug.addText("line4", 0, 60, 250, 15)
tbox.setText("")
tbox = self.debug.addText("line5", 0, 75, 250, 15)
tbox.setText("")
tbox = self.debug.addText("line6", 0, 90, 250, 15)
tbox.setText("")
tbox = self.debug.addText("line7", 0, 105, 250, 15)
tbox.setText("")
tbox = self.debug.addText("line8", 0, 120, 250, 15)
tbox.setText("")
tbox = self.debug.addText("line9", 0, 135, 250, 15)
tbox.setText("")
return AI.SuperAI.Activate(self, active)
def Tick(self):
if AI.SuperAI.debugging:
speed = self.GetSpeed()
self.DebugString(4, "Speed = " + str(speed))
turning_speed = self.GetTurning()
self.DebugString(5, "TSpeed = " + str(turning_speed))
if self.weapons:
# spin up depending on enemy's range
enemy, range = self.GetNearestEnemy()
if enemy is not None and range < self.spin_range:
self.Input("Spin", 0, 1)
elif self.GetInputStatus("Spin", 0) != 0:
self.Input("Spin", 0, 0)
return AI.SuperAI.Tick(self)
def LostComponent(self, id):
#print "Lost Component!"
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)
elif id == 4: self.debug.get("line4").setText(string)
elif id == 5: self.debug.get("line5").setText(string)
elif id == 6: self.debug.get("line6").setText(string)
elif id == 7: self.debug.get("line7").setText(string)
elif id == 8: self.debug.get("line8").setText(string)
elif id == 9: self.debug.get("line9").setText(string)
def StuckHandler(self):
"This default generator is called when the bot is almost immobile."
while 1:
# back up for 2 seconds (will stop once we're not immobile)
for i in range(0, 16*self.tickFactor):
pos = vector3(self.GetLocation())
dir = vector3(self.GetDirection())
self.NormalDriveToLocation((pos - dir * 3).asTuple(), True)
yield 0
# go forward for 2 seconds
for i in range(0, 16*self.tickFactor):
pos = vector3(self.GetLocation())
dir = vector3(self.GetDirection())
self.NormalDriveToLocation((pos + dir * 3).asTuple(), True)
yield 0
def InvertHandler(self):
# fire SRM once per two seconds (until we're upright!)
while 1:
self.Input("SRM", 0, 1)
for i in range(0, 8*self.tickFactor):
yield 0
def Think(self):
self.Evaluate()
self.countdownToEvaluation = 8*self.tickFactor
def DriveToWaypoints(self, waypoints, in_reverse = False):
throttle = 0
found = False
while len(waypoints) > 0 and not found:
grid = waypoints[0]
pos = Arenas.currentArena.FromGrid(grid)
dist = self.GetDistanceTo(pos)
if dist < 1:
waypoints.pop(0)
else:
# drive to this point
h = self.GetHeadingTo(pos, in_reverse)
self.DebugString(6, str(self.GetHeading(False)))
self.DebugString(7, str(h))
h -= math.pi / 8 * self.direction
if h > math.pi: h -= 2 * math.pi
elif h < -math.pi: h += 2 * math.pi
h = abs(h)
if abs(self.GetTurning()) > self.spinspeed:
turnFactor = ((h - self.accuracy) * (h - (math.pi - self.accuracy) ) / self.rampupfactor)
if (h>1.57):
TurnInput = int(max(100 * turnFactor, 0) * self.direction)
ThrottleInput = int((100 + TurnInput) * -1)
self.Turn(TurnInput)
self.Throttle(ThrottleInput)
if (h<1.57):
TurnInput = int(max(100 * turnFactor, 0) * self.direction)
ThrottleInput = int((100 + TurnInput))
self.Turn(TurnInput)
self.Throttle(ThrottleInput)
else:
self.Turn(100 * self.direction)
found = True
if len(waypoints) == 0:
self.Turn(100 * self.direction)
self.Throttle(0)
return found
def NormalDriveToLocation(self, world_location, in_reverse = False, update_path = True, last_path = []):
if self.GetDistanceTo(world_location) > 1:
if update_path:
a = Arenas.currentArena
a.SetSearchRadius(self.fRadius)
waypoints = list(a.GetPath(self.GetLocation(), world_location, False))
else:
waypoints = last_path
if len(waypoints) > 0:
return self.NormalDriveToWaypoints(waypoints, in_reverse)
else:
return False
else:
self.Throttle(0)
self.Turn(0)
return False
def NormalDriveToWaypoints(self, waypoints, in_reverse = False):
throttle = 0
found = False
while len(waypoints) > 0 and not found:
grid = waypoints[0]
pos = Arenas.currentArena.FromGrid(grid)
dist = self.GetDistanceTo(pos)
dir = 1
if in_reverse: dir = -1
if dist < 1:
waypoints.pop(0)
else:
# drive to this point
h = self.GetHeadingTo(pos, in_reverse)
self.AimToHeading(h, in_reverse)
speed = self.GetSpeed()
# slow down if we have to turn sharply
if dist < abs(speed) and (h > .4 or h < -.4):
throttle = 0
self.boost_throttle = self.max_throttle
else:
if speed * dir < self.top_speed:
h = max(min(h, .4), -.4)
# drive slower the more we need to turn our heading
mps = dir * (.5 - abs(h)) * self.top_speed
# boost throttle if we're not going as fast as we'd like
if (dir > 0 and speed < mps) or (dir < 0 and speed > mps):
self.boost_throttle += (self.max_throttle * .1)
throttle = dir * (.5 - abs(h)) * self.boost_throttle
else:
throttle = 0
self.boost_throttle = self.max_throttle
found = True
self.Throttle(throttle)
if len(waypoints) == 0:
self.Turn(0)
self.Throttle(0)
return found
# WIP, convert this into array for support of more wheel sides
def Throttle(self, throttle):
# if we're car steering and we're not moving much, throttle up
if self.bCarSteering and self.last_turn_throttle != 0:
speed = self.GetSpeed()
if speed > 0 and speed < self.top_speed / 3: throttle = self.last_throttle + 10
elif speed < 0 and speed > -self.top_speed / 3: throttle = self.last_throttle - 10
throttle = min(max(throttle, -100), 100)
if self.bInvertible and self.IsUpsideDown(): throttle = -throttle
self.set_throttle = throttle
self.Input('Forward', 0, throttle)
self.DebugString(0, "Throttle = " + str(int(throttle)))
def Turn(self, turning):
turning = min(max(turning, -100), 100)
self.set_turn_throttle = turning
self.Input('LeftRight', 0, -turning)
self.Input('LeftRight', 1, turning)
self.DebugString(1, "Turning = " + str(int(turning)))
AI.register(FBSInvertPlus)
Now on the DSL when I'm playing with robots heavier (H) the game begins to lag is heavy for my pc?well of course that always happens with huge bots like shws and the such
About prohibited you mean in online games can not use these weapons?if you make a showcase and showcase bots with those weapons you will be scolded, they are also banned from ai tournaments held by us (https://gametechmods.com/forums/index.php/board,121.0.html (https://gametechmods.com/forums/index.php/board,121.0.html))
How to put the engine and propeller inside of the battery? With snapper bust II engine know what is possible but in this case he is not used.http://www.youtube.com/watch?feature=player_embedded&v=Bs_ia4sTwHQ# (http://www.youtube.com/watch?feature=player_embedded&v=Bs_ia4sTwHQ#)
http://imageshack.us/photo/my-images/137/roboty.png/ (http://imageshack.us/photo/my-images/137/roboty.png/)
OR you could put a 60 or 80cm extender on a motor, attach a rad by its end and spin both the motors while switching tabsHow to put the engine and propeller inside of the battery? With snapper bust II engine know what is possible but in this case he is not used.http://www.youtube.com/watch?feature=player_embedded&v=Bs_ia4sTwHQ# (http://www.youtube.com/watch?feature=player_embedded&v=Bs_ia4sTwHQ#)
http://imageshack.us/photo/my-images/137/roboty.png/ (http://imageshack.us/photo/my-images/137/roboty.png/)
Hope you understand well enough. If you have any more questions please make a topic for them in Technical Support (https://gametechmods.com/forums/index.php/board,67.0.html).
list.append(("Technoderp","ElectricHammer",{'nose':math.pi,'invertible':True,'radius':1.5,'topspeed':99,'throttle':100,'turn':50,'turnspeed':1.5,'MotorID':14,'NoChassisTime':-1,'StartAngle':-math.pi,'SwingTime':5,'weapons':(15,)}))
Can I see a picture of the bot?^This^
try going into decimals such as math.py*1.5Hmm, that doesn't work either...Can I see a picture of the bot?No, but I'll tell you that it uses omni.py and is the first bot I've ever tried to AI which uses tank tracks, which may be why this is happening. I have no idea if it is for sure and if it is I don't have a clue why, but I don't know what else it could be.
DP-Need more AI help. What fun!
I'd like to know what .py file, wiring setup and smartzone types and names Thunderhead (created by Clickbeetle) has. The reason is that I'm trying to AI a Tazbot replica.
can you post the link ?Found it, but sadly, the thread to it has 404'd.DP-Need more AI help. What fun!
I'd like to know what .py file, wiring setup and smartzone types and names Thunderhead (created by Clickbeetle) has. The reason is that I'm trying to AI a Tazbot replica.
Dig through the first few pages of this thread and you'll find it. It's by Philetbabe (and even comes with its own Tazbot replica)
https://gametechmods.com/uploads/files/tazbot.rar (https://gametechmods.com/uploads/files/tazbot.rar)Found it, but sadly, the thread to it has 404'd.DP-Need more AI help. What fun!
I'd like to know what .py file, wiring setup and smartzone types and names Thunderhead (created by Clickbeetle) has. The reason is that I'm trying to AI a Tazbot replica.
Dig through the first few pages of this thread and you'll find it. It's by Philetbabe (and even comes with its own Tazbot replica)
The URL has to be updated, although that's not the one Badnik was talking about.https://gametechmods.com/forums/showthread.php?t=1492 (https://gametechmods.com/forums/showthread.php?t=1492)can you post the link ?Found it, but sadly, the thread to it has 404'd.DP-Need more AI help. What fun!
I'd like to know what .py file, wiring setup and smartzone types and names Thunderhead (created by Clickbeetle) has. The reason is that I'm trying to AI a Tazbot replica.
Dig through the first few pages of this thread and you'll find it. It's by Philetbabe (and even comes with its own Tazbot replica)
Big name for little AI !
https://gametechmods.com/uploads/files/tazbot.rar (https://gametechmods.com/uploads/files/tazbot.rar)
this is a variant of 'SpinServo AI'. it is based on Madiaba work.
Here the servo must spin horizontaly only, but you may attach it a spin motor or a fired weapon (piston). In both case, no need of custom zone.
Sample shows TazBot from DSL 2.1
Fixed : the AI seems to crash the game when the bot is inverted !
Can someone AI this robot with ElectricHammer.py please? Every time I do it the hammer doesn't want to work.Please?
https://gametechmods.com/uploads/files/AI this please.rar (https://gametechmods.com/uploads/files/AI this please.rar)
list.append(("Narrowhead","Rammer",{'invertible':True,'ThresholdSpeed':1.5,'radius':0.5,'topspeed':100,'throttle':100,'turn':30,'turnspeed':2,'weapons':(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24)}))
Is there anyway to AI bots using OmniInverted so that they don't have to turn around after they flip themselves over? I'm tired of fighting robots such as Drowning Pool that have to turn around to face me right after they invert themselves. I tried messing around with the nose settings so that the bot's starting position would result in the bot facing the right way right after inverting itself, but the bot then turns around and drives away from the opponent. I also tried messing around with the drive wiring but still to no avail. Anyone have any other suggestions?
Most .pys already auto-switch to Shove/Ram tactics if their spinner breaks.Quick question, I'm trying to use SwitchWep.py to get a spinner to stop spinning and go to Pusher.py if the weapon breaks, how would I do this?So is there any way to do this?
You mean the numbers? If so, then only the ones that I'd need the robot to switch tactics for if it broke (so things like static weapons were not included)
list.append(("Toxic Wound","Omni",{'range':50,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5,'weapons':(13,)}))
Quick question. In a line of bindings using omni.py, which is the variable that determines how far over a bot has to tip before it uses its srimech? Or does such a variable exist?
list.append(("Kurt Rambis 2","Rammer",{'ThresholdSpeed':1.5,'SightRange':4,'invertible':True,'radius':0.5,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5}))
Put the bot and AI line up.https://gametechmods.com/uploads/files/6512Gaze.zip (https://gametechmods.com/uploads/files/6512Gaze.zip)
list.append(("Gaze","Omni",{'invertible':True,'radius':0.1,'topspeed':99,'throttle':130,'turn':60,'turnspeed':2.5,'range':99,'weapons':(0,)}))
Having a bit of trouble with FBS_2.py, it says in the file that if I enter any number other than 1 for the 'clockwise' value in the bindings, it'll spin left (the way I need it to spin), but I've tried a bunch of different numbers including negatives with no luck. Any tips?
list.append(("RNF-0032III Cutting Wedge III","Flipper",{'nose':math.pi*2,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13,14,15,16,17,18,19)}))
Weapons 12-19 are all razors. list.append(("RNF-0016 Roto Destructo (SHW)","DirectionalSpinner",{'nose':math.pi*2,'radius':0.2,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':3,'weapons':(14,15,16,17,18,19,20,21,22,23,24,25)}))
Weapons 14-25 are all Large beater bars.Your code
Ok, so I need help AIing ty4er's Tusslers 3 robot. The robot refuses to drive when AI'd even though it drives fine in the bot lab, any ideas?
Put the bot and AI line up.https://gametechmods.com/uploads/files/6512Gaze.zip (https://gametechmods.com/uploads/files/6512Gaze.zip)Code: [Select]list.append(("Gaze","Omni",{'invertible':True,'radius':0.1,'topspeed':99,'throttle':130,'turn':60,'turnspeed':2.5,'range':99,'weapons':(0,)}))
I think the problem is that the arrow that tells the bot which way is facing forward is actually facing up, so the ai gets confused. I think you need a special ai, but I have no idea what would work.Click had a bot just like this that runs off of Omni, I even tried the binding line from it (courtesy of Fracture) and it still didn't want to work.
I think the problem is that the arrow that tells the bot which way is facing forward is actually facing up, so the ai gets confused. I think you need a special ai, but I have no idea what would work.You are absolutely correct. I got it working with an old AI of mine but I am reluctant to release an unfinished AI... I guess I'll send it via PM. I'll work on fixing it when I'm in the mood for doing it (I've been doing a lot on the Bot Exchange today so I don't really feel like messing with this ATM).
index 15
Hydrovian Expeditionary Force
"Nondefeat through denial of victory."
AI\hef.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
list.append( ("WAHEY","VertSpinner",{'nose':math.pi*2,'invertible':False,'range':50,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5,'TrollDanceZone':1,'weapons':(0,),'sweapons':(0,)}))
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics
class FRWL(AI.SuperAI):
"The Clamp/Spin AI for From Russia With Love!"
name = "FRWL"
def __init__(self, **args):
AI.SuperAI.__init__(self, **args)
self.tactics.append(Tactics.Charge(self))
self.tactics.append(Tactics.Shove(self))
self.spin_range = 3.0
if 'range' in args:
self.spin_range = args.get('range')
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("squeeze", 1)
return AI.SuperAI.Activate(self, active)
def Tick(self):
targets = [x for x in self.sensors.itervalues() if x.contacts > 0]
if len(targets) > 0:
self.Input("Clamp", 0, 100)
else:
self.Input("Clamp", 0, 0)
if self.weapons:
# spin up depending on enemy's range
enemy, range = self.GetNearestEnemy()
if enemy is not None and range < self.spin_range:
self.Input("Spin", 0, 1)
elif self.GetInputStatus("Spin", 0) != 0:
self.Input("Spin", 0, 0)
return AI.SuperAI.Tick(self)
def RobotInRange(self, robot_id):
"Return tuple of (part-of-robot-in-range, chassis-in-range)"
# GetLastDamage returns: component damaged, amount, at time, by player, by component
range = self.GetDistanceToID(robot_id)
if range < self.spin_range:
damage = self.GetLastDamageReceived()
if damage[3] == robot_id and (plus.getTimeElapsed() - damage[2] < 1.0):
return (True, True)
return (False, False)
def LostComponent(self, id):
#print "Lost Component!"
return AI.SuperAI.LostComponent(self, id)
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)
AI.register(FRWL)
Good evening, gentlemen.
I seem to be having problems with my first AI. I'm running DSL 3. In an Exhibition match, the game loads fine, but when it starts the camera is pointing off somewhere else and the game crashes after 11 seconds.
Here is my team code:Code: [Select]index 15
Hydrovian Expeditionary Force
"Nondefeat through denial of victory."
AI\hef.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
And my Bindings.py line:Code: [Select]list.append(G("WAHEY","VertSpinner",{'nose':math.pi*2,'invertible':False,'range':50,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5,'TrollDanceZone':1,'weapons':(0,),'sweapons':(0,)}))
Any ideas?
It says "sweapons" instead pf "weapons". Also, wtf is "TrollDanceZone". And I'd use Omni instead of VertSpinner. It's easier for me. You don't have to, but it would probably be easier.There is weapons in there too. TrollDanceZone was a feature Click added to stop VS from Troll Dancing as much as they normally do.
list.append(("Taurus","Rammer",{'invertible':True,'nose':math.pi,'radius':0.1,'topspeed':160,'throttle':160,'turn':60,'turnspeed':2.5}))
I'm using DSL 3 with Wham's Robot Wars 2013 AI Pack beta installed.
index 15
The Forgotten
"Does anyone remember us?"
AI\who.bmp
Robots: 0 1 2
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
Is who.bmp a 128/128 24-bit bitmap?Just looked that up and no, somehow I overlooked that. Working now, thanks!
There's already plenty of robots that can score OOTA purposefully. Just fight Second Sentinel in the DSL Tournament Arena for example.Nowhere in Second Sentinel's code does it say that it should throw a bot OOTA. It may have a tendency of doing it but it certainly doesn't do it intentionally. More to point, there currently aren't any AI.py files that throw bots OOTA intentionally.
i was thinking of a new py file for flippers that i named for now OOTA.py:You could use Arenas.currentArena.RayTest to try to find walls. Technically, the map files were designed for this type of thing but they are very inaccurate and many arenas don't have them. The problem is that arenas aren't always flat so you would need some funky handling for ramps.
So basically when the enemy goes into the flipper smartzone the robot charges to the nearest wall and when close enough, fire the flipper which is going to ensure a quite high degree of OOTA chance
now i have no clue of this is possible
list.append(("29 minutes to HELL", "Pusher",{'invertible':False,'radius':0.1,'topspeed':100,'throttle':100,'turn':60,'turnspeed':2.5,'weapons':(7,9)}))
Doesnt work. Does pusher have a different srimech name or something?list.append(("29 minutes to HELL", "OmniRam",{'invertible':False,'radius':0.5,'throttle':100,'turn':55,'turnspeed':2.4,'weapons':(4,5)}))
list.append(("For Danny", "Pusher",{'invertible':True,'radius':.5,'turn':20,'turnspeed':1.5,'weapons':(7,)}))
list.append( ("Nonstop", "FBS_2", {'radius':1, 'invertible': True, 'topspeed' : 100, 'throttle' : 110,'range':5,'fbs_range':15,'clockwise':1,'turnspeed': 1.5, 'weapons': (25, 26) }) )
list.append(("Algae2","FBSInvertDir",{'spinspeed':18,'invertible':True,'direction':1,'nose':0,'radius':0.1,'topspeed':1000,'throttle':1000,'turn':190,'turnspeed':30,'weapons':(0,)}))
Does anyone have EternalFlame.py?it's in NarAI somewhere.
Does anyone have EternalFlame.py?it's in NarAI somewhere.
https://gametechmods.com/Robot_Exchange/DSL_HW/MassimoV_Spaulding%202.bot (https://gametechmods.com/Robot_Exchange/DSL_HW/MassimoV_Spaulding%202.bot)have you tried putting the Up Arrow as the postive axis and the down arrow as the negative axis in the controls
Can't for the life of me AI this robot.
Thanks!ok
EDIT:
Doesnt work:Code: [Select]list.append(("29 minutes to HELL", "OmniRam",{'invertible':False,'radius':0.5,'throttle':100,'turn':55,'turnspeed':2.4,'weapons':(4,5)}))
there's a space right here: :thumbdownmaybe
list.append(("29 minutes to HELL", "OmniRam",{'invertible':False,'radius':0.5,'throttle':100,'turn':55,'turnspeed':2.4,'weapons':(4,5)}))
Could that be the problem?
doesnt workthere's a space right here: :thumbdownmaybe
list.append(("29 minutes to HELL", "OmniRam",{'invertible':False,'radius':0.5,'throttle':100,'turn':55,'turnspeed':2.4,'weapons':(4,5)}))
Could that be the problem?
but
doesnt it crash at the splash screen if there is a coed problem?
ill try it tomorrow g2g
It seems like it may be either a probem with your bot or the bot you are fighting it against.i tested it against 5 different bots
can someone tell me what's wrong with these bindings? they just sit there immobolized.
Are your controls properly named?
anyone know how to stop this stuff from showing up when watching fights that involve bots that have laserguidedv2.py as their ai?
(https://gametechmods.com/uploads/images/97307ra2stuff.png)
# to display the current angle of the servo motor uncomment thoses lines :
self.debug = True
AI.SuperAI.debugging = True
How do I AI this?
(https://gametechmods.com/uploads/images/37834gay.jpg)
electrichammer.py? Just copy/edit bisectors AI from DSL BBEANS AI.
Just curious, but has anyone tried a "take-opponent-to-hazards" py file?
for example
robot in smart zone -> actively aim for hazards instead of avoid them
Might make some wedge matches more interesting.
if list(plus.getDirection(self.GetID(),0))[1] < -0.9:
self.Input("Srimech", 0, 1)
list.append(("Smite Jr","ElectricHammer",{'nose':math.pi,'invertible':True,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5,'NoChassisTime':2,'StartAngle':math.pi,'SwingTime':5,'weapons':(0,)}))
Also for some reason, one wheel clips through the floor on the small arena and I have no idea why.Probably due to the small arena having very low start points, I'll see if I can raise them.
What would the code be for eternalflame.py?
list.append(("Enter Bot Name","EternalFlame",{'invertible':True,'flame_range':99,'radius':0.1,'throttle':130,'topspeed':99,'turn':50,'turnspeed':2,'weapons':(0,)}))
Thank You :DMake sure you have an analog control connected to the flamethrower called "Flame" too
import math
def load(list):
print "Loading AI bindings"
# binding format:
# ( 'name of robot from .bot file', 'name of AI from script class',
# {'optional constructor parameter':value, 'another':value} )
# constructor parameters:
# nose - "front" of bot in radians (default 0)
# invertible - can function upside-down (default False)
# topspeed - speed in meters/second AI will attempt not to exceed (default 4.0)
# throttle - maximum analog value AI will attempt not to exceed (default 100)
# turnspeed - turning in radians/second AI will attempt not to exceed (default 2.5)
# turn - maximum analog value AI will attempt not to exceed (default 60)
# radius - bot radius to use for checking for hazards and walls (default 1.0)
# 0 - Finished "That's where your bot will be after ten seconds with ours!"
list.append(("A Torner","Spinner",{'nose':math.pi*2,'radius':0.1,'topspeed':100,'throttle':100,'turn':30,'turnspeed':5,'weapons':(8,9)}))
list.append(("Assassin The Finest","DirectionalSpinner",{'invertible':True,'nose':math.pi*2,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':5,'weapons':(13,14,16,17,18)}))
list.append(("Bang Bang","Rammer",{'nose':math.pi*2,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':5,'weapons':(18,19)}))
list.append(("Bashur","DirectionalSpinner",{'nose':math.pi,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(25,)}))
list.append(("Beast","DirectionalSpinner",{'nose':math.pi,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(4,)}))
list.append(("Bolt","Rammer",{'invertible':False,'nose':math.pi,'range':99,'radius':0.1,'topspeed':100,'throttle':80,'turn':25,'turnspeed':1.5,'weapons':(20,)}))
# 1 - Finished "Badder and still bloodthirsty!"
list.append(("Clusterbot Spinnys","DirectionalSpinner",{'nose':math.pi,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5}))
list.append(("Crank Dat Spine","Whipper",{'invertible':True,'nose':math.pi*2,'radius':0.2,'topspeed':100,'throttle':130,'turn':60,'turnspeed':3.5,'weapons':(10,11,12,13,14,15,16,17,18,19)}))
list.append(("Cypher","DirectionalSpinner",{'invertible':True,'nose':math.pi*2,'range':500,'radius':1,'topspeed':3,'throttle':130,'turn':60,'turnspeed':5,'weapons':(27,28,29,30,35,36,37,38,39,40,41,42,43,44,45,46,47,48,53,54)}))
list.append(("DarkNight","Rammer",{'nose':math.pi,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5}))
list.append(("Destiny Is Final","DirectionalSpinner",{'nose':math.pi,'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(24,25,26)}))
list.append(("Flatire","DirectionalSpinner",{'nose':math.pi,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(6,23)}))
# 2 - Finished "Don't need nuthin' but my truck, my shotgun, my new bots, and my REVENGE!"
list.append(("Force","DirectionalSpinner",{'nose':math.pi*2,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5}))
list.append(("Foul Lem","DirectionalSpinner",{'nose':math.pi*2,'radius':.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':3,'weapons':(3,4,5,6)}))
list.append(("Frightener","Poker",{'nose':math.pi*2,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':30,'turnspeed':3,'weapons':(22,23,24,25)}))
list.append(("Fwacker","DirectionalSpinner",{'nose':math.pi,'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(17,)}))
list.append(("Harmless","Poker",{'invertible':True,'nose':math.pi,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(6,)}))
list.append(("Lavra","DirectionalSpinner",{'invertible':True,'nose':math.pi*2,'radius':1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(11,),'sweapons':(28,29,)}))
# 3 - Finished "If you defeat us again, we will sneak in at night and steal your bots."
list.append(("No Mercy 4 U","Poker",{'nose':math.pi*2,'range':99,'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2,'weapons':(4,5)}))
list.append(("Nothing Is Everything But Me","DirectionalSpinner",{'nose':math.pi*2,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':3.5,'weapons':(9,10)}))
list.append(("Red Brawler","DirectionalSpinner",{'invertible':True,'nose':math.pi*2,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':1,'weapons':(13,14,15,16)}))
list.append(("Slam and Dank","Rammer",{'invertible':True,'radius':0.3,'range':2.5,'topspeed':100,'throttle':130,'turn':60,'turnspeed':3,'weapons':(25,)}))
list.append(("Slam and Dank (Thwack)","Whipper",{'invertible':True,'nose':math.pi,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(19,)}))
list.append(("Slice and Dice 'em","DirectionalSpinner",{'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(55,)}))
# 4 - Finished "The BLACK STORM was only getting started with our old bots!"
list.append(("SpamYou","Spinner",{'nose':math.pi*2,'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(19,)}))
list.append(("Spikez","DirectionalSpinner",{'nose':math.pi*2,'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2}))
list.append(("Stein","Poker",{'nose':math.pi*2,'radius':0.1,'range':99,'topspeed':150,'throttle':130,'turn':60,'turnspeed':4,'weapons':(29,41,42)}))
list.append(("Tetsuke","Poker",{'nose':math.pi,'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':25,'turnspeed':3,'weapons':(7,)}))
list.append(("Toart","DirectionalSpinner",{'invertible':True,'nose':math.pi,'radius':0.1,'range':99,'topspeed':6,'throttle':60,'turn':60,'turnspeed':2.5,'weapons':(15,)}))
list.append(("Uproar","Flipper",{'invertible':False,'nose':math.pi,'range':99,'radius':0.1,'topspeed':100,'throttle':130,'turn':30,'turnspeed':3,'weapons':(25,29)}))
# 5 - Finished "EMERGENCY is back with a vengeance, faster and more furious."
list.append(("WeSpin","Spinner",{'nose':math.pi*2,'radius':0.1,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,)}))
list.append(("Yayuia","Spinner",{'nose':math.pi*2,'radius':0.1,'topspeed':100,'throttle':130,'turn':130,'turnspeed':5,'weapons':(12,17)}))
topic merged with ai topic.Thx Nary.
5 turnspeed is way too high for anything that isn't a SnS. Look at some other AI lines (like the ones in Starcore AI v4).Okay (I took these from the DSL, btw). Thanks. Is that what makes the game crash before I can even enter the game?
You can also just copy+paste other AI lines and edit the number values and name to lower the chances of it crashing.
Have you tried just wiping the offending line and starting from scratch? When you can't solve the problem with a toothpick, a sledgehammer is the next-best thing.Okay, I'll see what I can do with this. Right now, I'm testing team by team. Sadly, I'm in need of sleep. So hopefully after school, It'll be resolved (Teams 0 and 1 are working, just not the nose). BTW, one of my robots goes in circles. Is that because of the controls (though I'm sure through testing it worked in the garage), or is it the turn/nose?
Amping your turnspeed up too high won't crash your game. Only way I could imagine the turnspeed number crashing your game is if you put it at some stupidly high number, like 999 billion. What's more likely to cause the crash is a misplaced or omitted comma. If you're using notepad++ you might want to turn off auto-indent too, that'll screw your bindings over easily.5 turnspeed is way too high for anything that isn't a SnS. Look at some other AI lines (like the ones in Starcore AI v4).Okay (I took these from the DSL, btw). Thanks. Is that what makes the game crash before I can even enter the game?
You can also just copy+paste other AI lines and edit the number values and name to lower the chances of it crashing.
Dangit, it didn't work. I'm still not sure what's making the game crash right away.
99 should work.No, I wired it "Spin" (No quotations), and I put 99. I'll check it again.
Maybe it's how you wired it ?
99 should work.No, I wired it "Spin" (No quotations), and I put 99. I'll check it again.
Maybe it's how you wired it ?
Also, some of my robots spin very late anyways, even with 99 range. What should I do?
(By late, I mean as soon as the robots are touching, the motor spins, doing, like, little to no damage.)
I used a button, and I did, in fact, name it Spin. So I have no idea what's wrong.99 should work.No, I wired it "Spin" (No quotations), and I put 99. I'll check it again.
Maybe it's how you wired it ?
Also, some of my robots spin very late anyways, even with 99 range. What should I do?
(By late, I mean as soon as the robots are touching, the motor spins, doing, like, little to no damage.)
Are you using an analog or switch instead of a button ?
Do your robots have "weapon" values in their binding lines? If they don't, their weapons won't spin.... Damn it. I'll be right back. Thx Badnik.
If you don't wanna find the actual component numbers to use in the weapons section, just put 0 - this corresponds to chassis so the bot will always try to spin the weapons as long as the range is triggered (even if the weapons aren't there)Thankfully, it works now. (For some reason, I'm feeling more doubt of starting a tourney, now.)
list.append(("Kitten","Omni",{'nose':math.pi,'invertible':True,'range':50,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5,'weapons':(0)}))
list.append(("Kitten","Omni",{'nose':math.pi,'invertible':True,'range':99,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':1,'weapons':(0,)}))
Did you remember teams.txt?Doesn't matter. I tried it with teams.txt and it still didn't work. The new AI line works, for some reason, though.
edit: 2slowNot even. You just didn't read the fact a solution was found.
Few things I've been wondering.Hopefully I helped out.
- Is there an AI file that uses drive for a srimech? I've tried just wiring the drive as "Srimech", but once the bot is upright, it's drive stays stuck as if it were still upside-down. Somewhat. BountyHunter.py combines driving and fires whatever weapon (typically popup) to self-right. Probably the closest thing you might get.
- Is there an AI that uses smartzones to spin a weapon motor? I believe EcoOmni does this, and it saves battery life.
- Is InvertOmni.py the AI that flips the robot, then fights? If so, is there a specific way to wire it? Yep, and the I believe the button for the inverter needs to wired as "Invert."
- Is InvertOmni.py the AI that flips the robot, then fights? If so, is there a specific way to wire it?
#Set variable 'RunUpsideDown' to 1 for bots that flip over at the beginning of the match and fight upside down. Such bots must be invertible as well.
# UPDATE 7/4/11: Added support for upside down bots, conditional invertibility, and made AI fire srimech if the bot is stuck on its rear.
I'm trying to AI an SnS, but I want it to spin in the opposite direction from normally. What portion of the AI line in FBSPlus.py or FBSInvertDir.py determines the direction of the spin?'direction':1
I need a different AI for one of the robots for Pot Luck 2 (Guess which). What I need is other.py (Littlemetalfriend) but for it to raise a linear actuator up to its max when nothing is in the smartzone.
Any ideas?
def Tick(self):
targets = [x for x in self.sensors.itervalues() if x.contacts > 0]
if len(targets) > 0:
# TODO: squeeze and push? or whip?
self.Input("Lefthook", 0, -100)
self.Input("Righthook", 0, -100)
else:
# TODO: open arms back up?
self.Input("Lefthook", 0, 0)
self.Input("Righthook", 0, 0)
return AI.SuperAI.Tick(self)
def Tick(self):
targets = [x for x in self.sensors.itervalues() if x.contacts > 0]
if len(targets) > 0: #When stuff in smartzone. Push Kill trigger
self.Input("Kill", 0, 1)
else: #When smartzone empty, Fully raise lineal acutator
self.Input("RaiseLinAcu", 0, 100)
return AI.SuperAI.Tick(self)
Anyone know where I can find DirectionalSpinner.py?
IIRC, DirectionalSpinner is at the bottom of Spinner.py
derpAnyone know where I can find DirectionalSpinner.py?IIRC, DirectionalSpinner is at the bottom of Spinner.py
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.
Hi there,Let me have a look at the popup.py
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
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)
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
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 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)
if 'triggers' in args: self.triggers2 = args['triggers']
With if 'srimech' in args: self.triggers2 = args['srimech']
if 'zone' in args: self.zone = args['zone']
With if 'zone' in args: self.zone1 = args['zone']
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?
What does nochassistime actually do?
Ok made the changes except the SmartZoneEvent thing.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.
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?
The weapon numbers correspond to all the components you want the AI to consider as weapons. Once all of those are knocked off the AI will switch tactics, usually to shove but some AIs might use secondary weapons (sweapons) etc...
Commonly people use the weapon id 0 which corresponds to the chassis so the AI will never switch tactics, which is normally fine.
To find weapon IDs you can count down components in the bot file or use the bot exporter.
The bot exporter is this old thing
https://gametechmods.com/forums/index.php?action=downloads;sa=view;down=97
See link above for bot exporter. It gives all the components numbers in a nice format.
Then in the AI line you specify which components must fall off before the AI considers the weapon system destroyed and will change tactic. As I said it's not always necessary to bother.
You need the VB6 runtime to use the exporter
https://support.microsoft.com/en-us/kb/957924
You sure it's a capital S on the control? Try using omni.py. Ifyou still can't get it to worm PM it to me and I'll take a look.Yes it's a capital S, didn't work with omni, here's the line in Bindings.py:
It might not spin up as you haven't given it a weapons parameter. Go look at another AI line and compare.Thought the weapons parameter was only required for it to stop attacking once a certain part ID breaks, how would I make it keep attacking even if every weapon breaks?
set it to 0, the chassisIt might not spin up as you haven't given it a weapons parameter. Go look at another AI line and compare.Thought the weapons parameter was only required for it to stop attacking once a certain part ID breaks, how would I make it keep attacking even if every weapon breaks?
Works now(had that before but didn't notice it during testing)but only if I get really close to it(after that it keeps on spinning)set it to 0, the chassisIt might not spin up as you haven't given it a weapons parameter. Go look at another AI line and compare.Thought the weapons parameter was only required for it to stop attacking once a certain part ID breaks, how would I make it keep attacking even if every weapon breaks?
if it's still not spinning up instantly then it might be because you don't have a range parameter. try a line like this:Works now, thanks guys, thought that this parameter might be missing but didn't want to mess around more with it(already had the game crash like 10 times because of multiple errors), it is a button and not a switch(are there even switch controls for AI? think only buttons exist) full line is this:
list.append(("Mega Gator","Omni",{'invertible':True,'range':99,'topspeed':99,'turnspeed':3,'throttle':130,'range':99,'weapons':(0,)}))
also use a button instead of a switch. with a button the ai will just keep turning it on and off.
if it's still not spinning up instantly then it might be because you don't have a range parameter. try a line like this:Works now, thanks guys, thought that this parameter might be missing but didn't want to mess around more with it(already had the game crash like 10 times because of multiple errors), it is a button and not a switch(are there even switch controls for AI? think only buttons exist) full line is this:
list.append(("Mega Gator","Omni",{'invertible':True,'range':99,'topspeed':99,'turnspeed':3,'throttle':130,'range':99,'weapons':(0,)}))
also use a button instead of a switch. with a button the ai will just keep turning it on and off.
list.append( ("Mega Gator", "ModSpinner", { 'range':99, 'weapons': (0,) }) )
The other parameters are optional so I didn't add them.(also you have range twice?) Do top/turn speed and throttle go past the values that the bot would normally be able to get or do they keep those limits/only work for slowing the bot down and making it more controlable?
Would it be possible to create a bot that only starts using it's second weapon once the enemy hp reaches 0 or the first weapon(set via ID) breaks down?Yes. It is possible.
VB6 outputs programs as a simple .exe, which should work on all Windows systems, right? Assuming you have the correct C++ redistributable but you almost certainly already do.I was going to make a post saying that the X(VB6) runtimes are needed to run all X(in this case VB6) applications, so having them on your pc definitely wouldn't hurt.
How would one do that? I'm also interested on how you would read other stuff about the enemy bots, like their current rotation(based on their default forward heading),changing tactics depending on time left or being able to rotate your own bots servo motors until they reach a certain degree.Would it be possible to create a bot that only starts using it's second weapon once the enemy hp reaches 0 or the first weapon(set via ID) breaks down?Yes. It is possible.
By exploiting functions of the plus-class for fun and profit and code a custom Python AI.Thanks a lot, I'll try to mess around with those before I ask for more help. Is there a document or a page somewhere? It would make it much easier(which is the reason why I'm adding all my bots to the main post in the showcase) than browsing the entire thread in hopes of finding something.
Bind a button for secondary weapon. Use plus.GetHealth(BotID,0) to find HP and insert custom tactic to switch to when Enemy HP is 0 or all primary weapons are lost.
Use plus.getHeading(botID, useOffset) to get the Heading of the enemies, compare with your own to find their heading in comparison with yours.
Don't think there is a nice way to find time left, but maybe plus.getTimeElapsed could be used to change tactics based on time. A better way would be to maybe compare enemy points with your own and cower when in lead.
Use plus.AI.GetMotorAngle(MotorComponentID) to find the current servomotor angle. The first page in this thread explains usage.
There are a lot of good stuff buried in this thread, but it is worth reading through if you want to create custom AIs.
Add a StuckHandler and InvertHandler and put in your own code there. Standard is to move forward and backward when stuck or inverted. Some bot have InvertHandler code to fire SRMs or do other stuff. Facing the enemy when moving backwards leads to driving of the edge, a hazard, sticking into the wall.I'm still rather new to all this, so adding own commands will probably be out of question for now. The AI file I'm using is still the basic EternalFlame, might change some stuff to create my own one but it's currently only that.
Anyways, it would be easier to see whats wrong if you post the python file for the AI.
Sounds like your bot is turning too fast and is having to continuously correct itself. Try reducing the turn value in the bindings.I wonder why that happens to begin with. Both bots start on one side of the arena so they should move in a straight line. Isn't it supposed to use the wired Forward key instead of using the motors independently? And wouldn't that have a negative impact on turning for Left/Right movement?
The bot drives well manually? What AI does it use? Does that AI use the Engage tactic (like 90% of all AIs)It's a popup which uses popup.ai, I've had a similar thing happen with my VS before and both of them drive well manually.
What might be happening is that the AI overshoots its intended heading as the bot turns too quick for the standard tickInterval. Either cap turnspeed, maximum Turn input, or increase tickInterval.
anyone know of a .py that works like fbs_2, but reverses direction while inverted and isn't a meltybrain .py?Something like this ;)
Yeah, thanks apanxanyone know of a .py that works like fbs_2, but reverses direction while inverted and isn't a meltybrain .py?Something like this ;)
https://gametechmods.com/forums/index.php?action=downloads;sa=view;down=265
Tried messing around with turn and turnspeed(which made it worse), turn didn't seem to help but what's odd is that if my bot starts in the player 1 spawn of the combat arena it drives in a straight line, player2's start point however does that shuffling.Can you send me the bot? I'd like to have a crack at it.
Also what about the moving backwards straight/always face the AI and best place to get the most updated AI files?
Not sure how many Python coders we still have active in the community. I do RA2 python for fun, and rewriting the entire drive logic to do something else than turning towards target and driving forward is going to time to do, mostly testing to make sure that everything works as intended. I have a rough idea of what commands in the available python commands would be useful, but there are a lot of questions remaining. For example, when should the bot move forward or backwards? Through what data would it decide that?I didn't know this, take all the time you need as that's way more important than any of this AI stuff. I only wanted for this to not go under in all the posts here like it somewhat already did.
The most basic code would just be aiming for enemy and setting Forward to 100. The bot would always try facing the enemy and attempt to move forward. Take a look at the existing python files and try to do something like that. I am currently too busy to spend time on RA2, might maybe look at it during the end of next week. Hope you understand.
The closest thing to a master AI pack is the AI_essentials on Beetlebros' site.
I didn't know this, take all the time you need as that's way more important than any of this AI stuff. I only wanted for this to not go under in all the posts here like it somewhat already did.Check the AI files that come with the game. All AI inherit the SuperAI which is located in __init__.py in the AI folder. If you don't put in separate handlers, then the code in the SuperAI will be used.
While having a new drive logic that instantly targets the enemy would be interesting(and definitely something I'd like to do later) I'd want to simply fix the "stuck" part so that the robot doesn't stop driving backwards, facing sideways.
Would you be ok if I sent you a video, showing what goes wrong, in PM?
I'll try to mess around with it for a bit, the Unstuck Tactic is inherited from Tactics.py? I've noticed that Eternal Flame(which is apparently based on Omni.py) doesn't have a Stuck Handler.
I checked AI_essentials, that doesn't really have that many, so I guess all those AI files were done on a version of another AI file, guess that means it's best to copy over something that works and ask if it doesn't work/if you can't find something?
I hope that this community can get this AI file chaos a bit more sorted/get more into python files because it seems like most only copy something that works from a similar bot and are then done with it. Thanks for doing all this for the community.
phil's semi-famous AI chart that comes with a bunch of .py files (https://gametechmods.com/uploads/files/43968459AI-Chart-23.rar)What's the difference between 8459AI-Chart-2.3.rar and 43968459AI-Chart-23.rar? I checked your link and like the one I have it's still mentioning popup.py and missing it(like I said about a page ago), size of the rar also seems to be the same. I'm not annoyed, I just find it funny, was someone like "I'm tired of all those popups, there, file deleted, have fun" :laughing one of the most used designs isn't there. Will check Nar AI 2.7.
All the .py files that come with Nar AI 2.7, IIRC some of them don't work. (https://gametechmods.com/uploads/files/4816py files.zip)
Check the AI files that come with the game. All AI inherit the SuperAI which is located in __init__.py in the AI folder. If you don't put in separate handlers, then the code in the SuperAI will be used.Thanks, will do.
Also check out the Tactics.py.
No idea what's different. phil probably just forgot to include Popup.py when he complied it all like 6 years ago, plus that's before it was really popular to use.phil's semi-famous AI chart that comes with a bunch of .py files (https://gametechmods.com/uploads/files/43968459AI-Chart-23.rar)What's the difference between 8459AI-Chart-2.3.rar and 43968459AI-Chart-23.rar? I checked your link and like the one I have it's still mentioning popup.py and missing it(like I said about a page ago), size of the rar also seems to be the same. I'm not annoyed, I just find it funny, was someone like "I'm tired of all those popups, there, file deleted, have fun" :laughing one of the most used designs isn't there. Will check Nar AI 2.7.
All the .py files that come with Nar AI 2.7, IIRC some of them don't work. (https://gametechmods.com/uploads/files/4816py files.zip)
self.RemoveTactic("Unstuck")
self.tactics.append(Tactics.Unstuck2(self, self.StuckHandler()))
self.RemoveTactic("Unstuck")
self.tactics.append(Unstuck2(self, self.StuckHandler()))
class Unstuck2(AI.Tactic):
name = "Unstuck2"
def __init__(self, ai, unstuck_function):
self.UnstuckFunction = unstuck_function
AI.Tactic.__init__(self, ai)
def Evaluate(self):
# try to move if we're immobile and we either have no enemy
# or he was pinned after us
self.priority = 200
ai = self.ai
# move to free ourselves unless our most recent enemy was stuck first
if not ai.bImmobile: self.priority = -1000
elif ai.GetID() in ai.immobile_list and \
ai.enemy_id in ai.immobile_list and \
ai.immobile_list[ai.GetID()] > ai.immobile_list[ai.enemy_id]:
self.priority = -1000
def Execute(self):
self.ai.Throttle(0)
self.ai.Turn(0)
self.UnstuckFunction.next()
return True
class Flee(AI.Tactic):
name = "Flee"
def Evaluate(self):
self.priority = 0
self.target_id, range = self.ai.GetNearestEnemy()
# TODO: come up with a priority scale for "engaging"
if self.target_id != None:
self.priority = 170
else:
self.priority -= 1000
def Execute(self):
if self.target_id != None:
self.ai.enemy_id = self.target_id
# default turning & throttle off
self.ai.Throttle(0)
self.ai.Turn(0)
target = plus.getLocation(self.target_id)
# try to get out of range of chassis...
if self.ai.GetDistanceToID(self.target_id) < 40 and self.ai.GetDistanceToID(self.target_id) > 10:
# ... then aim for center of chassis
h = self.ai.GetHeadingTo(target, False)
self.ai.AimToHeading(h)
self.ai.Throttle(-100)
if self.ai.GetDistanceToID(self.target_id) < 10:
h = self.ai.GetHeadingTo(target, False)
self.ai.AimToHeading(h + math.pi / 2)
self.ai.Throttle(-100)
return True
else:
return False
list.append(("Drunken Robot Pornography","LittleMetalFriend",{'nose':math.pi,'radius':0.5,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(0,)}))
https://gametechmods.com/uploads/files/5864Bot5.rar (https://gametechmods.com/uploads/files/5864Bot5.rar)(https://gametechmods.com/uploads/images/90399screenshot_3.jpg)Just curious, how did you get it workingCode: [Select]list.append(("Drunken Robot Pornography","LittleMetalFriend",{'nose':math.pi,'radius':0.5,'range':99,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(0,)}))
https://gametechmods.com/uploads/files/5864Bot5.rar (https://gametechmods.com/uploads/files/5864Bot5.rar)
Saw on a servo, dunno how to get the arm working right, needs to self-right, riddled with AGOD.
Anyone know how to help? Please and thank you.
Well, don't just stand there, fix it.I do have a github account even and understand the basics, but still felt like this is such a minor thing that it's better done in a bigger change instead of filling up the changelog like that(at least that's what I was once told, still think it depends on case) is it possible to do a pull request without adding the file to one's own github?
Fork, commit, do pull request
http://crunchify.com/how-to-fork-github-repository-create-pull-request-and-merge/
https://github.com/apanx/RA2_AI/
list.append(("Casualty","Bee",{'invertible':True,'nose':math.pi,'whip':around,'topspeed':99,'throttle':130,'turnspeed':2.5,'turn':60,'radius':0.3,'range':99,'weapons':(1,2,3,4,5,6,7,8,9,10,11,12)}))
list.append(("Casualty","Bee",{'invertible':True,'nose':math.pi,'whip':"around",'topspeed':99,'throttle':130,'turnspeed':2.5,'turn':60,'radius':0.3,'range':99,'weapons':(1,2,3,4,5,6,7,8,9,10,11,12)}))
Anyone have an AI .py file that works with full-body spinners? Not SnS, I'm talking something like this:I guess the regular HS ones won't work for some reason because the AI's using the chassis for directions?
(https://images-2.discordapp.net/.eJwFwdENhCAMANBdGICWBiq6DUGC5pQSqPHjcrvfe1_zjMts5lDtcwPYz5ll7HaqjFSLrSL1Kqmf02a5IammfNyl6QTCldiFyMyIHCgikPdEzuGCzoc1cmB42qfJ22xv1fz-BT0izw.ZNPuJeLVSfiOAJzw54srbQ7CIDI)
where the chassis spins, but the drive doesn't.
I talked to apanx on discord about it but it doesn't seem like there's one readily available. I'm still kinda clueless about the whole python thing (the one i posted a few days ago was a pretty easy copy/paste job) so I'm basically stuck.
Yes, obviously.Anyone have an AI .py file that works with full-body spinners? Not SnS, I'm talking something like this:I guess the regular HS ones won't work for some reason because the AI's using the chassis for directions?
(https://images-2.discordapp.net/.eJwFwdENhCAMANBdGICWBiq6DUGC5pQSqPHjcrvfe1_zjMts5lDtcwPYz5ll7HaqjFSLrSL1Kqmf02a5IammfNyl6QTCldiFyMyIHCgikPdEzuGCzoc1cmB42qfJ22xv1fz-BT0izw.ZNPuJeLVSfiOAJzw54srbQ7CIDI)
where the chassis spins, but the drive doesn't.
I talked to apanx on discord about it but it doesn't seem like there's one readily available. I'm still kinda clueless about the whole python thing (the one i posted a few days ago was a pretty easy copy/paste job) so I'm basically stuck.
Managed to edit together a new AI code. No idea if this has been done before, but I figured it'd be useful.
https://gametechmods.com/uploads/files/7620WimpOmni.rar (https://gametechmods.com/uploads/files/7620WimpOmni.rar)
This AI, as you can probably tell by its name, is a small variation on the standard Omni py file. Instead of switching to the Shove tactic when its weapons runs out, it instead switches to Evade (which is within Tactics_2.py, which I've included in the rar for ease of access). So instead of suiciding onto the opponent's remaining weapons, it runs away.
Yeah omni is still the standard for most bots.Managed to edit together a new AI code. No idea if this has been done before, but I figured it'd be useful.
https://gametechmods.com/uploads/files/7620WimpOmni.rar (https://gametechmods.com/uploads/files/7620WimpOmni.rar)
This AI, as you can probably tell by its name, is a small variation on the standard Omni py file. Instead of switching to the Shove tactic when its weapons runs out, it instead switches to Evade (which is within Tactics_2.py, which I've included in the rar for ease of access). So instead of suiciding onto the opponent's remaining weapons, it runs away.
Bump
Glad to see people are still using and adapting my Omni.py
Didn't know if it was still useful for people to AI their bots or if they had moved to something majorily different. That was some 12ish years ago.
Starcore
If I were to start my Tournament, would anyone AI for me?I'm afraid not...
3) If you cannot AI, do not start a thread until youhave found someone who is willing to AI for youlearn how to! The best place to ask for help is the General Tournament Discussion Thread.
Managed to edit together a new AI code. No idea if this has been done before, but I figured it'd be useful.do you know if there's a way to get this ai to evade without losing any components first?
https://gametechmods.com/uploads/files/7620WimpOmni.rar (https://gametechmods.com/uploads/files/7620WimpOmni.rar)
This AI, as you can probably tell by its name, is a small variation on the standard Omni py file. Instead of switching to the Shove tactic when its weapons runs out, it instead switches to Evade (which is within Tactics_2.py, which I've included in the rar for ease of access). So instead of suiciding onto the opponent's remaining weapons, it runs away.
Wow, YOu made that?Managed to edit together a new AI code. No idea if this has been done before, but I figured it'd be useful.
https://gametechmods.com/uploads/files/7620WimpOmni.rar (https://gametechmods.com/uploads/files/7620WimpOmni.rar)
This AI, as you can probably tell by its name, is a small variation on the standard Omni py file. Instead of switching to the Shove tactic when its weapons runs out, it instead switches to Evade (which is within Tactics_2.py, which I've included in the rar for ease of access). So instead of suiciding onto the opponent's remaining weapons, it runs away.
Bump
Glad to see people are still using and adapting my Omni.py
Didn't know if it was still useful for people to AI their bots or if they had moved to something majorily different. That was some 12ish years ago.
Starcore
Do you mean how to fill out the weapons tuple for a bot's AI line, like 'weapons':(16,17,18,19)? Easiest way is to download apanx's .bot exporter as it tells you all the components and their corresponding IDs. Or you can go into the file with Notepad++ and count in which order each component was attached with the first attached component being ID 1.Nice man!! I should be doing that tomorrow right after I wake up, err... Thanks a lot Fracture! I actually already came across the bot exporter but never thought it would be useful :claping
list.append(("BANNED","Popup",{'nose':math.pi,'invertible':True,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5,'NoChassisTime':2,'RunUpsideDown':1,'weapons':(0,)}))
https://gametechmods.com/uploads/files/4216badgers_angels.zip (http://overhead thwack bots i've made with ai for you to look at)
list.append(("Executioner","Judge",{'beta':-64000,'MotorID':0,'StartAngle':-math.pi/2,'reload':5,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':2.5,'weapons':(0,)}))
Ok, thanks 090901. Do you know where I can find those scripts?https://github.com/apanx/RA2_AI - This link contains all the latest versions of all the AI files the community has made for RA2
what redalert said is 100% wrong, if you're going to ai something with a geared beta you'll want to use electrichammer.py or thz.py and wire the flamethrower to the same analog control that controls the forward hammer swing.Just curious, but what about the Judge py? Because IIRC, I have been AI'ing my hammerbots that uses geared beta with the Judge py, according to the beta rep on DSL
Yes. I named the smartzone as flip and the control as flip (also tried changing them both to fire but to no avail) as well. Every other robot that I've AI'd with a flipper has worked fine, it's just Gravity that doesn't seem to want to cooperate.The control should be Flip with a capital F
Just as a note, this is for Flipper2.py. Omni.py should have the smartzone be named "weapon" and the control called "Fire". Smartzones are all lowercase, controls have their first letter capitalised.Yes. I named the smartzone as flip and the control as flip (also tried changing them both to fire but to no avail) as well. Every other robot that I've AI'd with a flipper has worked fine, it's just Gravity that doesn't seem to want to cooperate.The control should be Flip with a capital F
On The topic of making an AI With a flaming hammer, i don't really understand? What do you call the controlls, and what do you mean "put the flame and the hammer on the same one" :dead:It's named Fire for both the hammer and flamethrower. And the flamethrower and hammer are wired to a single control since it's both easier to AI and the flamethrower is supposed to activate when the hammer fires
Hate to double post, and i don't mean to keep asking questions but where do you find the MotorID for different motors? i've checked different files and throught the component .txt file things but i cant seem to find it anywhere... :confused:You have to count the components manually in the bot file,as the ID is based on the order you put the components. The MotorID is the same as component ID. First component placed has the ID of 1, with chassis being 0.
Got Gravity's flipper working. The problem? The control was named "fire" instead of "flip" :facepalm:OOF
# Flipper2.py last updated 7/24/12 by Clickbeetleit tries to be smart by not flipping things that are immobilized
# Update 7/24/12: Renamed this file to Flipper2.py so Flipper.py is not overwritten. Added customizable srimech firing interval.
# This AI will act normally as long as the opponent is moving. If the opponent stops moving, this AI will also stop and wait for the opponent to be counted out. If the opponent starts moving again, so will this AI. In a rumble, this AI will ignore any bots that aren't moving and will only stop if all opponents stop.
# Has support for two smart zone-based weapons and one analog-controlled spinner. Name the smart zones "flip" and "weapon" and the controls "Flip", "Fire", and "Spin". "Srimech" control for self-righting. Note you must put 'UseSrimech':1 in Bindings.py to self-right with the Srimech control; otherwise it will use Flip.
# CUSTOMIZABLE SETTINGS:
# 'EnemyMoveRadius' sets how far the enemy must move in order to be considered mobile. Default is 1.
# 'EnemyMoveTime' sets how long (in seconds) the enemy has to move the required distance before being considered immobile. Default is 3.
# 'PrioritizeFlipper' if set to 1, the AI won't fire the other weapon until the flipper fires. Useful for bots that use the flipper to get under opponents. When all of self.weapons are lost, the flipper will stop firing and the other weapon will fire even when the flipper doesn't. The flipper component id's should therefore be set in self.weapons and no other id's for this to work. Default is 0.
# 'NoChassisTime' sets how long (in half-seconds) the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone. ONLY WORKS FOR SECONDARY WEAPON, NOT FLIPPER so wire the bot and name the controls like you are using Omni or Popup.py if you use this. Default is 1.
# 'SrimechInterval' sets how often the AI fires the srimech when attempting to self-right. Srimech will fire once every X seconds. Default is 1.
from the very top of clickbeetle's flipper2.pyQuote# Flipper2.py last updated 7/24/12 by Clickbeetleit tries to be smart by not flipping things that are immobilized
# Update 7/24/12: Renamed this file to Flipper2.py so Flipper.py is not overwritten. Added customizable srimech firing interval.
# This AI will act normally as long as the opponent is moving. If the opponent stops moving, this AI will also stop and wait for the opponent to be counted out. If the opponent starts moving again, so will this AI. In a rumble, this AI will ignore any bots that aren't moving and will only stop if all opponents stop.
# Has support for two smart zone-based weapons and one analog-controlled spinner. Name the smart zones "flip" and "weapon" and the controls "Flip", "Fire", and "Spin". "Srimech" control for self-righting. Note you must put 'UseSrimech':1 in Bindings.py to self-right with the Srimech control; otherwise it will use Flip.
# CUSTOMIZABLE SETTINGS:
# 'EnemyMoveRadius' sets how far the enemy must move in order to be considered mobile. Default is 1.
# 'EnemyMoveTime' sets how long (in seconds) the enemy has to move the required distance before being considered immobile. Default is 3.
# 'PrioritizeFlipper' if set to 1, the AI won't fire the other weapon until the flipper fires. Useful for bots that use the flipper to get under opponents. When all of self.weapons are lost, the flipper will stop firing and the other weapon will fire even when the flipper doesn't. The flipper component id's should therefore be set in self.weapons and no other id's for this to work. Default is 0.
# 'NoChassisTime' sets how long (in half-seconds) the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone. ONLY WORKS FOR SECONDARY WEAPON, NOT FLIPPER so wire the bot and name the controls like you are using Omni or Popup.py if you use this. Default is 1.
# 'SrimechInterval' sets how often the AI fires the srimech when attempting to self-right. Srimech will fire once every X seconds. Default is 1.
the stock flipper.py is mostly the same thing except without the extra controls to fire, spin, and srimech. I'm not sure how well it works though and at the end of the day I don't think the ai is that important.
flipper checks if its opponent has set invertible to true in its AIfrom the very top of clickbeetle's flipper2.pyQuote# Flipper2.py last updated 7/24/12 by Clickbeetleit tries to be smart by not flipping things that are immobilized
# Update 7/24/12: Renamed this file to Flipper2.py so Flipper.py is not overwritten. Added customizable srimech firing interval.
# This AI will act normally as long as the opponent is moving. If the opponent stops moving, this AI will also stop and wait for the opponent to be counted out. If the opponent starts moving again, so will this AI. In a rumble, this AI will ignore any bots that aren't moving and will only stop if all opponents stop.
# Has support for two smart zone-based weapons and one analog-controlled spinner. Name the smart zones "flip" and "weapon" and the controls "Flip", "Fire", and "Spin". "Srimech" control for self-righting. Note you must put 'UseSrimech':1 in Bindings.py to self-right with the Srimech control; otherwise it will use Flip.
# CUSTOMIZABLE SETTINGS:
# 'EnemyMoveRadius' sets how far the enemy must move in order to be considered mobile. Default is 1.
# 'EnemyMoveTime' sets how long (in seconds) the enemy has to move the required distance before being considered immobile. Default is 3.
# 'PrioritizeFlipper' if set to 1, the AI won't fire the other weapon until the flipper fires. Useful for bots that use the flipper to get under opponents. When all of self.weapons are lost, the flipper will stop firing and the other weapon will fire even when the flipper doesn't. The flipper component id's should therefore be set in self.weapons and no other id's for this to work. Default is 0.
# 'NoChassisTime' sets how long (in half-seconds) the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone. ONLY WORKS FOR SECONDARY WEAPON, NOT FLIPPER so wire the bot and name the controls like you are using Omni or Popup.py if you use this. Default is 1.
# 'SrimechInterval' sets how often the AI fires the srimech when attempting to self-right. Srimech will fire once every X seconds. Default is 1.
the stock flipper.py is mostly the same thing except without the extra controls to fire, spin, and srimech. I'm not sure how well it works though and at the end of the day I don't think the ai is that important.
Good point. I guess the omni is better for the most part, but when it comes to fighting a non-invertible bot, then flipper is better.
How do you make your own PY file? I was looking into making one for my Wandering Spinner bot type...Philetbabe's AI Chart (https://gametechmods.com/uploads/files/8459AI-Chart-2.3.rar)