[1.0.0] more trains fit between signals than the preview shows on c

Bugs that are actually features.
Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1234
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

[1.0.0] more trains fit between signals than the preview shows on c

Post by sparr »

Code: Select all

0eNqlltuOmzAQhl+l8k1vAPlsnGeo1N5XUcUSK7FE7AhItlHEu9cEQkp3sg3OHcaeb37PQZ4LequO5lBb16LVBdnSuwatfl5QY7euqPp/7flg0ArZ1uxRglyx71d1YSvUJci6jfmNVqRbJ8i41rbWDPbXxfmXO+7fTB0OTJblsT6ZTXoFJOjgm2DjXe8ocFImaYLOaMVkHugbW5ty2CZd8gFKZ3LScldYl47CITTJxABX4WuO5wCeTfjKl37vW3syIJeNVJlhJoiQtIf72gZeMZzEyTV+TW/z7v0maOcd4JJPLps23Gm7ax8H6uaVQSAxgXpOiErrD3BMJkoSfI5yEQKQMkKbgLSpCJCCQHkESEMgfa/Oot769L3YBttPMDl7nOq+yKw7hT++DmfdsaoAlwQvF58TSDwhESSwaAiNIIEpJmxpRDV+OaIRzZODdUVEBAksLBLRNBrOckTXaDjL+eLcqJdzoyPUg5VFI/pGg1mmEX2jwSxTujCiHPNXI0rZYvUcg5VFeQQJrCwqIkhwluXT8wIfOATPH3QBUdWzLzrPOCccSypu9ExhRqBs4ZxJRbUQklGKtVIqZ/R69uObD981f/auCo9q5PyuFKIu6Tg1ctmcy6ChCM+Hrk/GLZ7dosf+Hbeg7LAF/ahuitX/I8EWvGpKPOKG+bYpd2ZzrMYB915B/Zr9tT/Mz9Ms9cO05sv3r99MEdq5W/cK57ZUPW+8Hooq7Nzn9gSdTN0MOnPCFddKKoKlkF33B94f0mc=

Code: Select all

