Hexagonal train game

by
2020-04-17

I'm dreaming of a train game inspired by OpenTTD, a game I have spent the typical "too many hours" playing. I obviously enjoy it a lot, but there are nevertheless some annoyances that would be nice to fix. So I have spent a lot of time designing a new game in my mind that fixes everything and is so much better. Maybe. The only way to know is to play the game, and that requires having the game to play.

One of the things I have been wondering about is if it might be nicer to play on an hexagonal grid rather than the square grid in OpenTTD. On the square grid, you can build rails that go along the grid or diagonally on it, but there are annoying differences in what's possible with the different directions. I have sketched on hexagonal grid paper and it looks interesting, so I have proceeded to create an interactive prototype to test what editing it in the game might be like.

Pretty soon, I bumped into the linked questions of how to represent this, and which user interaction to offer for the editing. My initial analysis was the following: There are three ways to build a straight rail across a cell, and there are six ways to build a bend in a cell. Therefore each cell needs nine bits to represent all possible combinations of rail types.

Most, but maybe not all, combinations can make some kind of sense in the correct context.

But the question of context got me thinking. I have made many mistakes in OpenTTD where I leave a discontinuity in a railway in a place that's crowded enough that it is hard to spot the error. This typically happens in an intersection with many connections, and I have missed one of the multiple valid connections.

This suggests focusing on connections between cells instead of stretches of rail inside each cell. Or edges instead of nodes, in graph parlance. You would then mark each edge as either connected or disconnected, and each cell would then include the rails to complete all pairs of connected edges.

The representation of this would require one bit per edge. For the six-sided hexagons in this game, that sounds like six bits per cell, but each edge is of course shared between two cells, making the entropy per cell three bits. This sharing is what makes this scheme appealing: It guarantees a certain coherence for adjacent cells.

If my combinatorics is any good, this leaves us with a lot fewer possibilities for constructing our rails. This can be good or bad. Does it limit the player's expressiveness or creativity? Does it eliminate error states? And what does it do to the user interface?

In Transport Tycoon Deluxe, the game OpenTTD is a remake of, you only have crude tools available to build rails. You must select from a toolbar which direction of railway you want to build, and then click on the map. For other directions, you have to pick a different tool. To remove a railway you have to activate the bulldozer tool and pick the direction. This is tiresome. For editing boolean edges between cells, it is sufficient to be able to toggle the state of each edge. This one tool takes care of all directions as well as removal. There is of course also room for higher level tools to build longer stretches of rails.

Let's try it! Tap or click edges on the map below to create railways:

(JavaScript must be enabled for the interactive map)

I have already had some time to experiment with this, and I am very pleased with how it turned out. I enjoy building rails this way. However, I also have some concerns and already some rough ideas for how to counter those concerns. That will be something to write about another time.

, 2020