Network Mask for Electric Poles

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Adamo
Filter Inserter
Filter Inserter
Posts: 479
Joined: Sat May 24, 2014 7:00 am
Contact:

Network Mask for Electric Poles

Post by Adamo »

TL;DR
A "network-mask" value on the electric pole prototype that masks the auto-wire feature when placing poles in range of each other, or something similar, to allow creating pole entities that automatically enable overlapping electrical networks.

What ?
The technical aspect is explained in the TL;DR. The first thing I would do is create something in a mod, probably called a "Transmission Pole", that has a separate mask from all the other poles, and a "Service Pole" that connects to both masks (thus providing the interface between the transmission and service networks).
Why ?
There's a lot of sense to using an integrated feature like this when creating overlapping electrical networks, because we want to take advantage of all of the convenience functions that are built into placing electric poles -- running with the mouse button held down, or resetting lines by removing and replacing a pole, etc. -- and there are definite uses for connecting regions with a separate network that go through some other region that you don't necessarily want to be connected. Generally people agree the electrical system could use a little flavor, and this might be an easy addition that I know I would take advantage of in a mod immediately. It would also help to preserve overlapping networks when using blueprints.

Cheers!

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Network Mask for Electric Poles

Post by Mylon »

This should be possible with a mod. Using scripts when entities are built, connections between incompatible entities can be removed, or connections between compatible entities created.

Adamo
Filter Inserter
Filter Inserter
Posts: 479
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: Network Mask for Electric Poles

Post by Adamo »

Mylon wrote:
Sat Jul 18, 2020 5:24 pm
This should be possible with a mod. Using scripts when entities are built, connections between incompatible entities can be removed, or connections between compatible entities created.
It is possible to make a hack to do this using a script, yes. Scripts are inherently unstable and thus are not the ideal way to create basic functionality to build upon in other scripts or functions. What I'm suggesting here is a mask in the prototype itself, which likely couldn't be set while the game is active (Although, that could be useful!), but could be used by mods to define networks, on top of which authors could build scripts as they are so inspired.

For example, a mod author may want to decide that a certain type of electrical prototype doesn't interact with any others -- thus, they set a unique mask in their prototype. They don't have to write a script to do so. But if they want to take advantage of the network masks in some script, to determine the "type" of electric pole, well hey, that could be done too by the more-advanced modder.

Another example is that someone wants to make a script (With some unique prototypes to go with it.) that automatically wires red and green wires between this set of poles. They could define the network mask table in the prototype to both connect to the vanilla network, and to a unique identifier they made up in their mod. The script could then simply check the mask to see if that identifier exists, and automatically wire up green and red wires if the connection is in range, or according to whatever criteria they want. This could currently be done by matching the names of the poles in your script, but by using a mask, other modders could expand on the pole set by simply creating new prototypes.

There are a bunch of possibilities that open up with the use of a network mask. It's a simple tool that gives modders something to play with; something to use to make the electrical system a bit more robust.

The way I imagine it, the mask only determines auto-connects in terms of how the game core is affected, and thus you could still manually wire two towers with different network masks. But there are other possible ways to do it.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Network Mask for Electric Poles

Post by ssilk »

Do you mean with “mask” a bitmask, where if two poles have the same bits set a connection is allowed? I think that’s over engineered. A number (= color) would be enough. Only poles of the same color can connect.

In practice this would look like so, that you place poles and then have a tool to give the pole one of three colors: red, blue and neutral (the default). Maybe a fourth color is needed, but more makes no sense (my opinion). A mod can just add a new color. And the way to connect two colors would be to use a power-switch.

See also this
viewtopic.php?f=6&t=70996 Control Power Connections by Coloring Power Poles (with Lamps)

That idea with the lamps there is stupid, yes. ;)

(It is difficult to implement this by a mod, mainly because placing a power pole would mean to check any pole in range, which is time consuming, especially when we talk about mods that implement poles with extreme ranges.)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Adamo
Filter Inserter
Filter Inserter
Posts: 479
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: Network Mask for Electric Poles

Post by Adamo »

ssilk wrote:
Sun Jul 19, 2020 8:46 am
Do you mean with “mask” a bitmask, where if two poles have the same bits set a connection is allowed? I think that’s over engineered. A number (= color) would be enough. Only poles of the same color can connect.

In practice this would look like so, that you place poles and then have a tool to give the pole one of three colors: red, blue and neutral (the default). Maybe a fourth color is needed, but more makes no sense (my opinion). A mod can just add a new color. And the way to connect two colors would be to use a power-switch.

See also this
viewtopic.php?f=6&t=70996 Control Power Connections by Coloring Power Poles (with Lamps)

That idea with the lamps there is stupid, yes. ;)

(It is difficult to implement this by a mod, mainly because placing a power pole would mean to check any pole in range, which is time consuming, especially when we talk about mods that implement poles with extreme ranges.)
Yeah, there we go. I meant mask in a very general way, as in, just checking whether prototypes have the same mask in both of their network mask tables; I didn't mean to imply a specific implementation, like implementing it as a bitmask. I'm not married to any particular method. I wasn't even necessarily saying to prevent players from making connections on their own, but just to "mask" the auto-wiring of newly-placed electric poles to prevent networks from connecting unless the player explicitly does so. A color could work, sure. I was thinking about how the collision_mask works; from our perspective it's a string, but I assume based on what you are saying, and since there are only specific strings allowed, these actually correspond to a 4-bit int. Well, whatever method gets us there, really. "Color" could work fine. Since the electrical system is a network, I liked the idea of naming it something that has to do with the network -- "network mask" was the example here -- but it could be also "network ID", "network color", whatever. I defer to the developers to know what would be the way to add something with the least amount of overhead. I don't know what the code looks like, so thinking about it like a simple mask layer that could be inserted at a single step in the wire-after-pole-is-placed method (whatever you call it) seemed like the best bet for a small impact. I'm definitely not suggesting it be implemented precisely like the collision mask: I think it's a good idea to let modders add their own colors/masks/labels/whatever-it-will-be-called.

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Network Mask for Electric Poles

Post by Mylon »

Adamo wrote:
Sun Jul 19, 2020 2:45 am
automatically wire up green and red wires if the connection is in range, or according to whatever criteria they want. This could currently be done by matching the names of the poles in your script,
Could do this via a toggle accessible via a mod ui. Toggle the flag and any Electric Poles will automatically connect to other Electric Poles within connection range.

Post Reply

Return to “Ideas and Suggestions”