log #10: Switches and Rails

Time interval: 2024-02-11/2024-03-03

Here I am with another post. Not much time passed from the release of the last one. In fact, in this time I only managed to push out two new commits. However this is in line with my plan to write these posts much more frequently - it’s much easier to write about something I did in the last two weeks, than to describe work done over multiple months.

Rail Fixes

I was very happy with how my new assets turned out, but one thing was still a bit off: the rails. There were two problems:

Problem 1: Narrow Rails

When looking at the trains riding atop the tracks, one could notice that the rails seemed to be way too narrow. At first I thought it was maybe a problem with the perspective, but after inspecting both the locomotive and the rail models inside of Blender, I stumbled upon quite a large mistake I made.

The gauge was too small.

So how did this happen? I am using Asset Forge to create my models. Thankfully, the program contains premade rail assets, so I just used them without much thinking. However, these assets are part of the “mine” set, not part of the “train” set. In the end I fixed the issue by spending a lot of time in Blender.

Problem 2: Floating Trains

The second problem was a programming bug, which resulted in the train sometimes floating above the tracks. This bug was cause by incorrectly rounding the entity angle while getting the bounding box. This resulted in a bounding box with a rotation difference of about 11 degrees being used in the train offset calculation.

After fixing these issue, the trains look much better.

Switch Rework

This update was more of an internal change. Up until now, the only supported switch was a classic two-way switch with fixed dimensions. I knew that I will need to have more options in the future, when I will be attempting to rebuild real layouts.

For this reason I created a system, which allows me to define switches in a json file and then choose between them while building. This is the first of many changes coming to the way switches are implemented.

If you are interesting in finding out more about the development of my game, or want to try playing a demo, you can visit our discord server.