forked from BurnySc2/python-sc2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_debug.py
36 lines (28 loc) · 1009 Bytes
/
show_debug.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sc2
from sc2 import run_game, maps, Race, Difficulty
from sc2.player import Bot, Computer
""" DEPRECATED - see debug examples in terran/ramp_wall.py """
class MyBot(sc2.BotAI):
async def on_step(self, iteration):
for structure in self.structures:
self._client.debug_text_world(
"\n".join(
[
f"{structure.type_id.name}:{structure.type_id.value}",
f"({structure.position.x:.2f},{structure.position.y:.2f})",
f"{structure.build_progress:.2f}",
]
+ [repr(x) for x in structure.orders]
),
structure.position3d,
color=(0, 255, 0),
size=12,
)
def main():
run_game(
maps.get("Abyssal Reef LE"),
[Bot(Race.Terran, MyBot()), Computer(Race.Protoss, Difficulty.Medium)],
realtime=True,
)
if __name__ == "__main__":
main()