Well not quite with the AI itself, but with some extra features I want to put in.
The AI is done and working properly. What it does: if the bot is within 6 meters of the opponent and is moving slower than a certain threshold speed (default 3), the AI attempts to drive away for another ram. If the bot is facing the opponent, it backs up; if it is facing away from the opponent, it drives forward; and if the opponent is on its flank, it turns to face the opponent and then backs up. If it can't get away (there is an obstacle in its path) it will face the opponent and push back. While the AI is driving away, it is constantly checking for clear paths in front of and behind it. It will continue to drive away from the opponent until it either detects an obstacle in its path or it is a certain distance away from the opponent. At that point it will charge the opponent again.
How it's different from the previous rammer AI:
-Better hazard avoidance. The obstacle c all but ensure the AI won't run into walls or hazards while backing up.
-The AI will usually run away first and then turn to face the opponent for a ram. The only case in which it tries to turn first is if the enemy is exactly to the side.
-The point at which the AI will stop backing up and charge the opponent is based on distance/presence of obstacles rather than a timer. The result is usually greater distances over which a ram is performed. Most bots will back up the length of the Combat Arena, stop just before hitting the wall, and then do a boxlong charge.
-Because bots tend to back up a longer distance, the new AI doesn't work as well for bots that don't drive straight in reverse. For that reason I am keeping the old Rammer AI as another option. However, it works excellently for bots that do drive straight in reverse.
So here's what I need help with. I want to make the threshold speed for "run away" activation customizable in Bindings.py. I also want to make the AI's sight range for obstacle detection customizable in Bindings, because a fast bot will need a longer sight range than a slow bot.
However, I can't figure out a way to call variables from Tactics.py in Rammer.py to make them customizable. I also tried putting the customization code in Tactics (if self.blah in args:...) but that just made the game crash. My question is, is there any way to make variables in Tactics.py customizable in Bindings.py?
If there isn't, I can always move the new code into Rammer.py, but it would be more convenient to leave it in Tactics so it can be called by other py's like OmniRam and whatnot.