Friday Facts #99 - MP forwarding

Posted by Tomas on 2015-08-14

Good day to all,

it is hot here. Really hot. We have loosened our "dressing policy" to "no T-shirt is fine". Both of our fans are running full speed and the fridge is stacked with ice cube plates. People come and go all the time - it is the mids of vacation period after all. Half empty (or half full) office has become a standard these days. Still the work goes on and there is progress.

MP communication forwarding

Today the 0.12.4 will be released. It brings another bunch of bugfixes reported by the folks at the forums. One of the biggest annoyances people have been bumping into since the 0.11 has been the connection errors when starting the multiplayer game. Our model until now was strictly peer-to-peer communication. This is plausible even for cases when not everybody has a public IP address (using a mechanism called NAT punching - see previous FFF for further information). However there are cases which just don't work.

In the following schema the client A and server S are in the same LAN. The server has both local private interface (10.0.0.2) as well as the Internet-facing public interface (192.17.211.24). S and A refer to each other with their private IP addresses (10.0.0.2 for S and 10.0.0.3 for A). When client B connects to the server (identified by the public IP address 189.17.211.24) the communication with the server is established. The server knows client A under its private IP address 10.0.0.3. It then sends this private IP address of A to the client B. However B is outside of the A's LAN so the communication attempt from B to A using IP address 10.0.0.3 will fail. This is just one of many scenarios when the current mechanism of directly passing the known IP address would fail.

Until now pretty much the only solution has been to use a virtual network like Hamachi or Evolve. There are some workarounds we could do (not passing the IP address as is, but instead trying to translate it), but somehow the simplest solution is to use the server S as a central point of communication here. That would mean that B will mark the message to be for A, however it will send it to S. Then S will unpack the message, see that it is actually for A and resend it to A. The trick here is that S can communicate with A directly without problems. This is exactly what we have built in the 0.12.4. The mechanism has to be explicitly selected in the connect dialog when connecting to the mp game (by default it says using peer-to-peer communication - disabling this uses the forwarding via the server). Described solution comes with some pros and cons (as always):

  • There might be less outgoing communication from B (or in general from clients forwarding via the server). This is because broadcast communication (which is the vast majority of communnication - namely the heartbeat mechanism) from B will be replaced by a single message to the server and only from there it will be broadcasted. This mechanism is not yet implemented but it is coming in 0.12.5.
  • In the future we will also implement the inverse mechanism. Namely on the server side, collecting heartbeats for a given peer from the queue of messages waiting to be sent, and sending these as a single group message. This way we save the overhead of sending heartbeats in separate packets.
  • The downside of the whole forwarding can be an increase in latency because there is now an extra hop in the communication - what was previously direct peer-to-peer communication now goes via the server. However if the server has a good connectivity this should be negligible.

Factorio to schools

We start to get inquiries about possible cooperation regarding Factorio support applications and usage of the game / brand in different contexts. Recently we got contacted by Ben who is affiliated with an Australian company called Invent The World. These guys are running holiday courses for children (mostly 5 - 12 year olds) where they teach them about computers, basic programming thinking and also human interaction on the internet.

So far they have used Minecraft a lot as a platform to build their custom content upon. However at the moment they are looking to expand the program to older kids as well (12+) they look for other interesting games as well. And since Ben has been playing Factorio for a while, one day an email from him landed in our inbox. After a bit of communication back and forth between him and Betka he has decided to visit Prague and stop by at our office. So we had a lunch together yesterday and spent quite some time talking about possibilities of building education content on top of Factorio - basically maps with custom goals which would be then used by teachers to explore programming like patterns and math thinking with kids. We are getting together again for a beer tonight :) The idea of using Factorio as a platform for education purposes is very interesting for us, so let's see how this project unfolds.

Theme graphics and icons

Albert is back from holidays (though he might leave for Spain again soon) and he has been mostly busy with Factorio promotional picture (concept of this one has been introduced in the past FFF edition). He has worked further upon the concept and the result is now way more detailed. At the moment this picture is used as a menu background in the game itself (so no surprise for experimental release testers:)). If we don't manage to find an artist to do a coherent set of theme pictures on time, we will also use this as a standard banner for Steam Greenlight and other marketing campaigns.

Main focus in the gfx department is now in the technology icons. Unlike item icons where proof-of-concepts have been almost(!) completely replaced by proper icons, in the technology pictures land we are still falling behind. Albert keeps working with our existing 3D models which often allows him to put together the icons very fast using elements already in the game (though there are always obstacles:)). We will bring you some previews in the next FFF edition.

Let us know what you think about using Factorio in education at our forums.