Check all possible pipe voxel shapes to make sure that there is no pipe overlap
Technici4n opened this issue ยท 1 comments
I still have no idea how the overall system works, but I think the concept could work in some way and is relatively simple to deal with.
In the end when pipes share the same block it's like breaking the single block into smaller nodes. There are many possible ways for a pipe to go, within the block, but since they don't go diagonally, they still path as a collection of smaller cubes. So they occupy a node and can then connect a different one by going through each of the 6 "faces".
To check for conflicts (and to avoid them before they happen), you simply register or recompile an array of those nodes in the block, and give it a simple boolean. It's either free or occupied.
You don't need to know the direction of the pipe, or if a node is connected from below, or from the right or whatever. You just need to know if a pipe occupies that node. Because 3d ends up just like an array of 2d grid. You only always move from one node to the next, and if the node is free then the path is also always free.
As long pipes "walk" the map step by step without jumps, there would be no risk of them crossing each other. Including the angles so they are also made of two nodes. For example a pipe start from node A, moves left to node B, and then moves up to node C. The angle represented by node B will never intersect with another pipe because that node will be flagged as occupied and the other pipe will have to find another path around.
(the only special case I can think of is that a pipe needs to be able to flag the nodes that are occupied by itself and consider them vaild, for example when you connect the to the same pipe going in different ways)