0eNqtl92O2jAQhV+l8k1vQuT/H55hpfa+QlUWLDZSiFES2CKUd69DWHahbusj7aVj+4tnzhkncybPzcHvu7odyPJM6nVoe7L8cSZ9vW2rZno2nPaeLEk9+B0pSFvtplFX1Q0ZC1K3G/+LLNm4Kohvh3qo/bz/Mjj9bA+7Z9/FBbed60N39JvFBVCQfejjntBOL4qchTC0ICeylExH+qbu/Hqe5mPxB5TfoE1Yh10Y6qNPMbUrGVdXriqlEnEY8aGrI7Ga19KSaW6tc9ZwQQWljgrBqbjsnILvJ95rCJv4YjkmjiNux+mHGN72ZfhrlNpcTyPuoxQJrLxL+uIqTAoqy7cgRanuwSoBVtnnldxdweb/qmgAa/KxBsCqfKwFsCIf6wAsy8cyms9lgGaMAVxANMYBLqAaEwAXkI1JgIvoBtQaRXTTeVegpKI0ylh2VxoP91/qolOpi44BtUgRtwDFSBG3ANVIAbdwoBop4Bb+4WtZdduweK22cW3iync6U9b2GB+FLq5pD02Temd+pQoHOJQDX0UHeIVLgAt4havc3Fv3abnXQCyIPw3ARfyZX6cxSwDXAVzAK4Jma8o/S1PBgFgAfwqgTi3gFQHUqQW8ImRu7o16yL0undPUxYmECNJZKZVW8XddWe2Mos5opTPFyf8cCwMYWACFbBADA4VsEDPZzN5CcnvrLexjb6FTZJdLpvpf5NhW9usXvzk0177y/TdnGvMP83Pb+mYR8t0P/su3r0++ikYYV9MZ7/cynb95Nf8ZxZn3drkgR9/1c24tk0ZGAxpGownH8TcRQfA1
These two blueprints both fit six cars, but the preview when hovering the station or signal only shows 5 (even when the option is set higher than 5, that's just a coincidence, the bug also appears with other lengths)

Rseding91
Factorio Staff
Factorio Staff
Posts: 11928
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by Rseding91 »

Looking at it my guess is: the position rendering and the actual train positions are 2 different pieces of code and so the preview isn't representative of what actually happens when you put a train on it.

I don't know if one of the other developers wants to go tinker with it more or call it 'good enough' so i'll leave this for them.
If you want to get ahold of me I'm almost always on Discord.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1569
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by boskid »

Not a bug.

You can place 6 rolling stocks and the 6th one does not register as being inside of the adjacent rail segment because of the rail joint placement (they are not at the absolute ends of rolling stock but are 1 unit inside) however the rail segment has length of 41.84 meaning that part of the rolling stock collision box would be outside of that rail segment. Moving last rail joint back by 1 unit leads to different rail block so the 6th spot is not rendered.

sparr
Smart Inserter
Smart Inserter
Posts: 1234
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by sparr »

I'm not sure why you think this is not a bug. Everything you described about the internal mechanisms doesn't seem to be actually important from a player point of view. Six cars can stop in that block without causing the previous block to turn signals red, and that's what matters to me as someone laying out my rail network. When would these other things matter?

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1569
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by boskid »

Without this check something like this could happen:
89185-no-check.png
89185-no-check.png (147.28 KiB) Viewed 766 times
I do not want this to happen so the joint is moved 1 unit more to check if the rolling stock will be entirely inside of a single rail block.

sparr
Smart Inserter
Smart Inserter
Posts: 1234
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by sparr »

The point of this bug report is that the check is faulty. The current implementation of the check reports that a rolling stock will not be entirely inside a rail block when it actually will be. I definitely don't have enough insight into the game code to understand why it's wrong, I can just see in the game that it is wrong.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1569
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by boskid »

No. It is 0.16 of distance outside of current block. End of the rolling stock is at the point A while the block ends at the point B.
89185-detailed.png
89185-detailed.png (196.21 KiB) Viewed 697 times
If you want to measure the length of the segment yourself, use this command by pointing onto a rail between a train stop and a signal (no junctions or other signals in between as they will split rail segment into multiple smaller ones)

Code: Select all

/c game.print(game.player.selected.get_rail_segment_length())
If it shows you less than 42, train visualisation will not show 6 boxes. On the first blueprint it shows 41.84208 so there will be at most 5 boxes from train visualisation. Second blueprint after adding missing diagonal rail shows 42.6705 so there are 6 boxes from train visualisation.

sparr
Smart Inserter
Smart Inserter
Posts: 1234
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by sparr »

Thank you for helping explain how the current calculation works.

That does not change the fact that the current calculation does not match the relevant game mechanics.
Screenshot-2020-10-02-231810.png
Screenshot-2020-10-02-231810.png (511.03 KiB) Viewed 656 times
Notice the green signal. When the train stops in the given position, the block behind it is not occupied according to the signal and routing algorithms, and another train will be able to enter that block. If it's following the stopped train, it will move right up against it, nose to tail. If there's an intersection crossing the cyan segment then trains will drive through it. As far as I can tell, that's the only thing that really matters. I can't find any practical game effect of the calculation you're describing.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1569
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by boskid »

sparr wrote:
Sat Oct 03, 2020 6:20 am
That does not change the fact that the current calculation does not match the relevant game mechanics.
I know, and it is intended to not follow them. You are right that the block behind is not occupied by that train since the last rail joint is within block ahead with a 0.842 of distance to spare. However the last rolling stock box is not rendered because the rolling stock box itself would be outside of the current block.
89185-box-outside-of-block.png
89185-box-outside-of-block.png (147.53 KiB) Viewed 642 times
In this case train is also able to have all its joints within a single block so following your logic the box should be rendered. However the box itself is clearly outside of current block and is misleading and is not always guaranteed the train will leave the block behind because the rail joint is exactly at the transition so it may not transition to the next rail block yet.

If you want to squeeze every possible bit of rail distance accepting some trains artifacts, you may use the get_rail_segment_length() ruler and if it shows more than 41 (but not 41 exactly), the train should fit entirely inside of that rail segment and release the block behind, however the 6th box will not be rendered until the get_rail_segment_length() gets up to 42.
89185-box-within-block-but-gfx-not.png
89185-box-within-block-but-gfx-not.png (381.71 KiB) Viewed 642 times

sparr
Smart Inserter
Smart Inserter
Posts: 1234
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by sparr »

Why doesn't the internal code use >41 instead of >=42? That's what I still don't understand. What would break or be inaccurate if we did that?

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1569
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by boskid »

sparr wrote:
Sat Oct 03, 2020 6:29 pm
Why doesn't the internal code use >41 instead of >=42? That's what I still don't understand. What would break or be inaccurate if we did that?
Because it would look bad when box would stick out of the block.

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 463
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [1.0.0] more trains fit between signals than the preview shows on c

Post by Therax »

I'm with sparr here. Functionality trumps appearance. If 6 wagons fit in the block without spilling into the next block, there should be 6 frames shown, even if they visually spill past the train signal.

If it's desired that the frames don't spill past the signal for cosmetic reasons, then the logic for occupied blocks should be adjusted to account for the physical wagon size (collision box) rather than using only train joint locations.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

Post Reply

Return to “Not a bug”