[1.1.72] Replacing belt with underground belt can act strangely in a weird case

Post Reply
thedoh
Inserter
Inserter
Posts: 43
Joined: Tue May 02, 2017 1:37 pm
Contact:

[1.1.72] Replacing belt with underground belt can act strangely in a weird case

Post by thedoh »

To lead off: I apologise for the heinous post subject. This one is difficult to explain succinctly, and in fact, I recommend watching the attached mp4 before reading the text.

Attached is an mp4 of two scenarios involving smart belt replacement of belt with exactly the same setup. The scenarios both begin with a six tile belt running right-left with four single tile belts directly above the horizontal setup that each would sideload onto the six tile belt.

The bug (perhaps) is when the player wants to replace the horizontal belt with an underground to have these five belts all cross. What happens is that if you start the underground belt in the right side of the setup, it will break the horizontal belt up and cause the right-most vertical belt to "become" a part of the horizontal belt, looking like a hockey stick. Placing the exit for the underground belt will not cause the four intervening tiles to deconstruct. This first scenario makes sense because placing the first underground belt tile causes the previously horizontal belt to have a vertical component (eg the hockey stick).

The second scenario from the mp4 is a similar situation except placing the underground belt in reverse order: place the exit first (taking care to rotate so the exit continues to the left). With this scenario, however, there is nothing to break up the horizontal belt on the right side to create the "hockey stick" as in scenario one. Placing the starting underground belt here now doesn't cause the four contiguous horizontal (right-left) belt to become deconstructed; we get the same hockey stick as in the first scenario.

Both scenarios are very corner case (no pun intended) but I did see this come up in a speedrun recently, so I thought it worth exploring more. It seems very reasonable that the behaviour here is undefined in both scenarios. That said, I had a different expectation watching live and when I began testing.

Expected behaviour:

In the first scenario I think the game acted appropriately to cause the hockey stick appearance. Placing the starting portion of the underground belt breaks up the horizontal segment so how could the game possibly know that the player might want to deconstruct the four pieces.

The second scenario, however, I think is where the bug lays: In a normal test, if you place six horizontal belts (right-left), place the rotated exit underground belt and then place the starting underground belt, the game will deconstruct the four. In this scenario that does not happen and there's no reason not to, because the exit is placed before the entrance there's nothing similar to the setup in scenario one.

Magical Fairy Land behaviour:

In magical fairy land it would certainly be nice if the game would somehow know to handle scenario one in an human intuitive way and deconstruct the four belts. As a software engineer I understand why it doesn't, but it'd be nice if it did.

I hope the reader of this watched the recording first because as with many smart belt things, it's easier to see than to read a clumsy text description.
Attachments
Factorio 1.1.72 belt upgrade bug.mp4
(807.4 KiB) Downloaded 90 times

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

Re: [1.1.72] Replacing belt with underground belt can act strangely in a weird case

Post by boskid »

Thanks for the report. Issue here was that the underground building logic assumed that if belts between underground belt ends were straight they should get removed but that logic was slightly wrong as it could remove straight belts with side connections as well as showing what is reported here (on forward building one became curved so it was not suggesting removal but in backward building all belts were straight so there was a removal suggestion until second end was placed in which case again one belt became curved and no removal was performed). For 2.0 i changed this logic slightly so if a belt has side connections it will not be considered as to be removed by underground belt building which fixes this bug.

Post Reply

Return to “Fixed for 2.0”