Page 1 of 5

[MOD 0.12.x] Force Fields - energy powered walls

Posted: Sun Nov 23, 2014 11:40 pm
by Rseding91
This is a mod I've wanted to make for a while. I love over-building and there isn't much in Factorio to dump tons of excess energy into. Force Fields aims to change that. Make no mistakes, the force fields are powerful but power hungry - don't let them run out of energy or it all comes crumbling down :)

As always, if you have any comments or find any bugs with it just let me know.
Examples
Demonstration:
https://www.youtube.com/watch?v=eKIDcRkIlG0


Features
  • Different types of energy powered walls
  • The fields will auto-heal if there's energy to do so
  • If the emitter runs out of energy to do needed work all of the fields for that emitter collapse
  • Different types of fields (unlocked with research) have different effects/tradeoffs
  • [ b ]lue: normal health, normal re-spawn, normal power usage
  • [ G ]reen: higher health, very slow re-spawn, below-normal power usage
  • [ R ]ed: normal health, slow re-spawn, very high power usage. Damages living things that directly attack them
  • [ P ]urple: low health, very slow re-spawn, high power usage. On death, heavily damages living things near-by
  • Use the Forcefield Tool on an emitter to open the menu for it
  • Heavily optimized - you can go crazy with the force fields and they shouldn't impact your game's performance much/at all
Changelog

Code: Select all

1.0.6: fixed script error related to failing to build fields.
1.0.5: fixed script errors related to death of purple fields and spawning new fields. Re-implemented purple field damage on death and tree-removal when can't build fields.
1.0.4: fixed script error with localized entity name
1.0.3: updated for Factorio 0.12.11
1.0.2: updated for 0.12 + a major refactor and cleanup of the code
1.0.1: fixed errors when removing upgrades and fixed not getting the right upgrades back when mining emitters
1.0.0: initial release
Downloads
Current version: 1.0.6

Download [0.12]
Force Fields_1.0.6.zip
(224.36 KiB) Downloaded 1648 times

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Mon Nov 24, 2014 12:41 am
by Kiapha
I recall another mod very similar to this one before. Something it had that this seems to lack according to the picture is that you could create walls thicker than just one. Would it be possible for you to add a thickness setting as well? That would make it much more useful, in my opinion.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Mon Nov 24, 2014 1:13 am
by n9103
How would that be more useful?
The only reason it's useful now is to increase the amount of damage that your walls can absorb.
These walls don't seem to have a practical limit to damage they can absorb, since it looked like 3 big biters attacking one wall couldn't keep it from fully healing.
This is definitely going on my watch list for a future modded long-game.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Mon Nov 24, 2014 1:58 am
by Rseding91
Kiapha wrote:I recall another mod very similar to this one before. Something it had that this seems to lack according to the picture is that you could create walls thicker than just one. Would it be possible for you to add a thickness setting as well? That would make it much more useful, in my opinion.
You can just build a second or third emitter (or how ever many you want) behind the previous one to give them a larger thickness. But, it shouldn't be required unless you've got some crazy biters.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Mon Nov 24, 2014 2:09 am
by Kiapha
What I like to do is I build a line of power from my base forward and set up a shielded outpost, set three sides to one-thick with two parallel walls having 'prongs' of wall 5+ outside the fourth wall acting sort of as a funnel. Set the wall between those to three thick, then as you kill things trapped inside it fills up and you can move it forward safely without the risk of anything slipping through while it moves because it has several layers. I am just lazy and don't want to mess with several FF generators to do it, though you are correct that I could get the same effect with multiple.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Mon Nov 24, 2014 2:19 pm
by n9103
I love that these things suck down energy like they do.
Finally gives a point to the ridiculous power plants I always set up, and justifies not going pure solar, since the volume you've got to encompass to break even on solar is gigantic. ;)

Also gives a great reason for people to pick up the Smart Circuits/Smart Power mod as well. :)

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Wed Nov 26, 2014 8:35 am
by Rseding91
I spent some time tonight watching someone use Force Fields with Dytech and it's not that balanced when they're combined (dytech biters just erase the forcefields :D )

