News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Simutrans on hexagonal grid

Started by janry, May 09, 2026, 12:08:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

janry

Hi,

TLDR: I'm porting simutrans to hexagonal grid.
https://github.com/SupraSummus/hextrans
https://github.com/SupraSummus/hextrans-pak128
Game is not playable yet

I played Simutrans a bit back in 2018 or so and I thought: nice game, the passengers know where they want to go.

Just kidding, I though: it would be cool to have this on hexagonal grid. That would take out some square anisotrophy observable in the train movement speed and other places.

I even starting digging at the code and figured out that converting simutrans to hex grid is a huge task. Shocker. Also, I dont have much experience with cpp. That combined made me abandon my wishes quickly.

And then AI coding came. At some point in 2025/2026 I became convinced that with frontier, paid models and tooling I can take on big projects in technologies I don't know in deep. General programming knowledge and systems design skills are enough - and I believe I have them. So I started porting Simutrans to hex grid. Still not easy, but realistic task for me. Please do not think this is as easy as prompting AI with "make simutrans on hex grid, make no mistakes".

And then I realized pakset needs to be ported too...

Anyway, dropping it here for some community engagement and for motivation. Technical-level thought I might provide in thread responses. A lot of it you can probably get yourself from the repos - just check `AGENTS.md` / `CLAUDE.md` / `TODO.md` as they contain most maintained documentation

Cheers, Jan

Isaac Eiland-Hall

It hurts my brain. lol.

Seems like there could be some really fun stuff you could do. And with "diagnoals" (which is really stair-stepping not a true diagonal),  you can even get 90° turns, as one screenshot does show. heh.

poppo

Interesting!

How are the coordinates definition, handling the edge of the map, and multi-tiles buildings?

janry

Coordinate definition: I use radial, flat top coords. See the nice visualization here: https://www.redblobgames.com/grids/hexagons/#coordinates-axial
The whole map is a rectangle in coord system, which means it is parallelogram in physical space.
I plan to add a bound on the "third axis" (from the cube coords: https://www.redblobgames.com/grids/hexagons/#coordinates-cube), which produces a hexagon map.

I did not touch handling of multi-tile buildings yet. So rectangular buildings translate to parallelogram buildings in hex space. And I use old square art assets (until they will be ported), which results in "broken" look. See the city hall in the last screenshot. It has a gap in the rendering.

Two demos of hexagonal train game I loosely based on:
https://magnushoff.com/blog/hexagonal-train-game/
https://www.redblobgames.com/x/2016-hex-rails/

prissi

Very interesting.

Axis and cubes are the same, you can always get the latter from the first. This may be needed for calculating distances.

And I see, it is difficult to guess where the slope starts as the one with the track works but the bridge does not. I guess every second tile will have this issue. Anyway, that is probably solvable with more logic.

However, the biggest hurdle will the extra views needed for almost every object, like six rotations instead four and so on. I guess, something like pak128.britain, where everything is rendered, could be used to generate a new pak for this. This was the reason why we never added more turning graphics, since more objects in Simutrans were hand-drawn.

I think a nearly simutrans-like game but with more freedom of 3D is Machinsky https://store.steampowered.com/app/598960/Mashinky/ Unfortunately not open source.

janry

Quote from: prissi on Yesterday at 01:23:07 PMI guess, something like pak128.britain, where everything is rendered, could be used to generate a new pak for this.

Thats useful info! I need to have a look into said pakset.

Bridge drawing looks broken because of bad pak assets. I tried re-modelling standard pak128 in 3d (using AI  :P ) and then rendering into hex viewpoints. Not much luck with that approach.