One thing which has to be done repeatedly is to layout the power grid after putting in all hatches, connecting fuel/o2/water lines, routing coolant.
For most of the grid areas there is only a single trivial solution; i propose a 'quick route' button that does something like the following (assuming the front of the ship is in the +x direction): Interconnects are both nodes and sources:
0) build a list of all nodes on the deck:
connect all nodes using trivial connections: 1) first pass front to back power conduits 1a sort the nodes by x, then y 1b if any node is at the same x co-ordinate the next one in the list, try to run a conduit between them 2) cross connect; 2a sort the nodes by y and x 2b if any node is at the same y coordinate as the next one in the list, try to run a conduit between them, unless it crosses an existing conduit.
3) connect unconnected sources for each source node scan +x, -x, +y,-y for an un (or under-)supplied conduit to connect to, and if one is found connect to the first conduit (and add a node)
4) find minimal cross-connects between supplied and unsupplied while(a new link is found) { for each link on the list if its 'amount supplied' is different to the next one on the list, then they are on currently separated networks: run a conduit, even if it crosses an existing conduit. add a node at the junction. Terminate conduit run if the node is powered, to avoid creating too many extra nodes. }
5) first pass nodes at unique x or y coordinates while(a new link is found) { for each un or under-supplied node scan +x, -x, +y,-y for a fully supplied conduit to connect to, and if one is found connect conduit (doesn't matter if this causes the connected to node to be under-supplied, as this will just trigger those ones to seek new connections) }
6) deal with residual L shaped missing nodes: eg that one o2 link between the compressed air tank and life support 6a for each unsupplied or under-supplied node for each source node with space capacity check to see if you can add a node at x_node,y_source to link to create a L shape, if so run conduits and goto 6a check to see if you can add a node at y_node,x_source to link to create a L shape the other way, if so connect and goto
An algorithm like this will do a 90% job of connecting things with minimal extra nodes compared to the optimal solution, and won't take long to implement. But it still allows substantial room for improvement:eg it would favor connecting cargo hatches with power along the hull, and powering them that way, and there will be a few corner cases where nodes are unable to be powered (specifically where there are multiple red excluded areas internal to the hull or places where you need a diagonal connection with 2 nodes ;eg corners of the arac )
It is sort of like the 'auto complete' for the ship rating; it'll save quite a bit of tedious time for a reasonable solution, and optimising the reasonable solution is more 'fun' than manually laying out the obvious stuff over and over.
|