Improve netcode and simplify (#4)
- Simplify the logic wherever possible to remove overengineering and simplify the netcode - Actually improve the netcode - The new lines are mainly the package locks and tests Reviewed-on: https://home.schmelczer.dev/git/andras/decla-red/pulls/4
This commit is contained in:
parent
5d854440ec
commit
93a7fe01ab
4 changed files with 15073 additions and 4754 deletions
18
shared/src/communication/communication.ts
Normal file
18
shared/src/communication/communication.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
export type Id = number;
|
||||
|
||||
let currentId = 0;
|
||||
export const id = (): Id => currentId++;
|
||||
|
||||
export interface PlayerInformation {
|
||||
name: string;
|
||||
reconnectToken?: string;
|
||||
}
|
||||
|
||||
export interface ServerInformation {
|
||||
playerLimit: number;
|
||||
playerCount: number;
|
||||
serverName: string;
|
||||
gameStatePercent: number;
|
||||
}
|
||||
|
||||
export const serverInformationEndpoint = '/state';
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
export type Id = number | null;
|
||||
|
||||
let currentId = 0;
|
||||
|
||||
export const id = (): number => {
|
||||
return currentId++;
|
||||
};
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export interface PlayerInformation {
|
||||
name: string;
|
||||
}
|
||||
|
|
@ -6,4 +6,13 @@ export enum TransportEvents {
|
|||
ServerInfoUpdate = 'ServerInfoUpdate',
|
||||
Ping = 'Ping',
|
||||
Pong = 'Pong',
|
||||
PlayerJoined = 'PlayerJoined',
|
||||
JoinRejected = 'JoinRejected',
|
||||
}
|
||||
|
||||
export enum JoinRejectionReason {
|
||||
ServerFull = 'ServerFull',
|
||||
RoundEnding = 'RoundEnding',
|
||||
AlreadyJoined = 'AlreadyJoined',
|
||||
InvalidRequest = 'InvalidRequest',
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue