-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
66 lines (50 loc) · 1.64 KB
/
settings.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import socket
class Settings():
fps = 60
speed = 0.01 # ball speed
speedup = 1.05 # ball speeds up every time it bounce off paddle
moveSpeed = 0.015 # paddle move speed
botMoveSpeed = 0.004 # bot is slower than real player
startPaddleSize = 0.3
rounds_to_win = 10
time_to_start = 5
time_to_unpause = 3
transition_duration = 1.5
PORT = 8000
MAX_PORT = 8001
HOST = socket.gethostbyname(socket.gethostname())
conn_data_limit = 1024
encoding = "utf-8"
key = "7fZmv`UXa75@K7e$3+g@"
connection_timeout = 1
socket_timeout = 0.1
accept_timeout = 10 # time tha user has to accept the game in AcceptPopup
waiting_timeout = 180 # time during after server will be closed if it hadn't started the game
joining_timeout = 180 # time during after JoinPopup will dissapear
server_frequency = 1 # waiting time between server loops in ms for rest
server_time_refresh = 0 # waiting time between server loops in ms for players
debug = False
verbose = False
def handle_error(self, e):
if self.debug:
print(e)
def inform(self, msg):
if self.verbose:
print(msg)
def allowed(self, address):
if address:
return address[0] == self.HOST and self.PORT <= address[1] <= self.MAX_PORT
return False
settings = Settings()
all = {
"key": settings.key
}
ALIVE = {"free": None,}
LEAVE = {"left": True,}
WAITING = {"waiting": True,}
REQUEST_GAME = {"ok": True,}
REQUEST_RECIVED = {"understood": True,}
BUSY = {"allowed": False,}
ABANDON = {"bye": True,}
GAME_ACCEPTED = {"allowed": True,}
GAME_START = {"start": True,}