Author Topic: Working with tactics  (Read 968 times)

Offline Guldenflame

  • This is very inconsistent
  • Posts: 1123
  • Rep: 7
  • The third most forgettable person here.
    • https://www.facebook.com/
  • Awards Donated money for site hosting 2019 BOTM Winner
    • View Profile
    • Everything is too OP
    • Awards
Working with tactics
« on: February 22, 2017, 02:08:51 PM »
No idea if there's a thread for this already, but here goes.

Tactics are things you can add to the bindings of a robot to make it drive a certain way.  Its really that simple.

To start, you should probably find the tactics first, so using Notepad++ open up the  Tactics.py file.

Also note I'm using the tactics that come with DSL.

When opened, you should see this.


Normally, most of the tactics have green text that tells what it does.
If you read the Green text, you can tell what it is the tactic does, and special stuff you can add to the bindings to make it do special stuff.


Adding them to the bindings are easy.
Merely add, 'tactic':"[Your Tactic of choice]", to the bindings of your robot.

Adding the settings are a little tougher.

As shown above, if your tactic is "Charge," you can add any of the Customizable settings listed below it.
Add them into the bindings as '[Setting of choice]':[Number of choice],.
What the number means is usually said in the description of the settings.

And believe it or not, that's it.


Though small, these tactics make fights much more entertaining.  If you know what tactics too add to what bot, entire fights could change.

I hope this helps and I apologize if this was hard to follow.

Happy AIing.

tl;dr:
Step 1: Open tactics folder
Step 2: Choose tactic
Step 3: Add tactic and settings to bindings using 'tactic':"[Tactic]", and '[Setting]':[Number that has to do with setting],

Online apanx

Re: Working with tactics
« Reply #1 on: February 22, 2017, 04:12:27 PM »
Merely add, 'tactic':"[Your Tactic of choice]", to the bindings of your robot.
Only works for Omni.py ATM, and only the version from AI repo accepts any input, not sure if DSL 2.2 one is updated to do that. Otherwise it is limited to Ram, Charge, Shove, Engage.
'tactic':"Reorient",    I believe this was an attempt to make robots attack the side of each other, however I have not seen this work yet...
[No Customizations]
Reorient is used by Chopper.py

There is also the plain old Engage that is used as default for almost everything
The rest of them appear to be defaults that are assigned for KOTH or Tabletop.  I still have yet to find out how they work...
Invert is run when bot is inverted. Executes flipfunction in DSL.
Unstuck when bot is stuck. Executes UnstuckFunction.
MeltyBrain is an attempt to make a meltybrain AI. Use FBS.py instead.

Step 3: Add tactic and settings to bindings using 'tactic':"[Tactic]", and '[Setting]':[Number that has to do with setting],
If you are running Omni.py Otherwise you have to edit the AI python and append Tactics to the Tactics list using append().
Code: [Select]
self.tactics.append(Tactics.Shove(self))
self.tactics.append(Tactics.Charge(self))

If anyone wants to code custom tactics, please do this so we don't get 1000 versions of Tactics.py

Offline Guldenflame

  • This is very inconsistent
  • Posts: 1123
  • Rep: 7
  • The third most forgettable person here.
    • https://www.facebook.com/
  • Awards Donated money for site hosting 2019 BOTM Winner
    • View Profile
    • Everything is too OP
    • Awards
Re: Working with tactics
« Reply #2 on: February 22, 2017, 04:17:10 PM »
Merely add, 'tactic':"[Your Tactic of choice]", to the bindings of your robot.
Only works for Omni.py ATM, and only the version from AI repo accepts any input, not sure if DSL 2.2 one is updated to do that. Otherwise it is limited to Ram, Charge, Shove, Engage.
'tactic':"Reorient",    I believe this was an attempt to make robots attack the side of each other, however I have not seen this work yet...
[No Customizations]
Reorient is used by Chopper.py

There is also the plain old Engage that is used as default for almost everything
The rest of them appear to be defaults that are assigned for KOTH or Tabletop.  I still have yet to find out how they work...
Invert is run when bot is inverted. Executes flipfunction in DSL.
Unstuck when bot is stuck. Executes UnstuckFunction.
MeltyBrain is an attempt to make a meltybrain AI. Use FBS.py instead.

Step 3: Add tactic and settings to bindings using 'tactic':"[Tactic]", and '[Setting]':[Number that has to do with setting],
If you are running Omni.py Otherwise you have to edit the AI python and append Tactics to the Tactics list using append().
Code: [Select]
self.tactics.append(Tactics.Shove(self))
self.tactics.append(Tactics.Charge(self))

If anyone wants to code custom tactics, pleas do this so we don't get 1000 versions of Tactics.py

So does this mean this tutorial is a bust?