[MOD][WIP .15] High Voltage 0.0.7 : Energy over distance

Topics and discussion about specific mods
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

[MOD][WIP .15] High Voltage 0.0.7 : Energy over distance

Post by Jeroen D Stout »

Type: Mod
Name: High Voltage
Description: Manage local and distant power distribution networks
License: MIT
Version: 0.0.4
Release: 2017-05-06
Tested-With-Factorio-Version: 0.15.x
Website: Forum Thread
Download: https://mods.factorio.com/mods/JeroenDStout/highvoltage
Update History
Image

Manage your local network

Image

Manage your local network! Anything too far from a powerbox will refuse to work.
A small pole is less efficient than a medium one and will result in a smaller network!
You cannot connect multiple local networks directly, so plan ahead.

Power over distance

Image

You can connect two power boxes via the high voltage network: via a transformer and a series of large poles with red wire. You can only connect two transformers with one-another, so plan ahead.

Image

Transforming energy takes an efficiency penalty: one side has to produce more energy than the other can consume. Don't go wild with series of transformers! Distance is also a factor: at a large tile distance, efficiency can be as bad as 50%, meaning your very distant laser grid requires 200% of the regular energy to shoot. Either put down more power lines (even more expensive) or make your energy locally.

In the example above, the radar consumes a tidy 300kW, but the solar farm has to produce 316kW because of conversion cost. At a large distance, the farm would have to create 600kW or even more.

Note that you need red wire, which requires the circuit network research, and the big electric pole, which requires the Electric energy distribution. That means in the initial game you will have to power your smaller networks with individual steam turbines and only when have researched these elements connect them. Is that fun steampunk greatness or tedious madness? I don't quite know yet, I've only just made this.
Mini tutorial
Known issues

The game can crash at any time. I have no idea what performance will do if you build 1000 transformers. Here be dragons.

You cannot load this into an existing save. The mod currently has to add meta-data for every pole (&c) and this is not done automagically in existing saves.

Transformers technically can be placed anywhere, they will eventually be limited to near a power box.

There is no localisation yet, the items are all craftable with 1 coal 1 plate. I haven't really thought of balancing yet.

Development

Feel free to poke around in the lua. I used up a bundle of free time on this (and on the game) so my development will be a bit patchy. I hope this is a fun initial release!
Last edited by Jeroen D Stout on Mon May 22, 2017 3:59 pm, edited 12 times in total.
osldgoth
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Feb 26, 2015 3:52 am
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.1 : Energy distribution

Post by osldgoth »

Well it looks interesting, but has a few issues. first, in control.lua the filename on line 6("control.powerBox") doesn't match the file name in /control folder("pwerbox"); second, perhaps I did something wrong?, but every time I moused over a big electric pole the connection to the transformer was cut. third, while I haven't played around with it, how does this mod play with in game circuitry? not well I would guess - something to keep in mind. The indicators are cool though
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.1 : Energy distribution

Post by Jeroen D Stout »

Thanks for the try :D
osldgoth wrote:in control.lua the filename on line 6("control.powerBox") doesn't match the file name in /control folder("pwerbox")
It took me a while to realise but it seems it is not case sensitive where I am running it! So I didn't realise I had changed my mind on whether to capitalise 'box'. I'll update the download (though you seem to have already fixed it).
osldgoth wrote:perhaps I did something wrong?, but every time I moused over a big electric pole the connection to the transformer was cut.
It should only be possible to connect to a single transformer (vertical arrows) that is not already used. Could you post a screenshot of the situation in which you are doing this?
osldgoth wrote:While I haven't played around with it, how does this mod play with in game circuitry? not well I would guess - something to keep in mind. The indicators are cool though
You should still be able to use green circuits freely as they are ignored entirely, and within regular poles (not high voltage) red is also ignored. So it should work. The power switch is probably a problem I will need to solve because (I think) the switch is not exposed very well to the code.

Thanks for the feedback, this is super-alpha so it's all cobbled together :)
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.1 : Energy distribution

Post by Jeroen D Stout »

A little experiment...

Image