If anyone has any balance questions/comments I'm open to changes. Most of what is now was just my internal testing against base game biters.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Wed Nov 26, 2014 9:10 am
by n9103
As with anything else stock, it was made for a completely different game.
The loading script could insist on setting itself behind the optional dytech mods, which would give you a few parameters on startup to see if you should be using DyTech level walls, or Vanilla.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Thu Nov 27, 2014 10:12 am
by vedrit
Pretty cool mod. I'm going to plug it in and see how I like it

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Thu Nov 27, 2014 10:19 am
by Rseding91
n9103 wrote:As with anything else stock, it was made for a completely different game.
The loading script could insist on setting itself behind the optional dytech mods, which would give you a few parameters on startup to see if you should be using DyTech level walls, or Vanilla.
That was my idea as well. Everything except the wall's max health and the amount of damage they do when attacked is done runtime so they won't be hard to adjust. The health part should be easy to fix as well.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Thu Nov 27, 2014 11:49 am
by vedrit
One issue I ran into is when I drove into the wall (set as blue at the time) with a tank from Tankwerkz (Hydra) (not sure if it's a compatibility issue) it caused the game to force-close. I'll grab a log next time

Also, can we get an on/off switch in the emitter UI and for it to be off by default? That would allow players to place the emitter and modify it before it places a massive drain on the power network

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Thu Dec 04, 2014 11:07 pm
by Fatmice
Why do emitters pulse the electrical grid when generating the force walls? I've got a 120 MW test grid with 5GJ of storage and there are many spikes in the electric demand graph when I connect an emitter to the test grid. Since emitters eat at a max of 100 MW, the 120 MW grid should be able to provide all the power needed to charge both the emitters and create the wall sections.

How much power is needed to generate each wall section?

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Thu Dec 04, 2014 11:41 pm
by Rseding91
Fatmice wrote:Why do emitters pulse the electrical grid when generating the force walls? I've got a 120 MW test grid with 5GJ of storage and there are many spikes in the electric demand graph when I connect an emitter to the test grid. Since emitters eat at a max of 100 MW, the 120 MW grid should be able to provide all the power needed to charge both the emitters and create the wall sections.

How much power is needed to generate each wall section?

You can look at the control.lua file and see the comments near the top that explain power usage.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Thu Dec 04, 2014 11:42 pm
by Rseding91
vedrit wrote:One issue I ran into is when I drove into the wall (set as blue at the time) with a tank from Tankwerkz (Hydra) (not sure if it's a compatibility issue) it caused the game to force-close. I'll grab a log next time

Also, can we get an on/off switch in the emitter UI and for it to be off by default? That would allow players to place the emitter and modify it before it places a massive drain on the power network

Not a bad idea with the on-off option. I could make it a setting with the tool per-player.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Fri Dec 05, 2014 4:25 am
by Fatmice
Rseding91 wrote: You can look at the control.lua file and see the comments near the top that explain power usage.
Okay, I took a look. The variable definitions are a bit confusing. It still does not explain why there are energy spikes during wall section generation. The emitter has an internal reserve that requests energy at a constant rate (100 MW) until it is full. There were no spikes during this phase.

You are using a tick rate of 20, but the game run at a tick rate of 60 so, you walls tick at 3x a second?

I'm was testing red walls set at a length of 65 sections. According to the comments in control.lua, it should be using 200KJ (20*10000 J, which I am assuming you are using J here and not KJ) per generation per section, so all 65 sections will take 13 MJ per generation. Now does it generate all section at once or one at a time? It seems to do the former. The rate of generation is also not clear. I'm going to assume that it will do 3 generations per second so 13 MJ/(1/3) => 39 MJ/s => 39 MW. Since there are 65 sections at 300 HP each, it charges 3.5 HP per generation so 300/3.5*13MJ = 1114 MJ; this means it takes 28.6s to do the initial charge of 65 wall sections. Is this why it pulses? I see spikes of energy usage during wall generation. Isn't there anyway you could smooth out the energy request? Maybe have it use the internal reserves during wall generation then request more energy to fill itself up? Maybe my math is wrong?

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Fri Dec 05, 2014 6:01 am
by Rseding91
Fatmice wrote:
Rseding91 wrote: You can look at the control.lua file and see the comments near the top that explain power usage.
Okay, I took a look. The variable definitions are a bit confusing. It still does not explain why there are energy spikes during wall section generation. The emitter has an internal reserve that requests energy at a constant rate (100 MW) until it is full. There were no spikes during this phase.

You are using a tick rate of 20, but the game run at a tick rate of 60 so, you walls tick at 3x a second?

I'm was testing red walls set at a length of 65 sections. According to the comments in control.lua, it should be using 200KJ (20*10000 J, which I am assuming you are using J here and not KJ) per generation per section, so all 65 sections will take 13 MJ per generation. Now does it generate all section at once or one at a time? It seems to do the former. The rate of generation is also not clear. I'm going to assume that it will do 3 generations per second so 13 MJ/(1/3) => 39 MJ/s => 39 MW. Since there are 65 sections at 300 HP each, it charges 3.5 HP per generation so 300/3.5*13MJ = 1114 MJ; this means it takes 28.6s to do the initial charge of 65 wall sections. Is this why it pulses? I see spikes of energy usage during wall generation. Isn't there anyway you could smooth out the energy request? Maybe have it use the internal reserves during wall generation then request more energy to fill itself up? Maybe my math is wrong?
That math sounds right. It does use the internal buffer during generation. The game its self re-fills the buffer every game tick (using the game-built energy net system). Because the fields run once every 20 ticks you see the pulses from it using energy every 20th tick and the game re-charging the emitter back to full. There's no good way to make it a smooth amount without running every tick and that would destroy your game's performance.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Fri Dec 05, 2014 6:15 am
by Fatmice
Rseding91 wrote: That math sounds right. It does use the internal buffer during generation. The game its self re-fills the buffer every game tick (using the game-built energy net system). Because the fields run once every 20 ticks you see the pulses from it using energy every 20th tick and the game re-charging the emitter back to full. There's no good way to make it a smooth amount without running every tick and that would destroy your game's performance.
Okay, I see, but then why does the emitter not pulse the energy network when it is charging its buffer? Is it acting like an accumulator then? Are you having it run every tick during that phase? I just want to understand what is going on.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Fri Dec 05, 2014 8:08 am
by Rseding91
Fatmice wrote:
Rseding91 wrote: That math sounds right. It does use the internal buffer during generation. The game its self re-fills the buffer every game tick (using the game-built energy net system). Because the fields run once every 20 ticks you see the pulses from it using energy every 20th tick and the game re-charging the emitter back to full. There's no good way to make it a smooth amount without running every tick and that would destroy your game's performance.
Okay, I see, but then why does the emitter not pulse the energy network when it is charging its buffer? Is it acting like an accumulator then? Are you having it run every tick during that phase? I just want to understand what is going on.
When it's charging it is already drawing at the maximum rate. Once it's fully charged it draws at the idle rate until it ticks and uses some of the energy at which point it charges at the maximum rate until it's full.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Fri Dec 05, 2014 8:33 pm
by Fatmice
Rseding91 wrote: When it's charging it is already drawing at the maximum rate. Once it's fully charged it draws at the idle rate until it ticks and uses some of the energy at which point it charges at the maximum rate until it's full.
Thanks for your response. I see now this is why it pulses during wall generation. May I suggest an alternative charging scheme that would minimize the pulsing.

1/ When emitter is placed, charge emitter reserve at maximum power draw until full.
2/ Once reserve is full, only use reserve to generate walls and not request further energy from the grid until the reserve is empty.
3/ When reserve is empty, stop all wall generation and request more power until full then go back to (2).

Power request is therefore limited to when reserve is completely empty. This has the added effect that if you can not sustain 100 MW draw then you will be in trouble and wall generation will only start/restart when the reserve is topped off. This means the emitter will not even tick unless the reserve was marked as being topped off.

Re: [MOD 0.11.x] Force Fields - energy powered walls

Posted: Fri Dec 05, 2014 8:49 pm
by Rseding91
Fatmice wrote:1/ When emitter is placed, charge emitter reserve at maximum power draw until full.
2/ Once reserve is full, only use reserve to generate walls and not request further energy from the grid until the reserve is empty.
3/ When reserve is empty, stop all wall generation and request more power until full then go back to (2).

Power request is therefore limited to when reserve is completely empty. This has the added effect that if you can not sustain 100 MW draw then you will be in trouble and wall generation will only start/restart when the reserve is topped off. This means the emitter will not even tick unless the reserve was marked as being topped off.

The recharging of the emitter is done by the hard-coded game logic - it's not something I can toggle on and off.