BTD6 Automation
BTD6_Automation
is a Python package that provides functions to grind BTD6 XP or collection event and automate BTD6 game play.
Guide for BTD6 Automation
- With
Game
class, you can control and automate the game experience in BTD6. - With
Tower
class, you can develop your own strategy for a map and mode in BTD6 that has 99.99% reproducibility (there might exist RNG).
Requirements
- IMPORTANT: Set the BTD6 screen size at
1600 * 900
, otherwise the positioning will be wrong - IMPORTANT: Set hotkey to default setting, otherwise the tower operation will be wrong since it depends on hotkey
Functions
-
to_front
:let the BTD6 window be the front window by double-clicking the center of BTD6 window. -
class
Game
: operate game page behavior- usage:
Game(map: str, difficulty: str)
- Example:
game = Game("monkey meadow", "easy")
- Example:
- class functions:
- home operator
ready
: enter the chosen map and mode from home page- Example:
game.ready()
- Example:
- game operator
game_play
: play and fast-forward the game- Example:
game.game_play()
- Example:
game_exit
: exit to home page when the game is over (victory or lost)- Example:
game.game_exit()
- Example:
free_play
: continue to free play- Example:
game.free_play()
- Example:
- home operator
- usage:
-
class
Tower
: operate monkey tower behavior- usage:
Tower(tower name: str, x: int, y: int)
,x
andy
are the relative position of the tower on BTD6 window- Example:
tower = Tower("dart", 100, 100)
- Example:
tower name
are recorded inBTD6_Automation/lib/dicts.py
- class functions:
place
: place the tower at the given position- arguments:
upgrade
: upgrade the tower to the given level- Example:
tower.place(upgrade=[0,1,2])
- Example:
targeting
: set the targeting of the tower (pressTAB
for a number of times)- Example:
tower.place(targeting=2)
- Example:
money_t
: set the money of the tower (have default value which corresponds to mode played on)- Example:
tower.place(money_t=200)
- Example:
- arguments:
upgrade_to
: upgrade the tower to the given level at certain path- Example:
tower.upgrade_to(path1=2, path2=3, path3=0)
- Example:
upgrade_with_order
: upgrade the tower with given order.- note that the argument is a tuple or list that each element is 1-3 (the path number)
- Example:
tower.upgrade_with_order([3,1,3])
sell
: sell the tower
- usage:
-
json_to_play
: you can store game strategy in a json file.- The package provides bulit-in strategy json files in
BTD6_Automation\lib\MapPlay\{map name}.json
- You can use
json_to_play("monkey meadow", "easy")
to implement the example strategy if the package has it. - You can write your own strategy and use
json_to_play("monkey meadow", "easy", json_path=YOUR_JSON_PATH)
to implement strategy.
- The package provides bulit-in strategy json files in
-
class
Collection
: grind collection event- usage
Collection("easy").grind
- Note that even though expert impoppable is the best mode to grind collection event, I have not written strategy for every expert map yet.
- usage