gametechmods
Robot Arena => General Support => Topic started by: Gigafrost on March 12, 2009, 08:04:58 AM
-
This has been lightly discussed, but how would we go about emulating a code that makes the enemy avoid contact with the user or other bots after all it's weapons are broken off?
I think it has something to do with the engage command or the code which makes the AI go towards the opponent. Would reciporicalizing the values have an opposite effect?
To get a better understanding of my reasoning:
Before Weapons are broken off: Bot engages battle with opponent through approaching and attacking
After Weapons are broken off: Bot switches to "flee" instead of "shove" and avoids the opponent for the rest of the match
-
Madiaba actually AIed a bot with something like this for gumba. his LW i believe.
-
Madiaba and me were discussing this on MSN a couple weeks ago and for the most part he has made coding that tells the bot to avoid the opponent while staying within a certain distance from the center of the arena. Some ideas that we had that I'm still programming for this include: staying away from hazards, keeping an eye on more than one bot at a time, and figuring out where the real walls are and how to avoid them.
-
It seems to me we are working towards a near human AI. Perhaps this could be triggered by something else, like if you have low health and the oppponent is too close?
-
S-32, self/opponent's health, and opponent range are already in the equation...
^As Trov. said.^
But part of what is still NOT clear, is whether or not to write it in an AI.py or in the Tactics. And, since CB is guiding DSL3, it is his call about tweaking the Tactics...
I'll PM you GIG....
..
-
S-32, self/opponent's health, and opponent range are already in the equation...
Hi there, i'm interested in having a look at yout coding Mad,
i've tried to make a tactic with evasive Manuevers, but, even if it is still a draft, i'm a little bit dispointed. Help me improve it :
class AvoidFoe(AI.Tactic):
name = "AvoidFoe"
def __init__(self, ai):
AI.Tactic.__init__(self, ai)
goforward = False
def Evaluate(self):
#do not bother : high priority, it is a draft!
self.priority = 300
self.target_id, range = self.ai.GetNearestEnemy()
def Execute(self):
# get information about self and ennemy :
if self.target_id != None:
a = Arenas.currentArena
target_loc = plus.getLocation(self.target_id)
self_loc = self.ai.GetLocation()
#
dir = vector3(target_loc) - vector3(self_loc)
bestDist = dir.length()
dir.normalize()
dir.x, dir.z = dir.z, dir.x
factorD = [5, 4, 3, 2, -5, -4, -3 -2]
isOk = False
bestloc = self_loc
for d in factorD:
dest = vector3(self_loc) + dir * d
if self.ai.IsStraightPathClear(self_loc, dest.asTuple()):
newDist = (dest - vector3(target_loc)).length()
if abs(newDist) > abs( bestDist ):
bestloc = dest
bestDist = newDist
enAvantToute = ( newDist > 0 )
isOk = True
if isOk: self.ai.DriveToLocation(bestloc.asTuple(),enAvantToute)
return True
-
Well Phil, most of my coding was done in the AI.py, and not in the Tactics.py...where I think it should be done (and it looks like you agree). I talked with Trov as he mentioned, and also CB about this yesterday. What I can roughly surmise so far is a Tactic that:
1. keeps the nose pointing toward nearestenemy (so keep regular LeftRight steering in situ).
2. but will (a) reverse directly away from nearestenemy for only a certain distance/'range', or (b) pick a location in back of it to back up to(like Rammer.py).
3. check for 'IsStraightPathClear' (don't know if this c for walls yet)
4. keep the bot proximal to the center of the arena (via basic getLocation) so it doesn't get trapped.
I'll look at your tweak here and get back...
-
Sounds good guys, I await for it to be finished. I have been dreaming of this PY for quite some time :)