Cursed Questions

Topics and discussion about specific mods
buc01
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Jun 14, 2015 9:20 am
Contact:

Re: Cursed Questions

Post by buc01 »

Could anyone explain to me what the class you select at the start of the game does exactly? i chose miner and i cant figure out if it has given me something special or a new ability or something :S

varn
Inserter
Inserter
Posts: 23
Joined: Sat Jun 06, 2015 1:11 am
Contact:

Re: Cursed Questions

Post by varn »

buc01 wrote:Could anyone explain to me what the class you select at the start of the game does exactly? i chose miner and i cant figure out if it has given me something special or a new ability or something :S
It gives you x2 xp in the according skill, mining for you. I chose crafter, but explorer sounds great too, mining is not worth IMO, because once you get the cursed tool to high levels you can grind it faster than any other skill

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

Tim2162286 wrote: *Edit I found your post where you explained the generators function, it just runs off the extra bodies.
That is correct however in this version of mod the generator is a bit weak. 1st body will generate about 25kW. It is not linear so each body added will generate a bit more but still IMO it's not worth it (at least in this version).
That said, he already stated that generator in new ver is buffed. For now it's roughly x 1.5 but who knows.. maybe it will be even more.

Tim2162286
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Jun 15, 2015 2:34 am
Contact:

Re: Cursed Questions

Post by Tim2162286 »

Qcor wrote:
Tim2162286 wrote: *Edit I found your post where you explained the generators function, it just runs off the extra bodies.
That is correct however in this version of mod the generator is a bit weak. 1st body will generate about 25kW. It is not linear so each body added will generate a bit more but still IMO it's not worth it (at least in this version).
That said, he already stated that generator in new ver is buffed. For now it's roughly x 1.5 but who knows.. maybe it will be even more.
Not only is it weak until you compleatly fill it (very expensive), it does not seem to reliably work for me.

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

now that you mentioned it I took a closer look and it appears that you're right.
It generates HALF of what it supposed to generate according to the formula. To be more precise it operates at full capacity but only half of the time... as in it goes for like 3sec then it's idle for next 3sec etc etc
Strange..
Last edited by Qcor on Mon Jun 15, 2015 9:57 pm, edited 1 time in total.

Tim2162286
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Jun 15, 2015 2:34 am
Contact:

Re: Cursed Questions

Post by Tim2162286 »

I can get the generator to run continuously, but only at about 1/5 power if i connect it to my main power system, and only if i have more energy production than consumption.
I don't know why it does that, i have used other mods that also use the accumulator entity type as a generator and they work perfectly.

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

yeah.. it's broken for sure.
I think I localized the cause.. trying to fix it now. If I succeed I'll post the code you need to replace.
Not sure how it will go... 0 experience in this strange lua stuff :(

Tim2162286
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Jun 15, 2015 2:34 am
Contact:

Re: Cursed Questions

Post by Tim2162286 »

thanks, i have some programing experience, so if you tell me where you think the problem is i can try and look at it as well.

Tim2162286
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Jun 15, 2015 2:34 am
Contact:

Re: Cursed Questions

Post by Tim2162286 »

Definitly found the issue, it is in lines 34-35, commenting them out gives constant output, but doesn't increase like it should when the generator levels, will works some more on it.

Code: Select all

local output_flow_limit = math.floor(0.1 * (i - 1)^2 + (i - 1) * 25 + 25)
	if  i == datos.maxgenerator then
		output_flow_limit = math.floor(0.25 * (i - 1)^2 + (i - 1) * 25 + 25)
	end
	--generator.energy_source.output_flow_limit = output_flow_limit .. "kW"
	--generator.energy_source.buffer_capacity = output_flow_limit * 60 * 5 .. "kW"
using this code causes the generator to output a constant 300 kw regardless of generator level (this is lines 30-35)

*Edit- after more testing, the issue appears to be that the generator only outputs at its maximum, but is limited to generating about 260 kW. the reason it doesn't work continuously is that it fills its buffer up, then compleatly discharges it at its output rate. not sure how to modify that maximum charge rate though.

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

well.. yes and no
Yes, this is a PART of a problem.. and NO, it's not the solution.

The problem is that generator has an internal buffer. Every 300 ticks it is filled. To be precise it's energy is being set to a specific number.
All would be cool but this number is too small to keep it running for whole 300 ticks.
If that was all then the fix would be rly easy.

For last 3 hours I was experimenting with this and it just blows my mind... Basically I changed it so that:
1) the buffer is of size X
2) each tick the buffer energy is set to X
3) buffer can be emptied at a max rate of X/tick

