gametechmods

Robot Arena => Tutorials and Tips => Other Tutorials => Topic started by: apanx on July 26, 2009, 05:23:43 PM

Title: Incorporating custom tactics - no more messing with tactics.py
Post by: apanx on July 26, 2009, 05:23:43 PM
Add your tactic to your AI.

Like this
Code: [Select]
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class HaltAndCatchFire(AI.Tactic):
    name = "HaltAndCatchFire"
   
    def Evaluate(self):
        self.priority = 170
               
    def Execute(self):
            return True
           
class FBS(AI.SuperAI):


Then instead of the usual self.tactics.append(Tactics.HaltAndCatchFire(self)), write this
Code: [Select]
self.tactics.append(HaltAndCatchFire(self))
Title: Incorporating custom tactics - no more messing with tactics.py
Post by: Clickbeetle on July 26, 2009, 05:41:29 PM
Nice.  Tactics.py is useful for universal tactics, but it would be a pain to edit for stuff no other bot is going to use.

Hey... you could feasibly give all rammers custom tweaked tactics this way.  Because some are better at pushing, while others need to back up and charge a lot.

Thanks apanx.