For version 0.0.2 I've been playing with the idea of punishing energy spikes. The high voltage network now has to 'spin up' a little bit, to deliver those extra MW, which takes some time. An outpost that costs almost no energy will also get almost no energy - if the lasers need to fire, that means back home the transformer has to start running at a quicker pace!

So in the scenario above, the biters completely tear through this defence, as the lasers get few shots off and get obliterated before the transformer back home is ready. But if you place a few accumulators they store enough energy to help the lasers fire full blast until the transformer gets spun up enough to provide the laser network with full energy.

Plopping down a ton of radars at an outpost leads to this production curve:

Image

On top of this, I am looking for a maximum throughput of the network meaning that at about 2MW you have maxed out the high voltage line. If that much MW is actually used continuously you will have to put in a second line, or perhaps start building some energy production in the outpost itself! (I.e., fill a train with steam, making supplying more challenging.)

Image

In this situation, there is 4.6MW available because of the double power line connection. Not quite sure how well stacking and such works (energy buffers are a bit iffy to program around) but you should be able to dual-line your outposts or make a high speed network that provides emergency energy.
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.1 : Energy distribution

Post by Jeroen D Stout »

Some more development!

Image

Poles can now properly be put side-by-side, so you can increase throughput by doubling.

Image

This little outpost gets by on 1.7MW (80% efficiency at 382 units) with its accumulators. The accumulators draw the max from the transformer (which goes to top level) after which they buffer the laser shots. As they deplete the transformer kicks back in to recharge them. Without the accumulators the lasers draw too little continuous power to keep the transformers active enough to allow sporadic laser shots.
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.1 : Energy over distance

Post by Jeroen D Stout »

More updates, making this version 0.0.2!

I solved a major problem to do with flow; when a transformer now sends its energy over it disables the other's energy collection. This means electricity cannot be sent over, collected and sent back repeatedly (which was a big problem).

Image

Image

And while I was in the code I added these spiffy arrows so you can see which of your networks are sending or receiving energy. It is based on the 'buffer' size, i.e., how much a transformer is borrowing from the network in anticipation of sending it over. Three arrows means it is as good as maxed out.
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by Jeroen D Stout »

Small updates bringing it to 0.0.3:

There is now some localisation!

A power box costs 5 iron plates, 5 electronic circuits.
A transformer costs 5 iron plates, 10 electronic circuits and 15 copper cable.
Both are available from the start (for now) until I figure out tech trees.

A small bug fix: I made the mistake of always assuming a player 1; I now go over all existing players to see what they are doing. Now all existing players can view the network in multiplayer and all their actions should update correctly. Interestingly if one player hovers over a network all players see the lines. That is not entirely intentional but really part of me hacking things together.

I will do a few multiplayer sessions to try out this new gameplay mechanic. It is looking nice, though, I enjoy the feeling of frontier outposts being more frontier; harder to defend, needing more local power generation. It's also really interesting to have to optimally build grids to fit next to power boxes, preventing the rather default approach of just having a giant array.

In short, it's interesting to have a mod that creates problems I am not entirely sure how to solve optimally.
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 106
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by db48x »

This is indeed an interesting mod.

One odd thing about it is that the location of the "power box" (needs a better name) doesn't have to be anywhere near the power source. In fact, you can have power consumers in between the power source and the distribution box, on the same wiring!

An example:

Image

On the other hand, we had fun building this:

Image
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by Jeroen D Stout »

Oh, that is very nice to see! The multiple power lines running out of an energy centre is exactly what I was thinking of, making this. Did you find this adds something interesting to the gameplay?

When I played earlier I did find I made many more steam engines at the start, pipes being a cheap way of making electricity locally.
db48x wrote:One odd thing about it is that the location of the "power box" (needs a better name) doesn't have to be anywhere near the power source. In fact, you can have power consumers in between the power source and the distribution box, on the same wiring!
Yes - it happens that the game does not really allow me to separate that. I could have electricity creating machines disable if not near a power box (which indeed should have a different name) but that seems like a lot of administrative stuff. The power box is perhaps more of a managing unit that helps with the (hypothetical) fluctuations, distributes, rather than what routes the power directly.
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 106
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by db48x »

