about 1 year ago - V453000 - Direct link

Hello!
The code refactor of rails presented last week is great, but the motivation for such a task wasn't quite just some shape changes for rails.

As explained last week, we can now define any kind of rail shape, and we had some very specific shapes in mind all along...


Over or under?

We want multi-level crossings for trains, but how? Bridges or tunnels?

At first it would seem like going underground is the safer bet - we already have experience with belts and pipes doing that. Simple - we draw the entrance and the exit, the middle is magically connected, and that's it?

  • The second layer of rails should also be able to use curves and rail signals, otherwise it would be quite limited.
  • Sometimes you already want to interact with items inside of underground belts, with trains this would be a lot worse as they can run out of fuel, stop at signals etc.
  • Building curves, signals or interacting with trains inside of a tunnel probably means we need to be able to walk inside.
  • If we can walk in a tunnel, biters and robots should be able to as well.
  • If tunnels can have curves, how could you tell which tunnel entrance connects to which exit when looking from the outside?
  • Tunnels "over" water don't quite feel right.
  • Drawing tunnels would be surprisingly difficult as we would need to do some expensive masking that Factorio isn't currently capable of.
  • And more...

The idea of an elevated rail seems to have much more potential, although drawing in an upper layer certainly won't be easy either.
Also, you just want to boldly see all of your trains in their full glory instead of hiding them somewhere in a cellar!

Such an idea would consist of:

  • Rail ramp - The transition between the lower and upper layer.
  • Elevated rail - Tracks buildable above most things.
  • Rail support - Elevated rails would need supports at some intervals.


Elevated rail system pieces. These were the "greybox" graphics to test the gameplay of the new rail shapes and the ramps, before the final graphics were created.


Elevated rails

I know you've already scrolled down to see the ramps instead of reading this but it just felt weird not to put a paragraph here.

When we thought about the visual design with Albert and Earendel, we wanted the ramp to be heavy and industrial, but at the same time not quite perfectly stable and rigid. After multiple iterations we have arrived to this combination of a solid concrete base combined with an upper metal structure.

The concrete base helps clearly show where the ramp touches the ground, while in contrast the metal part has a lot of holes so you could see entities placed behind the ramp most of the time. The metal is painted red, as mostly the only other red entities in Factorio are related to trains, it helps the elevated rails belong to the train family, and stand out in the factory - as they should with their height.

The rail ramp is the new longest entity in the game at 16 tiles long and 4 tiles wide, so you will need to consider where and when to place it. It can only rotate in 4 directions.

The rail support follows the style of the ramp, but with the difference that it can be rotated in 8 directions.

It has a roughly 4x4 collision box, with the rotated ones all having the same shape.

The elevated rails can be built between ramps, held by rail supports along the way.

The elevated rail can be constructed above anything except tall entities (rocket silo, roboport, big electric pole, etc.).

They have exactly the same rail shapes as the new ground rails do, and signals can be attached to the elevated rails.

There are fences which help visually distinguish the elevated rails from ground rails, you can also see how they disappear on track crossings.


In practice replacing a colliding connection inside of a T junction with a ramp going around it can already help a lot.

Mp4 playback not supported on your device.

With the ramp being long and since we have "only" two layers, building a fully multilevel junction can get rather large, but the throughput potential is massive.
It's worth noting that it's not just the level separation that helps. It's also the fact that we don't need chain signals, so we can shorten the distance between normal rail signals a lot as we don't need to guarantee there's enough space for a train "behind the junction".

Mp4 playback not supported on your device.

Specifically in arrays of train stops, having the exit and entrance on different levels is a game changer.

There is a very special patch that draws under terrain which is visible only in places where the ramps or supports touch water.

Mp4 playback not supported on your device.

In case you decide to route your rails through a lake because why not, islands can become opportunities for multi-level crossings.


Building something elevated can be done with the rail planner. Either you can press a keyboard shortcut to switch the destination layer or you can start the rail planner on a ramp, rail support, or an elevated rail.


But one day, kovarex said "Why doesn't the rail planner just snap to the rail you're pointing at?"
And since that day it does, rail planner "just connects" to any rail you pick, including between ground and elevated levels.
This also massively helps mitigate issues related to the rail planner having more directions.


The rail planner can often find connections you wouldn't even expect to be possible, which can be mesmerizing to play with...

Mp4 playback not supported on your device.

...as a result, this can happen a lot quicker than you'd think.


Conclusion

Allowing trains to cross paths on different levels has been one of the most requested features for a very long time. We had always felt it makes perfect sense, but trains in Factorio would rarely ever get into serious enough throughput issues to justify adding elevated rails.

The expansion changed this landscape quite a bit though. If we expect players to generally build larger factories than in the base game, train throughput could become an issue, and since you are expected to travel away from the home planet, having a train system that doesn't deadlock would be more important than ever before.

It's not hard to guess that implementing this would require a lot of time, and working on the expansion behind closed doors allowed us some breathing room where we could make bigger experiments.

Between boskid with the mechanics and posila with the drawing code, just the programming took a few months. On the graphics side, we could reuse a lot of initial Blender setup from the rework of ground rails, but that didn't get us very far. The ramps were simply large objects, while the rail supports are a hive of optical hacks as they need to fill their collision boxes. Both the ramps and supports were reworked multiple times to finally get the result that would look and function well.

