Commit graph

5 commits

Author SHA1 Message Date
David Négrier e9ca8721a6 Migrating userId to "int32" to save some space and adding userMoves message in protobuf 2020-09-18 13:57:38 +02:00
David Négrier 84529d6e99 Propagating customized sprites all over the game 2020-07-28 17:45:55 +02:00
David Négrier a373626e24 Removing all "any" from back.
To do this, I used generic-type-guard package which generates both an interface AND a valid type guard from code.
With this, we are 100% sure that the messages we receive are validated at runtime!
The client cannot pass us an object that is invalid! \o/
2020-06-09 23:07:19 +02:00
David Négrier ab798b1c09 Changing the "Point" notion to add a notion of "moving" in addition to the notion of direction.
Also, refactoring JOIN_ROOM event to add complete position.
2020-05-22 23:04:45 +02:00
David Négrier 125a4d11af Refactored and optimized messages
Now, when a user moves, only his/her position is sent back to the other users. The position of all users is not sent each time.

The messages sent to the browser are now:

- the list of all users as a return to the join_room event (you can send responses to events in socket.io)
- a "join_room" event sent when a new user joins the room
- a "user_moved" event when a user moved
- a "user_left" event when a user left the room

The GameScene tracks all these events and reacts accordingly.

Also, I made a number of refactoring in the classes and removed the GameSceneInterface that was useless (it was implemented by the LogincScene for no reason at all)
2020-05-19 19:11:12 +02:00