Page 1 of 5

[MOD 0.18.x] Realistic Power

Posted: Thu Dec 29, 2016 5:41 pm
by Kenira
Type: Mod
Name: RealisticPower
Description: Revamps energy production and consumption to be more realistic (harder) and splits accumulators into two types: very high capacity with low power, and low capacity with high power. To be used with DayNightExtender for longer (4h - 24h) day / night cycles.
License: MIT
Version: 1.1.2
Latest release: 2020-04-30
Tested-With-Factorio-Version: 0.18

Mod Portal Link

Long description
Supported Mods
Real life data for solar and accumulator changes and details
Known Issues

Re: [MOD 0.14.x] Realistic Power

Posted: Mon Jan 30, 2017 7:34 am
by thereaverofdarkness
I've been playing with your mod and I like it!

I'm trying to revive Molay's Harder Energy mod, updating it for 0.14 (and later 0.15) along with some tidbits from my own crappy Capacitors and Batteries mod, both are from way back in 0.12. I borrowed a lot of code from your mod, and the result (so far) is much larger than Molay's mod yet much smaller than yours.

I've attached my work so far, and I wanted to know what you think of it. Also I came to ask for permission since I'm borrowing your code! (since I don't know how to write code) :lol:

It's listed as version 0.1.0 even though it's actually 0.0.1 but I just did it that way so I don't have to change it. I don't intend to publish it until 0.1.0.

Re: [MOD 0.14.x] Realistic Power

Posted: Mon Jan 30, 2017 10:36 pm
by Kenira
Thanks!

Sure, go ahead and use the code. I am not very well versed (read: not at all) in lua myself either, which is why that code for proportional capacitor drain you copied is also not written by me but some awesome person who saw it was on my to do list and happened to just have written a mod for that kind of thing themselves ;)

As for what i think about your work, the one issue i noticed so far is that you need to copy most of the control.lua (basically everything except for the bit at the top about configuring daynightextender), and the accumulator-drain item and entity files too for the drain to work properly. The accumulator-drain-1 and accumulator-drain-2 have different max drains (defined with the input_flow_limit) to allow different drains for capacitors vs batteries, if you want to set that up too. If not you can delete one of them. Which drain gets assigned to which accumulator type is defined in the control.lua, in the BuiltEntity function, which you'll have to set up for the names of your accumulators with the locals battery_accumulator and capacitor_accumulator near the top of the control.lua.

I hope that was clear enough, it's bed time for me now but if you have more questions i'd be glad to answer them tomorrow.

Re: [MOD 0.14.x] Realistic Power

Posted: Tue Jan 31, 2017 5:11 am
by thereaverofdarkness
Kenira wrote:the one issue i noticed so far is that you need to copy most of the control.lua -snip- and the accumulator-drain item and entity files too for the drain to work properly.
I actually cut out the drain entirely. :P

I wanted the mod to be as lightweight as possible. I was considering adding capacitors from my mod but then I decided I actually like making the capacitor accumulators cost only copper and steel. That way if you don't have oil, you can make capacitor accus on nothing but red and green science. People with a hefty resource flow are more likely to want to install a huge array of battery accumulators, while low-profile bases may be satisfied with a lower capacity and just use steam engines to supplement power at night.

I'm going to need to add some new code to adjust KS Power in ways your mod isn't doing it, but I think I can find the code from...places.

I put you in as an author as well as Maglay even though his mod was really small, because he gave me the idea and because I'm using his coal and solid fuel values.

I do have a question though. Could you see fit to add capacitors from my mod into realistic power? Functionally capacitors are a different kind of diode and are made with different materials. It makes more sense for them to be produced differently. I used Gimp to change a photo of a real circuit capacitor into an item icon, and I also adjusted the accumulator color slightly to make the high power one look different.

Re: [MOD 0.14.x] Realistic Power

Posted: Tue Jan 31, 2017 12:27 pm
by Kenira
I will probably keep the recipes for gameplay reasons. I am aware of how different capacitors actually are from batteries, but the capacitors in the game already need a lot fewer batteries, and you don't need many of them, only as buffers for lasers basically. It's a tiny fraction of the batteries you need for the battery capacitors so you won't really notice it, but i don't want to make them too trivial to make so that works out. Adding dedicated capacitor parts as an intermediate product to balance it with more basic materials could also work but so far i'd rather keep it simple.

I am also not going to include your capacitors. The values for both battery and capacitor accumulators in RealisticPower are based on their real life performance, which then also works nicely with 24h days.

Re: [MOD 0.14.x] Realistic Power

Posted: Tue Jan 31, 2017 4:39 pm
by thereaverofdarkness
That makes sense. Also it does seem a bit redundant to gain capacitors and batteries both from the same tech research and from the same oil product (petroleum gas).


