Skip to content

Latest commit

 

History

History
105 lines (66 loc) · 1.2 KB

pong.md

File metadata and controls

105 lines (66 loc) · 1.2 KB

initGame (back to front)

Click to expand

inform the 2 players the exact time when the game will start

{time_start: Date}

player movement events

Click to expand

playerMovement (front to back)

data

{
	userId : number,
	current_pos : number,
}

opponentMovement (back to front)

data

{
    userId : number,
    current_pos : number
}

score management

Click to expand

newScore (front to back)

data

{
	userId : number,
    current_score : number,
}

unexpected disconnection

Click to expand

need to be handled in the method handleDisconnect

endGame (back to front)

data

{
	userId: number
}

manage spectators

Click to expand

need to send current game state (values are from db) to spectator's client

initSpectatorGame (back to front)

data

{
    userIds: number[],
	p1_score: number,
	p2_score: number,

	p1_pos: number,
	p2_pos: number,

	ball_pos: number,
	ball_velocity: number,
	ball_direction: number,
}