And that still causes some strange fluctuations.. WHY ?? because.. logic.. :( No idea how sth so straight forward could fail but well.. I started to learn about it 3h ago so maybe I'm just a noob.

Anyway.. I changed it again and it mostly works. It's power output is as should be and it's constant. Only downside is that one of power production meters shows good value and the other shows bad one.
Example: my generator is lvl 19 so it, in theory, generates max of 507KW. The power meter in top left shows 507.. and the second one shows 580 :shock:
top one is right, and the other shows more because I made the buffer twice the size and set the buffer energy to 2*X instead of X. It rly shouldn't matter because max output was and still is = 507.. so rly no idea.. some strange logic.

Just replace files attached and all should work properly...
ontick.lua
(30.09 KiB) Downloaded 438 times
cursed-generator.lua
(62.61 KiB) Downloaded 442 times

[edit]
It LOOKS like the top indicator shows how much energy was actually provided to the network while the second one shows how much was "added"/produced inside all generators... am I right ?
It just boggles my mind... some1 pls explain that to me:
So lets say I have a generator producing 50/tick with a buffer of 100 and max output of 50/tick. Each tick I set the power in the buffer to 100.
First indicator shows 50 which seems reasonable, and second shows sth like 55.
That would mean that I 'added'/produced 55, right? sooo.. it was 45, I set it to 100.. producing 55.
But how it could be 45 if I can output MAX 50?! That would mean that in last tick network took 55 from the buffer.. :shock:
[/edit]
Last edited by Qcor on Tue Jun 16, 2015 2:31 am, edited 1 time in total.

Tim2162286
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Jun 15, 2015 2:34 am
Contact:

Re: Cursed Questions

Post by Tim2162286 »

Issue solved, the code that needs to be modified is line 432 of the ontick.lua script file.

Code: Select all

gen[i].accumulator.energy = (64^3) * 50 --originally (64^3) * 5
this works for the default values on the generator, but if you change the output to be higher it may cap back out (i think this will cap out at about 2.6 MW)

*Edit: Confirmed that setting it to 50 caps the generator out at 2.6 MW, which is above the generators default cap(2MW).
Last edited by Tim2162286 on Tue Jun 16, 2015 2:44 am, edited 1 time in total.

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

Tim2162286 wrote:Issue solved, the code that needs to be modified is line 432 of the ontick.lua script file.

Code: Select all

gen[i].accumulator.energy = (64^3) * 50 --originally (64^3) * 5
this works for the default values on the generator, but if you change the output to be higher it may cap back out (i think this will cap out at about 2.6 MW)
Yeaaa.. I was laughing hard when I saw it.. 64^3 *5... number good as any other I guess. probably left from some earlier version where he had different formula for generators :)
Should be set to buffer_size * 5 in theory but it won't work. First of all 300tick is usually 5sec but not always, and secondly there is that issue which I described earlier.. which applies also here.
So generally ANY big number here will "MOSTLY" fix the problem but it will give wrong readings on one of the power generation meters.

Tim2162286
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Jun 15, 2015 2:34 am
Contact:

Re: Cursed Questions

Post by Tim2162286 »

Qcor wrote: So generally ANY big number here will "MOSTLY" fix the problem but it will give wrong readings on one of the power generation meters.
no, that number only sets the maximum energy the generator will make, however it is limited to the output, so even putting it up to say (64^4) * 5000 wont affect how it reads in the power grid, it just lets you up the output more before you start getting down time while the buffer needs to charge. if you really want to limit it to exactly 2 MW, change the 50 to 38.5.
Qcor wrote: Yeaaa.. I was laughing hard when I saw it.. 64^3 *5... number good as any other I guess. probably left from some earlier version where he had different formula for generators :)
Should be set to buffer_size * 5 in theory but it won't work. First of all 300 tick is usually 5sec but not always, and secondly there is that issue which I described earlier.. which applies also here.
also i believe this number is watts, not kW, so you have an additional factor of 1000 you need to take into account.
Last edited by Tim2162286 on Tue Jun 16, 2015 3:10 am, edited 1 time in total.

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

I think you didn't read my previous post.. the one with files attached.

Try it.. detach all power generators but cursed one and look at stats.. you will see :)

Tim2162286
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Jun 15, 2015 2:34 am
Contact:

Re: Cursed Questions

Post by Tim2162286 »

so, i tried your code and it didn't work at all for some reason, but assuming know other modifications to the generators, replacing the ontick.lua with this version should fix any issues.
it is set to a max of 2 MW, but i added a variable to modify it easier
ontick.lua
replace the onscript.lua file with this one
(29.8 KiB) Downloaded 506 times

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

hm.. I honestly don't see how it can not work.
Could you be more specific? I just tested it again and it works just fine. Are you sure you overwrote BOTH files?