Especially because of the elevated rail fences, the required sprite count grew very rapidly. This made me use all the tricks in our Blender book and even add completely new Blender Python tools that mostly help with organizing and rendering large amounts of outputs. I got the final iteration to about 90% completion but then it just became too much.

Jerzy already had experience with rail graphics, so I had asked him to help me by finishing the last details and texturing, and then he handled all of the signals and remnants again. It's hard to overstate how much bravery and mental fortitude was required to "just" jump into the Blend file of the elevated rails, and I'd like to thank him for that, again.
You can probably see from the above images that he did excellently. :)

Between Earendel on concept art, me on most of the 3D process, Jerzy on finishing and together with Albert on re-evaluating multiple major iterarions, the graphics took about 9 months to make. Perhaps we could have taken some simplified route trying to make tunnels work, but we believe the elevated rails offer better gameplay beyond comparison.
Yet again we can confidently say that properly focusing on some features in the expansion rather than trying to shove more things into 1.0 was a very good decision.

All of the elevated rails will be only available with the expansion executable. Their technology can be researched using Production science packs without the need to go to space or any planets. Elevated rails be will one of the standalone official mods next to Quality and Space Age, so you can play a vanilla-like game with just the elevated rails for example, or other mods can just depend on Elevated rails.


As always, we are looking forward to all the feedback you are about to elevate.

about 1 year ago - /u/V453000 - Direct link

Originally posted by alvares169

will there be ramps for stations too? Two level megabase confirmed? Item elevators??

Stations can only be placed on the ground ... inserters can't interact with trains on elevated rails anyway.

about 1 year ago - /u/V453000 - Direct link

Originally posted by Zr4g0n

It seems the rail supports have a limited 'lift range'. If so, how long is that?

On straight it's about 20 tiles between. You need 1 rail support per 90deg curve, so a full circle needs 4.

about 1 year ago - /u/V453000 - Direct link

Originally posted by gandalfx

I know you've already scrolled down to see the ramps instead of reading this but it just felt weird not to put a paragraph here.

The self awareness! :D

(:

about 1 year ago - /u/V453000 - Direct link

Originally posted by raur0s

We had always felt it makes perfect sense, but trains in Factorio would rarely ever get into serious enough throughput issues to justify adding elevated rails.

I beg to differ, but I'm not complaining. Better late than never.

With all respect, in a "normal" game you never really reach it. When you get to megabase territory, sure you do but it's still very late :)

about 1 year ago - /u/V453000 - Direct link

Originally posted by TheChubFondu

Do the rail supports automatically place if dragging the rails to create large segments? Or will we have to change our item to place them manually? (Thinking pre-bots)

The rail planner places them automatically.

about 1 year ago - /u/V453000 - Direct link

Originally posted by unwantedaccount56

Interesting detail: the upper level is 3 tiles higher than the ground level. Because the train grid is 2 tiles wide, you never have an upper level track exactly on top of a lower level track of the same direction, so the rail planner will always know which track it should connect to.

Exactly :)

about 1 year ago - /u/V453000 - Direct link

Originally posted by eable2

This is really really great work, and I appreciate how hard this must have been to implement!

As excited as I am, I do have a small critique: Even though the ramp entities are huge, they still feel a little small and steep for how fast trains in Factorio can get. In the GIFs shown, it feels like the trains should be launching off of the rails. I don't think Factorio trains have upstop wheels!

My suggestion is therefore to force trains to slow down if they're going on a ramp. Or another idea, if you're feeling adventurous, would be to have another even huger ramp (2x size?) that lets trains go at full speed.

Weeelll, today you've learned that they do have upstop wheels!

Checkmate!

Embrace the RCT <3

about 1 year ago - /u/kovarex - Direct link

Originally posted by Krashper116

do you need to craft ramps and supports? or will the rail planner make them the same way curves are created?

You have to craft them - they are 2 special items

about 1 year ago - /u/kovarex - Direct link

Originally posted by yoriaiko

What happens if bitters destroy rail support?

What if the train will be on top of supported part?

Can we make solid wall of super heavy supports to protect base? (ah that reminds me of pipe walls from before concrete)

When rail support is destroyed, all the rails which wouldn't have enough of support are destroyed as well.
When you try to manually mine the support, it will automatically select (and mine), the rails that depends on the particular support first.

about 1 year ago - /u/kovarex - Direct link

Originally posted by trplclick

Are elevated rails a special item or are they just regular rails?

regular rails.

about 1 year ago - /u/kovarex - Direct link

Originally posted by BiblicalFlood

When you try to manually mine the support, it will automatically select (and mine), the rails that depends on the particular support first.

You guys think of everything. How will this work when the player's inventory can't hold all the rails? Like belts, where it dumps the items on the ground, or like chests, where you mine what you can hold and the rest, including the structure, stays?

Its not like we think of everything. We just played the game, and realized it is quite annoying otherwise.

When you don't have space in the inventory, it just fails to mine the same way as if you wanted to mine the related rail directly.

about 1 year ago - /u/kovarex - Direct link

Originally posted by SBlackOne

Will they require concrete? Would make sense of the way they look.

Yes






Recent Factorio Posts