Perita

Two is Company, Four is a Race

This week has seen improvements in Flick Karts’ server: Now four player, using either the Android or desktop clients, can race in the same track, and all of them have their puck drawn.

Four client window arranged in a grid showing the same race in a left-turning bend. Each window has a different puck with “^^^” written below and one puck, but the same for all windows, with “Active Kart” on top.
Four-player race.

The biggest change, however, is not visible: The server now has multiple races (i.e., games) running at the same time. Every race has four players, none computer-controlled for now. This change is a result of my fear that we were making too many assumptions that were only true when there is only a single race per server.

This is actually an easy mistake to make, because our idea is to build a game to mainly play with your friends in the same local network, using one Android device or desktop as the server and everyone else connecting as a client. In this case, the server would only have a single game running.

However, this is not possible with the HTML version: The game runs in a browser sandbox that, even though websocket connections are not restricted with CORS or anything similar, as far as i know, does not allow applications to open a listening socket. That is, if every player uses the HTML version, they would be unable to start a game without a dedicated server. Also, to play against your friends over the Internet, with our original idea of a local server you would need to open inbound ports to your router and things like that; not very user friendly.

In other words, we need a publicly accessible server. And that server has to manage multiple games at the same time.

Now it does.