-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraining_start.py
44 lines (33 loc) · 927 Bytes
/
training_start.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
37
38
39
40
41
42
43
44
from engine.world import World
import pygame
from engine.constants import STATS_WIDTH
import cProfile
profiler = cProfile.Profile()
profiler.enable()
w = World(map_name='map2')
w.load()
DISPLAY = (w.width, w.height)
pygame.init()
pygame.display.set_caption(w.name)
myfont = pygame.font.SysFont("timesnewroman", 15)
flags = pygame.DOUBLEBUF | pygame.HWSURFACE
screen = pygame.display.set_mode(DISPLAY, flags)
# This has to be done somewhere inside world loading
w.agents[0].name = 'SSbot'
w.agents[1].name = 'Target1'
w.agents[2].name = 'Target2'
w.agents[3].name = 'Target3'
w.agents[4].name = 'Target4'
w.spawns = [50, 490, 50, 320]
w.episode_duration = 1000
with open('configs/DQN5.conf', 'r') as f:
w.agents[0].set_model(f.read())
while 1:
try:
if 1:
w.tick()
w.draw(screen)
pygame.display.update()
except:
profiler.print_stats(sort=1)
break