I've been playing a game with Realistic Power and Day Night Extender, and I've been noticing that the night is maximum darkness for only a short time. I've got it set to run a cycle in about 1 hour, and I timed roughly 30 minutes full day to 5 minutes full night, with ~12.5 minutes each twilight--this is based on power output from solar panels, but the lighting would seem to agree with the figures. Have you noticed this, or is it the same in your game(s)?

Re: [MOD 0.14.x] Realistic Power

Posted: Tue Jan 31, 2017 5:10 pm
by Kenira
DayNightExtender does not change the ratio of day vs night time as it is in the base game, it just draws everything out. In vanilla complete night time is also a lot less than day time. Inlcuding twilight, in a 24h day the effective night time is only 7.2h.

Re: [MOD 0.14.x] Realistic Power

Posted: Wed Feb 01, 2017 3:16 am
by thereaverofdarkness
Well that's strange.

I need a way to change it into having half day and half night. Ideally I'd like shorter twilights, more like 45% day, 45% night, 5% sunrise, and 5% sunset. Do you know any way to do this by tweaking Day Night Extender? I'll ask in the Day Night Extender post as well. If you have any thoughts about it, you may respond to my post over there if it fits better there.

viewtopic.php?f=92&t=28822&p=240440#p240440

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Feb 09, 2017 3:40 pm
by Kenira
New version 0.0.4 with support for Yuoki mods is out.

Support for Angel's and Bob's mods is still planned, those are the last ones on my to do list for now. If you would like to see any other mods supported, please let me know and i'll consider adding them too.

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Feb 09, 2017 5:53 pm
by withers
When you add support for Bobs, maybe it would be more realistic to add bobs silicon wafers to the recipe for solar panels. This would push solar panels back a lot and force exclusive coal use longer and make the game even more harder. I'm considering tweaking my next game to do just that in my home brew mod and also,adding your mod to my list.

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Feb 09, 2017 7:40 pm
by Kenira
withers wrote:When you add support for Bobs, maybe it would be more realistic to add bobs silicon wafers to the recipe for solar panels. This would push solar panels back a lot and force exclusive coal use longer and make the game even more harder. I'm considering tweaking my next game to do just that in my home brew mod and also,adding your mod to my list.
That's an interesting idea, makes me want to play Bob's again. And i can always make that feature toggleable so i think i'll add it. Thanks for the suggestion :)

Re: [MOD 0.14.x] Realistic Power

Posted: Mon Mar 06, 2017 9:07 pm
by Kenira
Big update up. Added support for Bob's, Angel's and Flow Control and also overhauled most of the code, hopefully without introducing a lot of bugs. Can't really playtest all mods.
By default solar panels now all require wafers with Bob's mods but it can be toggled.

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Mar 30, 2017 5:58 pm
by SunTroll
When I try to run this mod with angelsbioprocessing_0.3.1 I get the following error:
failed to load mod "RealisticsPower 0.0.6"
_RealisticsPower_/data-final-fixes.lua:14:
_RealisticsPower_/functions.lua:24 bad argument #1 to 'match' (string expected got, got nil)

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Mar 30, 2017 6:56 pm
by Kenira
Fixed in the new version that i was working on anyway, and i hope by (again) overhauling the code to not be as hilariously bad and inefficient any more i didn't break a thousand other things.

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Mar 30, 2017 7:26 pm
by SunTroll
Fastest update I have ever seen.

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Mar 30, 2017 9:18 pm
by ZombieMooose
I have a suggestion. There used to be a mod (I don't remember the name of it) where different power poles transfered different amounts of electricity, e.g. wooden power poles the least, substations the most, etc

I don't know if this is within the scope of this mod, but it sure seems "realistic".

Re: [MOD 0.14.x] Realistic Power

Posted: Thu Mar 30, 2017 9:22 pm
by Kenira
It does and i like the idea, but it would impact the performance too much so i won't be adding it.

Re: [MOD 0.14.x] Realistic Power

Posted: Sat Apr 01, 2017 5:02 am
by ZombieMooose
Kenira wrote:It does and i like the idea, but it would impact the performance too much so i won't be adding it.
Fair enough. Maybe in 0.15 where optimization should be enough the performance won't be that bad?

Anyway cheers and thanks for the cool mod.

Re: [MOD 0.14.x] Realistic Power

Posted: Sat Apr 01, 2017 11:20 am
by Kenira
The performance boost in 0.15 won't have any effect on this afaik. They'd have to redesign how power grids work in order for this idea to not have a noticeable performance impact because as it is you'd just have to micromanage the power with scripts which is very inefficient. And i don't see the devs changing how power works just so some modders can implement some ideas better, so no, it probably won't ever happen, sadly.

Glad you like the mod!

Re: [MOD 0.14.x] Realistic Power

Posted: Mon Jun 26, 2017 2:19 pm
by SunTroll
Are you planning to update this mod for 0.15? (Are you waiting before all nuclear mods update?)