Also, as a side note, 64^3 *38 might still not be good enough. I suspect it will start fluctuating when near max lvl (64) because of the problem I described earlier. I'll try to test it.. it just bothers me for some reason, not knowing why it does that strange thing.

[edit]
just tested your solution and it looks like the generator is working for ~4sec then idle for ~1sec. Are you sure you didn't modify anything else? hint: like the buffer size for example? :roll:
[/edit]

[edit2]
also confirmed that even at 64^3 *38 at lvl 65 is fluctuates again (even with buffer size fixed... which is to be expected as this number is totally pulled from the sky. It should be (in THEORY) = math.floor(0.25 * (generator_rank - 1)^2 + (generator_rank - 1) * 25 + 25) * 1000 * 300` but it practice even that won't be enough due to some strange reason I just can't pinpoint :/

And I just found another bug. As a result the generator at lvl 64 has more max_output than lvl 65. Minor thing, easy fix.Just add " + 1" to if statement in cursed-generator.lua line 31

Code: Select all

if  i == datos.maxgenerator + 1 then
[edit2]

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

OK.. so, final changes:

In ontick.lua:

1) formula changed from some random number (64^3 *5) to what it should actually be:

Code: Select all

gen[i].accumulator.energy = math.floor(0.1 * (gen[i].rank - 1)^2 + (gen[i].rank - 1) * 25 + 25) * 1000 * 300
[edit3] this is still wrong, works but is wrong. I'm still trying to find how to properly set energy value [/edit3]
where
math.floor(0.1 * (gen.rank - 1)^2 + (gen.rank - 1) * 25 + 25) - is the max output of the generator of lvl i, according to cursed-generator.lua
* 1000 - is just conversion from [W] to [KW] because above is in [W]
* 300 - is here because we refill the generator every 300 ticks, so we need max_output* time it has to last

2) added another if statement to cover generator at max lvl (because it has different formula for max output)

Code: Select all

if gen[i].rank == datos.maxGenerator then
					gen[i].accumulator.energy = math.floor(0.25 * (gen[i].rank - 1)^2 + (gen[i].rank - 1) * 25 + 25) * 1000 * 300
				end
This way we generate exactly the amount we should be generating (in both cases).. not just some random number.


In cursed-generator.lua:

1) after inheriting properties of a basic accumulator we also inherit its max input. In our case should be set to 0kW to prevent some strange behaviors in rare cases.
added

Code: Select all

generator.energy_source.input_flow_limit = "0kW"
2) added " + 1" to if statement to correct the bug. Originally the lvl 64 generator takes this new output formula but lvl 65 should take it, not 64.

Code: Select all

if  i == datos.maxgenerator + 1 then
		output_flow_limit = math.floor(0.25 * (i - 1)^2 + (i - 1) * 25 + 25)
3) changed buffer size of generator to prevent strange fluctuations

Code: Select all

generator.energy_source.buffer_capacity = output_flow_limit * 330 .. "kW"
Why is it 330 and not 300? EXCELLENT question.. god only knows. Should be 300 but then you have some strange behavior which looks like the generator isrunning out of power in the buffer. So basically when you have a buffer of size AA and give it energy amount=AA it goes crazy.. but it buffer size is AA*1.1 it is OK.. :shock: so.. no idea why but it works :P
cursed-generator.lua
(62.62 KiB) Downloaded 465 times
goes to %appdata%\Factorio\mods\Cursed-Exp_0.4.1\prototypes\entities\
ontick.lua
(29.95 KiB) Downloaded 456 times
goes to %appdata%\Factorio\mods\Cursed-Exp_0.4.1\scripts\

P.S. Please bare in mind that this is NOT how it should work. It is just a functional workaround.

User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: Cursed Questions

Post by L0771 »

haaaa a lot of english! i need a lot of time to read all this, but...
The problem is:
The "production" of generator is limited for output_flow_limit and buffer_capacity is the storage.
Ok, but first, production are watts and the storage are jules (watts/time), basically, you need fill [production * x] every x seconds... technically you must give [output_flow_limit] every second.
64^3 is only a number, you can put 70^5.

I need time to read now :P

Laikar
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Jun 22, 2015 1:33 pm
Contact:

Re: Cursed Questions

Post by Laikar »

Sometimes my mines just start losing exp and turn back to lvl1, is this intended or its a bug?

Qcor
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Jun 01, 2015 7:19 pm
Contact:

Re: Cursed Questions

Post by Qcor »

1) they loose XP when there is no pollution.
2) they absorb pollution

Click on oxygen button while standing near to mine to make sure there is pollution

Post Reply

Return to “Mods”