the work on the 0.13 is slowly getting to the final phase and hence it feels like a good time to give an overview of actual multiplayer changes that have been implemented over past couple of weeks.
This is a recap and extension of a FFF post that mentioned the Multiplayer improvements while there were in progress.
Probably the biggest change is implementation of a service that holds available Multiplayer games. We call this service Multiplayer Matching Server even though the name doesn't precisely describe what it does.
This service greatly simplifies the game discovery and connectability. Player hosting the game (or a headless server) will simply publish the game to the Multiplayer Matching Server. This makes the game available to other players via the Browse Games Gui. This will make the clumsy connecting directly to the server pretty much obsolete (though the functionality stays).
As mentioned earlier there are quite a few little features to make the user experience smooth. Just to recap:
The usage (creating games as well as listing games) of our Multiplayer Matching Server will require user to be logged in with his Factorio username. If you have a Factorio account you can simply use those credentials in the in-game login dialog. If you are coming from Steam there will be an in game Factorio account creation dialog that creates a Factorio account for you the first time you need to use it.
The reasons to use strictly Factorio usernames are mostly technical. However also we have been from the beginning committed to provide all our services both to people using the Steam and those not using it as well. The same will hold for Mod Portal and other services coming in the future.
Another advantage of having user verification is that when creating the game it can be requested that all the users connecting to the game needs to be verified. Which basically means that they are connecting with their Factorio username and they don't pretend to be someone else.
Just a little technical rant about how user verification works behind the scenes. This is to show that even a minor feature might get quite interesting. The diagrams show graphically what is happening.
In this protocol the server_padlock is private information shared between server and Auth Server. The server_padlock allows to verify that the user coming with user_server_key was successfully verified by the Auth Server. All this hassle is to avoid too many requests to the auth server. This way there is one request when the game is created and one request for every new player connecting to the game while keeping a good level (in our opinion) of security.
An often asked for convenience for the Multiplayer is the integration with Steam Friends. Thanks to Ondra this has been already implemented. In the Browse Games Gui you can filter games that have some of your Steam friends in them. Then in the game details you would see your friends highlighted.
But more importantly (and conveniently) you can use this feature directly via Steam. In your steam client you will see your friends that are currently playing Factorio and you can just click and join them in the game. This translates to our internal game connection mechanism which might still ask you for a password if the game requires one.
The final "cherry on the top" which is still in progress is NAT punching via the matching server. Basically this will allow the servers without public IP address (they are behind a NAT) to host the game. The idea is simple:
The Matching Server (or a standalone service) will provide a simple UDP API which can be pinged and it will respond with the IP address it sees the incoming packets to come from. This will be our little imitation of the STUN. The application (Factorio client hosting the game) will receive the reply with the public IP address it is visible to the Matching Server (Matching server has a public IP). This "punches" the hole to the NAT the Factorio client is behind.
The game is then published with the IP address returned by the STUN-like service and hence when players connect to the game, they are connecting to the public IP address on the outside of the NAT (if there is any). The packets are then forwarded to the actual Factorio client hosting the game via internal NAT mechanisms. As usual this might not work in 100% cases because of the special cases and oddities in NATs but should cover most of the scenarios.
0.13 is a big big release. The biggest so far. So there are quite a few more "little" features that make the MP experience smoother.
If you have some more ideas what how the MP User Experience could be improved please let us know at our forums. For 0.13 we are pretty much set, but we will gladly consider the ideas for the future. For instance the observer mode has been on our TODO list for a while and it is slowly getting to the top.