-
Notifications
You must be signed in to change notification settings - Fork 7
/
data_collection_original.py
165 lines (124 loc) · 4.88 KB
/
data_collection_original.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env python3
#
# data_collection_original.py
# Main entrypoint for datacollection
#
import os
from recording import play_and_record_episodes
from time import sleep
AGREEMENT = """
Machine learning versus machine learning: Case of aimbots.
Organizer: Anssi Kanervisto ([email protected])
School of Computing, University of Eastern Finland
------------------------------------------------------------------------------
BACKGROUND
Terms:
"Cheating": When a video-game player uses software ("cheat") to gain
an unfair advantage over other players.
"Aimbot": Particular cheat which assists player with aiming at
enemy players.
Purpose of this study is two-fold:
1) Detecting aimbot software from player's mouse
movement using machine learning techniques
2) Applying machine learning techniques to create
aimbot that is not distinguishable from human players.
Goal is to obtain public knowledge on such cheats, which can then
be used to create better anti-cheating software.
What data will be collected and how:
In these experiments, you will play a game of Doom (1993)
against computer-players. In some of the games, your aim
will be assisted by software ("aimbot").
The software will record your keypresses and mouse movement
in the game.
A hardware identifier of your machine will be included in the data.
All data will be anonymous and no private information will be
collected.
How this data will be used:
The recorded data will be used to...
1) ... to train machine learning methods to detect aimbots from natural
human gameplay.
2) ... train an aimbot that can not not be detected by the detectors
trained in previous step.
This data may be released to the public.
This data may be used in future research.
Requirements:
- A separate mouse (not a trackpad/mousepad)
- 20 minutes of uninterrupted time (you can not pause the experiment)
------------------------------------------------------------------------------
AGREEMENT
By agreeing you:
- ... confirm you recognize what data will be collected and how
it will be used (scroll up).
- ... are 18 years old or above.
- ... fulfil the requirements (see above).
- ... acknowledge there is no compensation.
- ... acknowledge your participation is voluntary and you may withdraw at
any point before end of the experiment.
Input 'I agree' to continue, "quit" to close this software."""
INSTRUCTIONS = """
INSTRUCTIONS
This experiment will take 20 minutes, and consists
of four 5-minute games of Doom (1993).
Your goal is to score frags by shooting the enemies.
You will find different weapons on the map, as well
ammo for them and health/armor kits.
For each game you will aimbot on or off, automatically
set by this software. If aimbot is enabled, your aim will
"home in" in to enemy targets once they are close enough
to your crosshair.
Once all games are finished, this script will upload
recorded files to a server.
NOTE: Avoid opening the menu (ESC) and unfocusing the window
(clicking outside the game window or changing window)
BUTTONS
WASD: Forward, left, backward and right
SHIFT: Run (hold down to move faster)
Mouse: Aim
Left-mouse click: Shoot
Scroll up/down: Change weapon
Note that you can also aim up/down.
Press ENTER to start the game"""
AFTER_GAMES = """
Games finished.
Press ENTER to upload recordings to server.
Note that these files will be locally removed after upload.
"""
FINISHED = """
Everything done.
Thank you for participating! Closing in 5 seconds."""
NUMBER_OF_EPISODES = 4
# 5 minutes
EPISODE_LENGTH = 35 * 60 * 5
MAPS = ["map03"] * NUMBER_OF_EPISODES
AIMBOTS = [None, None, "ease_light", "ease_strong"]
def main_data_collection():
os.system("cls")
print(AGREEMENT)
agreement = ""
while agreement != "i agree" and agreement != "quit":
agreement = input(" >>> ").lower()
if agreement == "quit":
exit(0)
# Continue to instrunctions etc
os.system("cls")
print(INSTRUCTIONS)
input()
# Play games to create recordings
play_and_record_episodes(NUMBER_OF_EPISODES, MAPS, AIMBOTS,
"recording", timeout=EPISODE_LENGTH)
print(AFTER_GAMES)
input()
# Upload recordings to the server
print("[NOTE] No data uploading in shared code")
print(FINISHED)
sleep(5)
if __name__ == '__main__':
import sys
# Workaround for pyinstaller:
# Some of the local files are in
# the temp folder used by pyinstaller,
# so we need to navigate there.
# Stackoverflow #57480958
if hasattr(sys, "_MEIPASS"):
os.chdir(sys._MEIPASS)
main_data_collection()