Add backend
This commit is contained in:
parent
4ad60813c9
commit
0f0a1eaf67
19 changed files with 355 additions and 45 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import { glMatrix } from 'gl-matrix';
|
||||
import io from 'socket.io-client';
|
||||
import { TransportEvents } from '../../shared/src/transport/transport-events';
|
||||
import { Configuration } from './scripts/config/configuration';
|
||||
import { Game } from './scripts/game';
|
||||
import { Random } from './scripts/helper/random';
|
||||
|
|
@ -9,6 +11,17 @@ glMatrix.setMatrixArrayType(Array);
|
|||
const main = async () => {
|
||||
await Configuration.initialize();
|
||||
|
||||
const socket = io(Configuration.servers[0], {
|
||||
reconnectionDelayMax: 10000,
|
||||
transports: ['websocket'],
|
||||
});
|
||||
|
||||
socket.on('reconnect_attempt', () => {
|
||||
socket.io.opts.transports = ['polling', 'websocket'];
|
||||
});
|
||||
|
||||
socket.emit(TransportEvents.PlayerJoining, null);
|
||||
|
||||
try {
|
||||
Random.seed = 42;
|
||||
await new Game().start();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue