Still slogging away at this, although lots of RL taking up my time recently - also my computer broke, so I need to chase that up too.
Death and respawning, and support for dropping items (thanks
sdab ) are all in the current branch. As opposed to the previous implementation of death which merely put a gui screen up until you hit respawn upon which it teleported you back to the start, the new implementation actually destroys the player's character entity - this can later be changed to ragdolling that player's corpse or other such effects. It also means the player can exist without a character/body, which gives an opportunity for character selection when joining a game or similar.
There is a new version of LWJGL out - this one has their new code for OSX, so I've upgraded the multiplayer branch to use it and migrated to Java 7.
I am currently working on client identity handling, so that when a player rejoins a server the server will be able to know who they are load up their previous state. Some preliminary work to allow testing this was changing the handling of Terasology's save path - on the multiplayer branch it now saves to a home location by default (dependent on OS - for Win 7/8 it saves to the Documents/Saved Games for instance, or at least the equivalent for different languages/setups). A commandline option allows this the be overridden, allowing running Terasology with different home locations and thus configurations.
Implementing client identity, I wanted to meet the following criteria, or get as close to it as possible:
- It needs to work without a master server. Partially to allow LAN play while disconnected from the internet, and partially so we don't have to host a central authentication server.
- Avoids requiring password entry. Players shouldn't need to memorize a password for each server, and I would worry they'ld reuse their credentials and expose themselves to having them stolen by rogue servers.
- Security is important. The solution should be resistant to rogue servers, rogue clients, man-in-the-middle attacks and so forth.
While it isn't complete yet, the solution I'm working towards acts as follows:
- On first run, Terasology generates a server public/private certificate pair, used when it hosts a game. This is stored in the config.
- When joining a server, the client receives the server's public certificate.
- If the client has never been to the server before, it requests a certificate. The server will produce a public/private certificate pair signed by the server's certificate for the client and send it back to the player encrypted. This is the players identity on that server.
- If a client has been to the server before, it sends its public certificate to the server, as well as an encrypted, signed data package as proof of identity (as it will show the client has the private certificate).
The workings of the certificate exchange and authentication of identity are based on TLS/SSL, as used to authenticate web sites everywhere, although some details are abridged (the certificates are not full X509 certificates, there is no negotiation of algorithms).
There are some weakness to this approach:
- At least for the first version, all the certificates are sitting unencrypted in a config file. This means that any rogue code running on the user's machine could easily lift them. Mod sandboxing and security will help with this - mods shouldn't be able to access private keys through code, or read and write files arbitrarily, or create network connections. Having the certificate encrypted using a single, local password would help.
- Because users have separate identities per server, cross-server bans aren't possible. Of course, since Terasology is free even with shared accounts players could just make new ones anyway, so bans need to be by IP rather than identity. Theoretically a group of related servers could share the same certificate, giving the player shared identity for those servers - but anyone running those servers could obtain any player's credentials for the whole group, so care would need to be taken.
One benefit of this approach is that it could be extended to work with a central identity server in the future (the identity server would provide certificates signed by it, and servers would accept certificates signed by it, rather than just by themself). This would have the benefit that even the server admins wouldn't have the necessary information to obtain a player's credentials.