Hi there!
I've recently started to be very interested by multiplayers and the architecture of real-time worlds.
To start with, I have started a little tactical rpg (2d iso). Using TCP for everything (and to start small), no need 50ms movements.
Besides, I am starting to see how I could implement the "login/password" stuff.
I have read some things about it, but I'm not still unsure on how to implement it, I've got some questions and please correct me if I'm wrong! :)
- The client establishes a TCP connection with the server (login server or world server)
- The client sends login+password to the same server, using a secure way.
- The server checks the database, loads the user and returns an encrypted token (I could do something similar to a JSON Web Token I guess)
- Does the server keep in memory (in a dictionnary or something similar) all the user data associated to the socket id?
- The client gets the token, launch the gui stuff, the player pushes his left arrow key, the client sends a message with an arrow key pressed
- As TCP in a tunnel between two entities, does the client need to send the token in each message? Or is the TCP socket id enough (is it secure to use it?) to retrieve the correct user?
- The servers checks the dictionnary to get the player previous position, and returns the new one based on the arrow key pressed.
- When the server persists the player data in database? After X seconds if it's dirty? Or every request?
- The client updates the player object with the new position
If I'm not wrong, the server keeps the current state of the world in memory and persists it every X seconds to the database to avoid billions of requests?
I'm having hard times to see the boundaries between the login/token stuff and the one-one TCP connection, and how the two work together in a "mmorpg" world.
Many thanks, for the answers and your time!
HyrTheWinter