[Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2227
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

[Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by boskid »

Refs:
- 74116 - but here there is teleport instead of building (building is already prevented)
- 74652 - but here there are no overlapping entities
- 73840 - but here no entities are teleported from fluid system that contain fluid mixing (teleport from blocked fs is prevented)
- 74614 - may be related depending on internals, here is teleport, other topic is of create_entity

Issue (base game):
fluid-mixing-by-teleport-base.gif
fluid-mixing-by-teleport-base.gif (83.24 KiB) Viewed 5302 times
Same Issue with mods (mod: Picker Dollies - pointing entity and by Shift+down, entity is teleported down 1 tile):
fluid-mixing-by-teleport-pickerdollies.gif
fluid-mixing-by-teleport-pickerdollies.gif (70.6 KiB) Viewed 5302 times

Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Dominik »

I have banned teleportation into a system with a block.

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

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by boskid »

Dominik wrote: ↑
Mon Aug 19, 2019 2:42 pm
I have banned teleportation into a system with a block.
Oh, still no "deferred block fix" :(

How about this case then, will it also be fixed?
74702-two-purpose-teleport.gif
74702-two-purpose-teleport.gif (52.31 KiB) Viewed 5223 times

Blacky007
Fast Inserter
Fast Inserter
Posts: 177
Joined: Fri Dec 29, 2017 8:05 pm
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Blacky007 »

I think this is how Dominik feels after joining the office and seeing the next pipe bug.
1247424136640.gif
1247424136640.gif (441.69 KiB) Viewed 5161 times
keep up the good work.
My color birthday was May 2nd 2020 - Thank you Enchroma

Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Dominik »

Yes that is me exactly.

Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Dominik »

boskid wrote: ↑
Mon Aug 19, 2019 3:41 pm
Dominik wrote: ↑
Mon Aug 19, 2019 2:42 pm
I have banned teleportation into a system with a block.
Oh, still no "deferred block fix" :(
With how teleportation works I don't think it could ever fully work.
boskid wrote: ↑
Mon Aug 19, 2019 3:41 pm
How about this case then, will it also be fixed?
74702-two-purpose-teleport.gif
I think so.

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

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by boskid »

Dominik wrote: ↑
Tue Aug 20, 2019 8:18 am
With how teleportation works I don't think it could ever fully work.
I would work with ease. Deferred block fix would perform "block fix" (that cannot be easily reverted) in time after "transaction" (where everything may need to be reverted in case of fluid mixing detected). "block fix" just cannot be performed anywhere in between of partial actions like removing ghost, creating ghosts removing fluid boxes, adding fluid boxes. Postpone this to later when action is already completed or reverted. This would solve most of this issues and could allow to restore actions that are currently blocked as a "implemented workarounds". I think it would be so powerful you could even allow placing entities that would enter blocked undergrounds instantly, but since block would be fixed only after all other setup actions, it could be that placing entity in fact removed some connections and there is no fluid block. This solution would be quite generic: in gameAction or somewhere else, at end iterate above Queue<DeferredAction>, and this queue would be filled with "please check this underground for possible block fix" objects. Simple and powerful modification to gameAction (or what drives entity creation/destruction), not specific to fluids, deterministic (objects would be inserted in order of processing fluid systems) and with low performance hit (you would gain since you do not need to traverse again any fluid systems that were marked as possible candidates for fix in case of scope lock)

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

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by boskid »

How i see all this issues i reported lastly:
- 73840 - teleport(0,0). Fluid mixing is because "block fix" was performed when pipe is first removed and then inserted without details as to which fluid systems it should connect. Connect all regular connections first then perform all undergrounds, one would be blocked. Defer fix and after all, deferred action would just skip block fix as it cannot be safely done. Implemented solution: banned action
- 73819 - merge_forces. When moving pipe-to-ground from one force to another, first connect regular connectors (not underground). Defer undergrounds for later. After all entities are moved to new force, perform all deferred fixes. At most you could end up with two pipe-to-grounds touching itself and still being blocked. Implemented solution: wont fix
- 73890 - mixing by pipe upgrade. Issue is because "block fix" is performed in between of removing old pipe and inserting new pipe. Because regular pipes are always connected (no overworld pipe block) there are fluid mixing. By deferring block fix, upgraded pipe could be put to pipes that are almost as before removing old pipe. Implemented solution: banned action
- 74116 - mixing by building underground pipe. Issue is because "block fix" is performed in between of disconnecting old underground connection and creating new pipe-to-ground that would provide new path. Deferred block fix would prevent early block fix on left. Implemented solution: banned building undergrounds to fluid system with block. Later i describe that rotation works fine. This is because of scope lock that essentialy works as "deferred block fix" - it just prevents it happening where it should not and performs block fix in the end where scope lock is removed.
- 74614 - this is just abuse of not correctly preventing build action. Should be easy to fix with deferred block fix
- 74624 - this issue may be quite hard. With deferred block fix it should work quite nicely. First case would unfortunately lead to situation when one of undergrounds cannot be merged at time of overbuilding ghost or during removing ghosts, but this would be deferred and later decided that it really cannot be fixed.
- 74657 - this issue also works on early block fix. After test rotation there is fluid mixing and so furnace must be rotated back. Unfortunately this looses some information about to which system it was connected. Two undergrounds to connect, first passes, second one is blocked and so defer action so again one underground is blocked.
- 74746 - this issue also works on same principle. I just forced block fix to happen, but in between of removing fluid boxes of single entity. Because of this there are some block fixes that are performed and they change fluid system state (most likely root fluid box or something). With deferred block fix this entity would be just removed (no major changes in fluid systems) and after that deferred action would check for possible fixes. Here there may be that in deferred block fix queue there will be some objects that point to fluid boxes that are already removed. This case would need something interesting approach.

-- edit:
I may be wrong somewhere estimating how deferred block fix would help with above issues, but all of them are because core issue - early block fix - is still there, and all implemented fixes are just ways of preventing this issue to show up (instead of just fixing it)
-- edit:
- 74624 - second case may be somehow hard because of order. If first ghost is removed then J segment connects to crude oil, then placing pipe would create fluid mixing because regular connections are never blocked. Because of this, even regular undergrounds should be connected only in deferred, even when one side is not assigned. This would however lead to solution similar to how transport belts work - they merge into larger transport lines, but during any action the instantly split (~2 tile radius from point of action) to avoid weird cases. Then there is deferred (around 120 ticks) merge that joins them again into longer transport lines.

Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Dominik »

You are putting a lot of work into it, thank you for that :)
We have had this discussion before and as I said before, I agree that it could work this way. But this whole issue of blocked pipes is just a tiny ridiculous area that almost no one ever runs into in their real games and is not really worth all this effort. If I had a pipe explode when a block is discovered, it would be an ok solution. Banning all actions until the block is fixed would be an ok solution. Now me doing a lot of work to fix all these cases is somewhere in between. I am trying to leave more space for the player - whenever it is not too much hustle. But this issue is still so insignificant that it should absolutely not affect the general performance or generic code like action handling.
If I wanted to prepare these deferred actions, I would either have to check all fluid systems after every action performed, which costs performance for everybody. Or I would have to be smarter and only check systems that were touched and have blocks, which would already mean doing big part of the work I am doing with the current solutions (collecting the affected fluid systems at all code paths where such issues can occur) and it would still cost some general performance and code tidiness.
Your proposal makes sense and would work, but the importance of the underlying issue simply does not warrant going so high in the code.
If I knew there would be so many problems with the pipe blocks, I would have had it explode from the start. Now it's just about pushing that one last fix before it is ok and nobody cares anymore. For weeks now I haven't seen block related crashes in the logs from anybody other than you. Which is cool and it is good to find the bugs and fix them and it's great that you do. What I mean is that if it does not work perfectly, if it does not allow some actions that perhaps could be made to work, nobody would even notice.

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

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by boskid »

Dominik wrote: ↑
Tue Aug 20, 2019 10:16 am
I would either have to check all fluid systems after every action performed, which costs performance for everybody. Or I would have to be smarter and only check systems that were touched and have blocks, which would already mean doing big part of the work I am doing with the current solutions (collecting the affected fluid systems at all code paths where such issues can occur) and it would still cost some general performance and code tidiness.
I think that when doing fluid system split if you traverse it, only thing that is needed is that if you hit underground that is not connected but could be, just add record "check this underground pair for merge" into deferred queue. Because of this queue it could contain many records that would be detailed and so there would be no penalty for whole fluid system traversal.

Btw, i would be quite happy to have some bugs left in game. Watch 31:00 to 34:00 from Anti's https://www.twitch.tv/videos/469038195

Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Dominik »

OMG :D
You know there is a market for exploits, you could have sold it :D

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 2420
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by BlueTemplar »

Ok, this is waaay over my head now, but what are the consequences for Picker Dollies? (and Picker Pipe Tools? (and both combined?))
BobDiggity (mod-scenario-pack)

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

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by boskid »

BlueTemplar wrote: ↑
Tue Aug 20, 2019 12:10 pm
Ok, this is waaay over my head now, but what are the consequences for Picker Dollies? (and Picker Pipe Tools? (and both combined?))
If you try to move pipe that is connected to FS with block, you will not be able to move pipe (with hint "entity does not support move"). If you will try to move pipe into FS with block, Picker Dollies will throw pipe out into abyss (or in case of moving 1 tile down, about 20 tiles above; 1 tile left: throw 20 tiles right) because it first moves entity somewhere else and then tries to put it in new position.

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 2420
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by BlueTemplar »

Ok, so like in recent 0.17 or better, thanks !
Also thanks for explaining why pipes & assemblers kept jumping into the ocean in my Py Block test game...
BobDiggity (mod-scenario-pack)

User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 883
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Oktokolo »

Dominik wrote: ↑
Tue Aug 20, 2019 10:32 am
You know there is a market for exploits, you could have sold it :D
Just days until boskid is able to open remote shells by exploiting his favorite "fluid-mixing prevention violation" bug class. If you see a calculator suddenly opening, turn off the computer and unplug the network...
:P

Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Dominik »

Oktokolo wrote: ↑
Tue Aug 20, 2019 2:29 pm
Dominik wrote: ↑
Tue Aug 20, 2019 10:32 am
You know there is a market for exploits, you could have sold it :D
Just days until boskid is able to open remote shells by exploiting his favorite "fluid-mixing prevention violation" bug class. If you see a calculator suddenly opening, turn off the computer and unplug the network...
:P
Yeah good thing linux does not use fluid simulation.

Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Dominik »

Dominik wrote: ↑
Tue Aug 20, 2019 3:53 pm
Oktokolo wrote: ↑
Tue Aug 20, 2019 2:29 pm
Dominik wrote: ↑
Tue Aug 20, 2019 10:32 am
You know there is a market for exploits, you could have sold it :D
Just days until boskid is able to open remote shells by exploiting his favorite "fluid-mixing prevention violation" bug class. If you see a calculator suddenly opening, turn off the computer and unplug the network...
:P
Yeah good thing linux does not use fluid simulation.
Actually that also has pipes lol. There is a window there.

User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 883
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: [Dominik][0.17.66] Fluid mixing by teleport of pipe-to-ground

Post by Oktokolo »

Dominik wrote: ↑
Tue Aug 20, 2019 3:53 pm
Yeah good thing linux does not use fluid simulation.
Well, be carefull when joining public multiplayer servers - boskid might have owned them by exploiting one of the bugs from the ever-growing "fluid-mixing prevention violation" class and Factorio servers can easily make the same bug trigger on each connected client by sending the right updates...
Don't become Cisco! :shock:

Post Reply

Return to β€œResolved Problems and Bugs”