When a user connects or disconnects on the server, we log this (along the current server load).
This is only temporary, in order to assess the number of users a server can safely handle before crashing.
Taking what was done in the LoginScene regarding character selection and putting it in its own scene.
Also, making character selection possible via the keyboard.
Remvoing messages that were no more used in the new messaging system (the code used to handle the message that sent the position of all users on the front side)
The URL signature becomes:
https://workadventu.re/_/[instance]/[path_to_map.json]
This allows us to create many instances of the same map (and therefore to create several different worlds for different people)
An exit on a map can target another "instance" by passing the "exitInstance" property.
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)
searchClientById was scanning through all open sockets to find the right one (which is inefficient if we have many).
Instead, I created a new Map that directly maps ids to sockets.
Furthermore, this solves a long-standing issue (when a socket is disconnected, we cannot find it anymore in the sockets list but it is still available in the disconnect callback from the map)
As a result, we should not have any remaining circles any more.