preprocess map into binary data

This commit is contained in:
evanpelle
2024-08-22 21:01:40 -07:00
parent 7517f933ca
commit ac556ee073
17 changed files with 281 additions and 913 deletions
+11 -13
View File
@@ -17,7 +17,7 @@ class Client {
private hasJoined = false
private socket: WebSocket | null = null;
private terrainMap: Promise<TerrainMap>
private terrainMap: TerrainMap
private game: ClientGame
private lobbiesContainer: HTMLElement | null;
@@ -115,18 +115,16 @@ class Client {
this.lobbiesContainer.appendChild(joiningMessage);
}
this.terrainMap.then((map) => {
if (this.game != null) {
return;
}
this.game = createClientGame(getUsername(), new PseudoRandom(Date.now()).nextID(), lobby.id, getConfig(), map);
this.game.join();
const g = this.game
window.addEventListener('beforeunload', function (event) {
// Your function logic here
console.log('Browser is closing');
g.stop()
});
if (this.game != null) {
return;
}
this.game = createClientGame(getUsername(), new PseudoRandom(Date.now()).nextID(), lobby.id, getConfig(), this.terrainMap);
this.game.join();
const g = this.game
window.addEventListener('beforeunload', function (event) {
// Your function logic here
console.log('Browser is closing');
g.stop()
});
}
}