# How do I manage multiplayer login?

For example:

2. Server does some validity checks and instantiates characterx
5. Server sends "spawnyourcharacterx"

OR just after the "iwanttologinwithcharacterx" the server tells the client to handle steps 3, 4, and 5 without interaction?

I'm confused about what would be the ideal approach with the least room for errors.

Some info: The level in which players begin is always the same. Players can have multiple characters and during the game they often switch levels (this would be linked to my first question, how would I handle that cleanly? Don't destroy the playerobject between level load and just change their positions accordingly?)

• if all levels are same for players the client can have a local copy so the servers need only to send position of where the user was last and the client renders the level at that position. – AbstractChaos Feb 2 '13 at 14:26
• thx to byte56 for cleaning up my post. @AbstractChaos: I'm a litte confused by your answer. All players have clientsoftware with with level-copies in the first place. rendering is handled by the engine (Unity) and synchronization is not a problem (already implemented) – Flavelius Feb 2 '13 at 16:16

Your process is generally the right idea for a basic, generic multi player game without any specific design goals. However, there is a lot of stuff you should keep in mind that the client/server does not need to be doing. I'm going to list your steps again and annotate them.

Yes, this is an obviously needed step. Be sure to store a token and add them to the logged in list - at this point your server knows the login is valid.

Server does some validity checks and instantiates characterx

Nothing to say here.

The server can do this but alternatively if they always spawn in the same zone, then the client can load this from a local cache. I advise you send down a 'revision ID' of the map if your game patcher does not handle level patching - this can then be used to verify later whether or not the client would like a new copy of the map.