Jeroen D Stout wrote:Oh, that is very nice to see! The multiple power lines running out of an energy centre is exactly what I was thinking of, making this. Did you find this adds something interesting to the gameplay?
Possibly. It remains to be seen whether this is too many steam engines for the 8 things we're hooking it up to, or not enough.
Jeroen D Stout wrote: When I played earlier I did find I made many more steam engines at the start, pipes being a cheap way of making electricity locally.
Yes, same here. We ended up with three or four locations with one or two steam engines each, strung out along our belt full of coal. Kinda odd, but steam engines are already kinda odd.
Jeroen D Stout wrote: Yes - it happens that the game does not really allow me to separate that. I could have electricity creating machines disable if not near a power box (which indeed should have a different name) but that seems like a lot of administrative stuff. The power box is perhaps more of a managing unit that helps with the (hypothetical) fluctuations, distributes, rather than what routes the power directly.
Indeed, I can see how the existing mechanics would limit you here. It's already pretty impressive! I think what's most weird about this situation is that if the "power box" is a control unit for the power producers (perfectly reasonable), then it's odd that all of the consumers must be within 30 tiles distance from the box, rather than the producers. They can end up being 60 tiles from the actual producers, or in between the producers and the box.

Incidentally, we just got an error in our game! It was just a minute or two after we started back up:

Error while running event highvoltage::on_tick (ID 0)
__highvoltage__/control/highVoltage.lua:258: attempt to index field '?' (a nil value)

It seems to have happened exactly as I control-clicked on a wooden box in order to take everything in it, but my friend was actually messing with some red wires. I believe he was moving a transformer.
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by Jeroen D Stout »

Well, there's a limit of how much red wire can convey, but I'll admit I do not have the figures all thought-out. I'm guessing you might have more MW than the system could pipe, but it will be interesting to see!
db48x wrote:Yes, same here. We ended up with three or four locations with one or two steam engines each, strung out along our belt full of coal. Kinda odd, but steam engines are already kinda odd.
Ha! I put my boilers in one place, then pipes the steam. I was wondering how long until I would run out of steam pressure that way, I never had really used fluids over distance this much.
db48x wrote:Indeed, I can see how the existing mechanics would limit you here. It's already pretty impressive! I think what's most weird about this situation is that if the "power box" is a control unit for the power producers (perfectly reasonable), then it's odd that all of the consumers must be within 30 tiles distance from the box, rather than the producers. They can end up being 60 tiles from the actual producers, or in between the producers and the box.
Thank you! The initial idea was really that the wires are not conducting that well, so the box distance is really a stand-in for cable inefficiency energy fall-off. I cannot really think of any reasonable way to make this work more properly, especially if the player can have multiple steam engines (so I cannot check if a grid is 'valid'); and of course you want accumulators to work properly without having to be near the power box.
db48x wrote:Error while running event highvoltage::on_tick (ID 0)
__highvoltage__/control/highVoltage.lua:258: attempt to index field '?' (a nil value)

It seems to have happened exactly as I control-clicked on a wooden box in order to take everything in it, but my friend was actually messing with some red wires. I believe he was moving a transformer.
Ah, that actually is a transformer error, not a box error. I'll have to look into this.

Thank you for all the feedback and the bug report - I look forward to seeing some more screenshots, if you have any :)
osldgoth
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Feb 26, 2015 3:52 am
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by osldgoth »

Jeroen D Stout wrote:
Ah, that actually is a transformer error, not a box error. I'll have to look into this.

Thank you for all the feedback and the bug report - I look forward to seeing some more screenshots, if you have any :)
shift clicked on a big electric pole, to remove the red wire, then mined the transformer > crash
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by Jeroen D Stout »

Cheers - I can see how that crashed it. I will have to upload an update when I get the chance, probably tomorrow.

I think what happened is, (technical stuff:) the transformers cannot be directly followed by the mod because the engine does not expose the wire info for accumulators (which is that transformers technically are). So I have to hack info on connections. It looks like what you did disconnected only the pole but left the transformer thinking it was still connected; then when the transformer is mined it tells the pole to disconnect again, which of course cannot happen.
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 106
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by db48x »

