Rolling Stock Collision Box Snap

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
adam_bise
Filter Inserter
Filter Inserter
Posts: 359
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Rolling Stock Collision Box Snap

Post by adam_bise »

I would like to see a rework to the way collision boxes for rolling stocks work.

The issue is that trying to align rolling stock is only feasible using straight rails, which kind of forces the player to the short train play style. Most people happily use the golden 1:2 train setup, but I would like to be able to use large trains that encircle a mine many times over etc. The problem is, of course, aligning the stops.

I propose a solution: A rework to rolling stock collision boxes that would allow them to snap to regular positions behind the scenes. There would literally be zero difference in the UI or player perspective.

Here is an attempt to explain: In both examples below, the train head and stop are off the page to the left and across curved rails.

Before:

======-======-======
^^^^^^

Train wagon collision box relative to inserter is a real number. At some values the number pushes off inserter ^ 1 or 6 (or both).


After

======-======-======
^^^^^^

Train visibly is still "off" a little bit, the train is represented graphically how it always was before, but this time the actual collision box that the inserters would interact with is snapped to a number that is aligned with the possible positions of a train stop. Now all 6 inserters would "work" because the collision box was aligned internally.

This wouldn't change the popular 1:2 setup, or any straight rail scenario.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2530
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Rolling Stock Collision Box Snap

Post by FuryoftheStars »

I think you need some screenshots with this one....
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Rolling Stock Collision Box Snap

Post by ptx0 »

i'm on board with fixing things but i might not know what you mean.

i've got a massive oil train that loads up 7 at a time. the problem with fluids is that the train after a curve, won't load up fluid wagons that sit before the curve.

another problem with fluid/solid wagons seems to be that certain multiples of wagons will have an "off by one" style error where pasting it a handful of times will eventually be incorrect. it was certainly easier to do a 6 wagon fill, than a 5 or 7.

adam_bise
Filter Inserter
Filter Inserter
Posts: 359
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: Rolling Stock Collision Box Snap

Post by adam_bise »

OK. Another try..
Start a map editor scanario. Make a slow train with a line of inserters going along it. Enter in one of the cargo wagons and hold your cursor over it to see which of the inserters are aligned with the wagon. Slowly go back and forward and see how at some points only 5 inserters are aligned. More when part of the train is on a curved rail, even with stops. This is because the arbitrary position of the wagons collision box is used to interact with the inserters, instead of the nearest aligned position.

You can also tweak the collision box values in data\base\prototypes\entities\trains.lua and observe the results.

We know when a wagon stops on a straight rail, the wagon opens up. These specifically could be internally aligned.

To do this, imagine a separation between the cargo wagons drawing_box i.e the train graphic you see in game, and the collision_box (actual position).

When a train stops and wagons along a straight rail "open up", their collision boxes could snap to the nearest alignment point internally, while the graphic remains arbitrary. making alignment of curvy trains MUCH easier.

This would not affect straight rail train because the stops are already aligned and no curved rails have mis-aligned them.

I don't know the actual distance of a joint. I do know rolling stock is 8 tiles per stock. I do know that the loco has the largest collision box, -2.6 to 2.6 so 5.2 divided among 8 tiles is .65 plus the locos 5.2 is still only 5.65.

I also know that when rolling stock collision boxes are increased to 5.6 then they crash into each other on an S curve. However, this MAY be because of the corners of the rectangle, which wouldn't matter on "opened" stock.. whatever that is.

Screenshots are requested:

Snapped position:
1.png
1.png (429.11 KiB) Viewed 1291 times
Arbitrary position:
2.png
2.png (510.37 KiB) Viewed 1291 times
The change would effectively make the wagon in screenshot 2 behave like the one in screenshot 1, while still graphically appearing a little "off".

If successful, all stock stopped on straight rails would always be able to accommodate 12 inserters regardless of whether part of the train in strung across curved rails.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Rolling Stock Collision Box Snap

Post by ptx0 »

but they always work, the collision boxes aren't what decide which interactions register. though i guess it's not hilighting them... maybe i'm missing context, can you zoom out in your screenshot to show why it's like that?

adam_bise
Filter Inserter
Filter Inserter
Posts: 359
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: Rolling Stock Collision Box Snap

Post by adam_bise »

ptx0 wrote:
Thu Dec 09, 2021 3:14 am
but they always work, the collision boxes aren't what decide which interactions register. though i guess it's not hilighting them... maybe i'm missing context, can you zoom out in your screenshot to show why it's like that?
They sure seem to. I can increase only the collision box size and get 7 inserters per side on a wagon.

This whole problem only exists for large trains where curved rails exist between the stop and the inserters. The curved rails skew all of the stock behind them. This is the issue. You can usually always get at least 4 inserters per side to work, but it takes quite a bit of effort to align the stop just right to get 6.

So players who want to use extremely large trains, say 250 wagons, either have to spend a great deal of time trying to align their stops, just be stuck using only 4-5 inserters per side, or make awkwardly long straight outposts. Fluid wagons are even worse, but at least they work after being modded.

I can mod the collision boxes and make it a little easier. It would just be nice if the whole issue was either handled internally, or the rails themselves were resized in such a manner that the whole problem disappears.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Rolling Stock Collision Box Snap

Post by ptx0 »

adam_bise wrote:
Thu Dec 09, 2021 2:13 pm
ptx0 wrote:
Thu Dec 09, 2021 3:14 am
but they always work, the collision boxes aren't what decide which interactions register. though i guess it's not hilighting them... maybe i'm missing context, can you zoom out in your screenshot to show why it's like that?
They sure seem to. I can increase only the collision box size and get 7 inserters per side on a wagon.

This whole problem only exists for large trains where curved rails exist between the stop and the inserters. The curved rails skew all of the stock behind them. This is the issue. You can usually always get at least 4 inserters per side to work, but it takes quite a bit of effort to align the stop just right to get 6.

So players who want to use extremely large trains, say 250 wagons, either have to spend a great deal of time trying to align their stops, just be stuck using only 4-5 inserters per side, or make awkwardly long straight outposts. Fluid wagons are even worse, but at least they work after being modded.

I can mod the collision boxes and make it a little easier. It would just be nice if the whole issue was either handled internally, or the rails themselves were resized in such a manner that the whole problem disappears.
ahhh thanks for taking the time to give such detailed explanations. i totally agree.

Post Reply

Return to “Ideas and Suggestions”