-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
290 lines (287 loc) · 16.4 KB
/
index.html
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html lang="en" data-ng-app="app">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Netcode Workbench - visual console to test game state synchronization algorithms</title>
<meta name="keywords" content="netcode,network,game,state,sync,algorithm,prediction,interpolation,reconciliation,latency,lag,debug,console,p2p,client,server" />
<meta name="description" content="Visual console to test game state synchronization algorithms with latency, packet loss, p2p, client/server, client side prediction, interpolation/extrapolation, etc." />
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<style>
[ng\:cloak],
[ng-cloak],
[data-ng-cloak],
[x-ng-cloak],
.ng-cloak,
.x-ng-cloak,
.ng-hide {
display: none !important;
}
</style>
</head>
<body class="ng-cloak" data-ng-controller="mainCtrl">
<!-- CONTROL PANEL -->
<div id="controlPanel">
<table class="striped">
<thead>
<tr>
<th>Property</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td data-label="Property">Algorithm</td>
<td data-label="Value">
<select id="selAlgorithm" class="input-small" data-ng-model="info.algorithm"
data-ng-options="item as item.name for item in info.netcodes"
data-ng-change="changeAlgorithm()" data-ng-disabled="info.btnStopEnabled">
</select>
</td>
</tr>
<tr>
<td data-label="Property">Serializer</td>
<td data-label="Value">
<select id="selSerializer" class="input-small" data-ng-model="info.serializer"
data-ng-options="item as item.name for item in info.serializers"
data-ng-disabled="info.btnStopEnabled">
</select>
</td>
</tr>
<tr data-ng-if="info.algorithm.type === 'custom'">
<td colspan="2" class="center-text">
<input type="text" id="txtAlgorithmUrl" class="input-large" data-ng-model="info.algorithmUrl" placeholder="Algorithm URL" data-ng-disabled="info.btnStopEnabled"/>
</td>
</tr>
<tr>
<td data-label="Property">Tick (ms)</td>
<td data-label="Value"><input id="txtTick" class="input-small" type="number" min="10" max="999" maxlength="3"
data-ng-model="info.tick" data-ng-disabled="info.btnStopEnabled"/></td>
</tr>
<tr>
<td data-label="Property">NPCs</td>
<td data-label="Value"><input type="number" class="input-small" min="0" max="10" maxlength="2" id="txtNPCs"
data-ng-model="info.npcs" data-ng-disabled="info.btnStopEnabled"/></td>
</tr>
<tr>
<td data-label="Property">Smoothing</td>
<td data-label="Value">
<select id="selSmoothing" class="input-small" data-ng-model="info.smoothing"
data-ng-options="item as item.name for item in info.smoothings"
data-ng-change="changeSmoothing()">
</select>
</td>
</tr>
<tr>
<td data-label="Property">Debug boxes</td>
<td data-label="Value"><input id="cbDebugBoxes" type="checkbox" data-ng-model="info.debugBoxes"
data-ng-change="changeDebugBoxes()" /></td>
</tr>
<tr>
<td colspan="2" class="center-text"><strong>Player 1 Network</strong></td>
</tr>
<tr>
<td data-label="Property">Latency Min (ms)</td>
<td data-label="Value"><input type="number" class="input-small" min="0" max="9999" maxlength="4" id="txtMinLatency1"
data-ng-model="info.latency1.min" data-ng-disabled="info.btnStopEnabled"/>
</td>
</tr>
<tr>
<td data-label="Property">Latency Max (ms)</td>
<td data-label="Value">
<input type="number" class="input-small" min="0" max="9999" maxlength="4" id="txtMaxLatency1"
data-ng-model="info.latency1.max" data-ng-disabled="info.btnStopEnabled"/>
</td>
</tr>
<tr>
<td data-label="Property">Packet Loss %</td>
<td data-label="Value">
<input type="number" class="input-small" min="0" max="100" maxlength="3" id="txtPacketLoss1"
data-ng-model="info.packetLoss1" data-ng-disabled="info.btnStopEnabled"/>
</td>
</tr>
<tr>
<td colspan="2" class="center-text"><strong>Player 2 Network</strong></td>
</tr>
<tr>
<td data-label="Property">Latency Min (ms)</td>
<td data-label="Value"><input type="number" class="input-small" min="0" max="9999" maxlength="4" id="txtMinLatency2"
data-ng-model="info.latency2.min" data-ng-disabled="info.btnStopEnabled"/>
</td>
</tr>
<tr>
<td data-label="Property">Latency Max (ms)</td>
<td data-label="Value">
<input type="number" class="input-small" min="0" max="9999" maxlength="4" id="txtMaxLatency2"
data-ng-model="info.latency2.max" data-ng-disabled="info.btnStopEnabled"/>
</td>
</tr>
<tr>
<td data-label="Property">Packet Loss %</td>
<td data-label="Value">
<input type="number" class="input-small" min="0" max="100" maxlength="3" id="txtPacketLoss2"
data-ng-model="info.packetLoss2" data-ng-disabled="info.btnStopEnabled"/>
</td>
</tr>
<tr>
<td colspan="2" class="center-text"><strong>Realtime info (hurts performance)</strong></td>
</tr>
<tr>
<td data-label="Property">Game States</td>
<td data-label="Value"><input id="cbGameStates" type="checkbox" data-ng-model="info.realtimeGameStates"/></td>
</tr>
<tr>
<td data-label="Property">Logs</td>
<td data-label="Value"><input id="cbLogs" type="checkbox" data-ng-model="info.realtimeLogs"/></td>
</tr>
</tbody>
</table>
<div class="button-group">
<button data-ng-click="stop()" data-ng-if="info.btnStopEnabled" class="tooltip" aria-label="Stop"><i class="fas fa-stop"></i></button>
<button data-ng-click="play()" data-ng-if="info.btnPlayEnabled" class="tooltip" aria-label="Start"><i class="fas fa-play"></i></button>
<button data-ng-click="saveAll()" data-ng-if="info.btnSaveEnabled" class="tooltip" aria-label="Download"><i class="fas fa-download"></i></button>
<button data-ng-click="resetLayout()" class="tooltip" aria-label="Reset Layout"><i class="far fa-window-restore"></i></button>
</div>
</div>
<!-- PLAYER 1 -->
<div id="player1GameStates" class="gameState">
<div data-ng-if="!info.playing" class="card {{::item.mismatches?'gameStateError':''}}" data-ng-repeat="item in info.gamestatesPlayer1 track by $index">
<div class="section">Tick: {{::item.tick}}</div>
<div class="section">
<div class="small-text" data-ng-repeat="player in item.players track by player.id">P{{::player.id}} [{{::player.x}} ,
{{::player.y}}]</div>
</div>
<div class="section">
Scores: <span data-ng-repeat="player in item.players | filter : {score : '!!'} track by player.id">P{{player.id}}:{{::player.score}}
</span>
</div>
<div class="section">
Commands: <span data-ng-repeat="command in item.commands track by $index">P{{::command.playerId}}:{{::command.value}}{{::command.cloned?'*':''}}
</span>
</div>
</div>
<div data-ng-if="info.playing && info.realtimeGameStates" class="card {{::item.mismatches?'gameStateError':''}}" data-ng-repeat="item in [info.gamestatesPlayer1[0]] track by item.tick">
<div class="section">Tick: {{::item.tick}}</div>
<div class="section">
<div class="small-text" data-ng-repeat="player in item.players track by player.id">P{{::player.id}} [{{::player.x}} ,
{{::player.y}}]</div>
</div>
<div class="section">
Scores: <span data-ng-repeat="player in item.players | filter : {score : '!!'} track by player.id">P{{player.id}}:{{::player.score}}
</span>
</div>
<div class="section">
Commands: <span data-ng-repeat="command in item.commands track by $index">P{{::command.playerId}}:{{::command.value}}{{::command.cloned?'*':''}}
</span>
</div>
</div>
</div>
<div id="player1Canvas">
<div class="center-text">Control keys: W S A D</div>
<canvas id="player1GameArea" class="gameArea" width="300px" height="250px"></canvas>
</div>
<div id="player1Logs">
<p data-ng-if="!info.playing" data-ng-repeat="trace in info.logsPlayer1 track by trace.id" class="logs"
data-ng-class="::trace.level == 'INFO' ? 'log_info' : trace.level == 'WARN' ? 'log_warn' : 'log_error'">
{{::trace.timestamp | date: 'HH:mm:ss.sss'}} {{::trace.text}}</p>
<p data-ng-if="info.playing && info.realtimeLogs" data-ng-repeat="trace in [info.logsPlayer1[0]] track by trace.id" class="logs"
data-ng-class="::trace.level == 'INFO' ? 'log_info' : trace.level == 'WARN' ? 'log_warn' : 'log_error'">
{{::trace.timestamp | date: 'HH:mm:ss.sss'}} {{::trace.text}}</p>
</div>
<!-- PLAYER 2 -->
<div id="player2GameStates" class="gameState">
<div data-ng-if="!info.playing" class="card {{::item.mismatches?'gameStateError':''}}" data-ng-repeat="item in info.gamestatesPlayer2 track by $index">
<div class="section">Tick: {{::item.tick}}</div>
<div class="section">
<div class="small-text" data-ng-repeat="player in item.players track by player.id">P{{::player.id}} [{{::player.x}} ,
{{::player.y}}]</div>
</div>
<div class="section">
Scores: <span data-ng-repeat="player in item.players | filter : {score : '!!'} track by player.id">P{{player.id}}:{{::player.score}}
</span>
</div>
<div class="section">
Commands: <span data-ng-repeat="command in item.commands track by $index">P{{::command.playerId}}:{{::command.value}}{{::command.cloned?'*':''}}
</span>
</div>
</div>
<div data-ng-if="info.playing && info.realtimeGameStates" class="card {{::item.mismatches?'gameStateError':''}}" data-ng-repeat="item in [info.gamestatesPlayer2[0]] track by item.tick">
<div class="section">Tick: {{::item.tick}}</div>
<div class="section">
<div class="small-text" data-ng-repeat="player in item.players track by player.id">P{{::player.id}} [{{::player.x}} ,
{{::player.y}}]</div>
</div>
<div class="section">
Scores: <span data-ng-repeat="player in item.players | filter : {score : '!!'} track by player.id">P{{player.id}}:{{::player.score}}
</span>
</div>
<div class="section">
Commands: <span data-ng-repeat="command in item.commands track by $index">P{{::command.playerId}}:{{::command.value}}{{::command.cloned?'*':''}}
</span>
</div>
</div>
</div>
<div id="player2Canvas">
<div class="center-text">Control keys: <i class="fas fa-arrow-up"></i> <i class="fas fa-arrow-down"></i> <i
class="fas fa-arrow-left"></i> <i class="fas fa-arrow-right"></i></div>
<canvas id="player2GameArea" class="gameArea" width="300px" height="250px"></canvas>
</div>
<div id="player2Logs">
<p data-ng-if="!info.playing" data-ng-repeat="trace in info.logsPlayer2 track by trace.id" class="logs"
data-ng-class="::trace.level == 'INFO' ? 'log_info' : trace.level == 'WARN' ? 'log_warn' : 'log_error'">
{{::trace.timestamp | date: 'HH:mm:ss.sss'}} {{::trace.text}}</p>
<p data-ng-if="info.playing && info.realtimeLogs" data-ng-repeat="trace in [info.logsPlayer2[0]] track by trace.id" class="logs"
data-ng-class="::trace.level == 'INFO' ? 'log_info' : trace.level == 'WARN' ? 'log_warn' : 'log_error'">
{{::trace.timestamp | date: 'HH:mm:ss.sss'}} {{::trace.text}}</p>
</div>
<!-- SERVER -->
<div id="serverGameStates" class="gameState">
<div data-ng-if="!info.playing" class="card {{::item.mismatches?'gameStateError':''}}" data-ng-repeat="item in info.gamestatesServer track by $index">
<div class="section">Tick: {{::item.tick}}</div>
<div class="section">
<div class="small-text" data-ng-repeat="player in item.players track by player.id">P{{::player.id}} [{{::player.x}} ,
{{::player.y}}]</div>
</div>
<div class="section">
Scores: <span data-ng-repeat="player in item.players | filter : {score : '!!'} track by player.id">P{{player.id}}:{{::player.score}}
</span>
</div>
<div class="section">
Commands: <span data-ng-repeat="command in item.commands track by $index">P{{::command.playerId}}:{{::command.value}}{{::command.cloned?'*':''}}
</span>
</div>
</div>
<div data-ng-if="info.playing && info.realtimeGameStates" class="card {{::item.mismatches?'gameStateError':''}}" data-ng-repeat="item in [info.gamestatesServer[0]] track by item.tick">
<div class="section">Tick: {{::item.tick}}</div>
<div class="section">
<div class="small-text" data-ng-repeat="player in item.players track by player.id">P{{::player.id}} [{{::player.x}} ,
{{::player.y}}]</div>
</div>
<div class="section">
Scores: <span data-ng-repeat="player in item.players | filter : {score : '!!'} track by player.id">P{{player.id}}:{{::player.score}}
</span>
</div>
<div class="section">
Commands: <span data-ng-repeat="command in item.commands track by $index">P{{::command.playerId}}:{{::command.value}}{{::command.cloned?'*':''}}
</span>
</div>
</div>
</div>
<div id="serverCanvas">
<canvas id="serverGameArea" class="gameArea" width="300px" height="250px"></canvas>
</div>
<div id="serverLogs">
<p data-ng-if="!info.playing" data-ng-repeat="trace in info.logsServer track by trace.id" class="logs"
data-ng-class="::trace.level == 'INFO' ? 'log_info' : trace.level == 'WARN' ? 'log_warn' : 'log_error'">
{{::trace.timestamp | date: 'HH:mm:ss.sss'}} {{::trace.text}}</p>
<p data-ng-if="info.playing && info.realtimeLogs" data-ng-repeat="trace in [info.logsServer[0]] track by trace.id" class="logs"
data-ng-class="::trace.level == 'INFO' ? 'log_info' : trace.level == 'WARN' ? 'log_warn' : 'log_error'">
{{::trace.timestamp | date: 'HH:mm:ss.sss'}} {{::trace.text}}</p>
</div>
<!-- TRAFFIC CHART -->
<div id="trafficChart"></div>
<div data-ng-if="info.showSpinner" class="loading"><div class="loader"></div></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>