Jeroen D Stout wrote:
db48x wrote:Indeed, I can see how the existing mechanics would limit you here. It's already pretty impressive! I think what's most weird about this situation is that if the "power box" is a control unit for the power producers (perfectly reasonable), then it's odd that all of the consumers must be within 30 tiles distance from the box, rather than the producers. They can end up being 60 tiles from the actual producers, or in between the producers and the box.
Thank you! The initial idea was really that the wires are not conducting that well, so the box distance is really a stand-in for cable inefficiency energy fall-off. I cannot really think of any reasonable way to make this work more properly, especially if the player can have multiple steam engines (so I cannot check if a grid is 'valid'); and of course you want accumulators to work properly without having to be near the power box.
It does become complicated. Maybe consumers are valid when they're within 30 tiles of any producer, but they have to take a path through the power box? Unfortunately that gives a different source _and_ destination for each path, and I have no idea how you would determine which local network a new pole goes in to. (Which is a really nice feature, btw.)

Another screenshot:

Image

Ironically this is exactly the size I generally build in a vanilla game, with exactly the same arrangement of poles. The spacing is a little different, and the belts got messy so we rebuilt them, but otherwise not many changes. You can also see that we moved the power generation closer, to reduce transmission losses. We're also planning more power half way down the line because we're running out of connections, but that's on hold. When we first built this I used two power connections for four smelter lines, not remembering that they could be 30 tiles from the center to the corners. On the other hand, I'm pretty sure that one line can't power this many electric furnaces, so...

Quite a fun mod!
bbgun06
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Fri Mar 27, 2015 4:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by bbgun06 »

We're having lots of fun with this! I always have to think about the power grid before I place something, unlike in vanilla. Also I don't think solar panels will be used in the normal way. The factory looks very different with the power grid overlay.
Image
Now I wish there was a circuit network overlay.

Also, I think I found another bug. One of our grids seemed to be broken on one side:
Image
Turns out that it wasn't connected to anything, but I removed and replaced both the power box and transformer and it still looked like that.
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by Jeroen D Stout »

That is absolutely fantastic to see! Your base is so much more organised than my own base, it's great to see this mod used at such a scale.
This mod does seem to give the "many little grids" look to bases! I'll like to see the continuation of this.

Really glad you are enjoying it, having to think about energy placement was absolutely the goal and from the looks of it you are making lots of little squares of energy support.

I've started a game (with some more mod tinkering) and I'll post some screenshots when I can. I am trying mining at a distance (RSO) now, which puts the nearest iron ore at 70% efficiency. Enough for the mines, but expensive to run.

The bug - could you post the save file? As a fix, removing the transformer on both ends and replacing them should. Probably the receiving transformer got confused somehow.
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.4 : Energy over distance

Post by Jeroen D Stout »

Version 0.0.4
  • Fixed a bug where a transformer could have no pole, yet try to disconnect from it, causing a crash
  • Fixed a bug where a transformer connection could be disrupted without the transformers being separated (spooky action at a distance!)
Jeroen D Stout
Inserter
Inserter
Posts: 33
Joined: Fri May 05, 2017 2:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.4 : Energy over distance

Post by Jeroen D Stout »

Image

Image

My base isn't as tidy as bbgun06's, but it is forming the nice little 'islands of electricity' feel. I have a mod that increases pollution / slows mining, so it's giving the 'desperate adventure' feel at the same time.
bbgun06
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Fri Mar 27, 2015 4:09 pm
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.3 : Energy over distance

Post by bbgun06 »

Here is the save. Note that this wasn't actually connected to the power station, although it acted like it was on one side.
Attachments
POWER BUG.zip
(8.16 MiB) Downloaded 149 times
Dreadicon
Inserter
Inserter
Posts: 38
Joined: Sun Jun 22, 2014 9:06 am
Contact:

Re: [MOD][WIP .15] High Voltage 0.0.4 : Energy over distance

Post by Dreadicon »

This mod looks FANTASTIC! I wanted to do something like this myself, but never could figure out how to do it in an adequately performant manner with the current API. Next game I'll add this (because I like to make my life hell what with Angel's + Bob's + Platforms + Rampant AI + RSO with distance cranked up to 11). I'm already considering shipping power between 'safe' regions using tanker cars filled with steam ;) So this will add an interesting layer on top of that.
Post Reply

Return to “Mods”