[MOD 0.12.x] Rescaled Evolution Factor

Topics and discussion about specific mods
XBBX
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Wed Jan 07, 2015 4:30 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by XBBX »

i get this error with test version 1.4.1
Image
and how i can change how much spawners i have to kill to reach 30% in 1.3.1 version

User avatar
BenediktMagnus
Inserter
Inserter
Posts: 29
Joined: Wed Mar 09, 2016 11:04 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by BenediktMagnus »

XBBX wrote:i get this error with test version 1.4.1
I've fixed that. Thanks for your response.
XBBX wrote:and how i can change how much spawners i have to kill to reach 30% in 1.3.1 version
In line 54 to 56 of the control.lua there stands this:

Code: Select all

if global.pollution_spawner < 60 then
  pollution_spawner_anzahl = global.pollution_spawner / 20
end
The 60 in the first line is the number of spawners you have to destroy to reach 30%. But you also have to change the division with 20 in the next line. It has to be your value divided by three (because of 30%).
For example:

Code: Select all

if global.pollution_spawner < 90 then
  pollution_spawner_anzahl = global.pollution_spawner / 30
end
which will set the value to 90.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Ranakastrasz »

Code: Select all

function spawnertot(event)
   if (global.pollution_spawner < 60 and (event.entity.name == "spitter-spawner" or event.entity.name == "biter-spawner")) then
      global.pollution_spawner = global.pollution_spawner + 1
   end   
end
You forgot this part.

Would be preferable if you had variables for each part at the top of the file instead, so you could just change the values quickly.

Also, in that case, it doesn't work if you have a mod that adds custom spawners, like bobs mod. compare type to "unit-spawner" instead.

Edit:
Made a few changes. Added config stuff, english translations for the minor comments, and Applied the unit-spawner logic.
The values are different tho, since its for my game.

Side note: I suggest that pollution and maybe even the spawners have the same square-root curve as Time does, so it ramps up slowly. Or perhaps for pollution, the inverse. Goes up fast and slows down fast after that. Not sure. Pollution is always really easy to max out as is, and I am unsure how it is diluted by revealing more chunks. That doesn't really make much sense to me.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Sakata
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 05, 2016 11:34 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Sakata »

Any chance this is getting an update? Spent some time digging around in the factorio mod server and didn't see it :cry:

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Ranakastrasz »

Here.
I have modified it however. Added config options, altered formulas and balance, and so on, but it should work at least.

Spawner kills cap at 120 intead of 60 or 40, whatever it was originally, and decay every 12 minutes, instead of each hour, and it is continous.
Pollution has a square root equation, so it goes up fast, then slows down massively. Also caps at 30 million, or rather 240 million. Kinda. The equation was already a bit confusing.
Time is unchanged.
Attachments
Rescaled-Evolution-Factor_1.3.3.zip
(5.37 KiB) Downloaded 127 times
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
BenediktMagnus
Inserter
Inserter
Posts: 29
Joined: Wed Mar 09, 2016 11:04 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by BenediktMagnus »

First: Thanks Ranakastrasz for your changes! I like it, you cleand up the code. (By the way: The only reason why I mostly use German words for variables etc. is to be sure to never have any conflicts. :D )

I will work at this mod again in the future. But at the moment I don't have any time for Factorio (or any other computer game...). Life can be so time-consuming. I hope to be able to make a new release when Factorio 0.13 will come out. Until then: Ranakastrasz made some nice changes. With the 1.3.3 you can easily customise the mod if you change the values in the first lines of the control.lua.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Ranakastrasz »

Planning on adding a config setting for the power factor. So you can set it to front loaded, rear loaded, or linear. Also thinking of increasing kill based factor to 80% so that cutting your power for less pollution can't get rid of behemoths or something, if you have been fighting a lot.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Kitsune
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed Jan 07, 2015 1:53 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Kitsune »

Hey there, is it possible or make even sense to use this mod with misanthrope? :D I like the way misanthrope handles expansion ect. but i like the scaling of the evolution factor from this mod. Because of that i would like to use them together. ^~^

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Ranakastrasz »

Kitsune wrote:Hey there, is it possible or make even sense to use this mod with misanthrope? :D I like the way misanthrope handles expansion ect. but i like the scaling of the evolution factor from this mod. Because of that i would like to use them together. ^~^
It SHOULD work, but only partially. The extra functionality at high evo factor should work, as should the altered expanstion mechanics. Anything that mod does to alter the evolution factor will be blocked, or rather overwritten constantly, so no increased decay factor.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Peppe »

Ranakastrasz wrote:Here.
I have modified it however. Added config options, altered formulas and balance, and so on, but it should work at least.

Spawner kills cap at 120 intead of 60 or 40, whatever it was originally, and decay every 12 minutes, instead of each hour, and it is continous.
Pollution has a square root equation, so it goes up fast, then slows down massively. Also caps at 30 million, or rather 240 million. Kinda. The equation was already a bit confusing.
Time is unchanged.
Seems like the processing this does once a second eventually takes longer than a tick.

If i had to guess the long processing time is probably looping through all the chunks?

Code: Select all

	
local s = game.surfaces["nauvis"]
for c in s.get_chunks() do
			summe = summe + s.get_pollution({c.x *32,c.y *32})
			anzahl = anzahl + 1
		end
Makes the game slow down for the one tick it processes every chunk once a second, so you don't get 60/60 FPS/UPS.

Maybe a strategy could be used to check the same amount of chunks still, but staggered so you only check a percentage every tick. Like 1/3 every 20 ticks. Or calculate pollution in a way that does not visit every chunk on the map...

User avatar
BenediktMagnus
Inserter
Inserter
Posts: 29
Joined: Wed Mar 09, 2016 11:04 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by BenediktMagnus »

@Peppe:

You are totally right with your analysis. Yet I did not think that would be a problem but I like your solution and that should be made easily, so I integrate it probably the next release.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Ranakastrasz »

Peppe wrote:
Ranakastrasz wrote:Here.
I have modified it however. Added config options, altered formulas and balance, and so on, but it should work at least.

Spawner kills cap at 120 intead of 60 or 40, whatever it was originally, and decay every 12 minutes, instead of each hour, and it is continous.
Pollution has a square root equation, so it goes up fast, then slows down massively. Also caps at 30 million, or rather 240 million. Kinda. The equation was already a bit confusing.
Time is unchanged.
Seems like the processing this does once a second eventually takes longer than a tick.

If i had to guess the long processing time is probably looping through all the chunks?

Code: Select all

	
local s = game.surfaces["nauvis"]
for c in s.get_chunks() do
			summe = summe + s.get_pollution({c.x *32,c.y *32})
			anzahl = anzahl + 1
		end
Makes the game slow down for the one tick it processes every chunk once a second, so you don't get 60/60 FPS/UPS.

Maybe a strategy could be used to check the same amount of chunks still, but staggered so you only check a percentage every tick. Like 1/3 every 20 ticks. Or calculate pollution in a way that does not visit every chunk on the map...
No, that just applies to the spawner kill decay, not to the counting how many chunks for pollution.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
BenediktMagnus
Inserter
Inserter
Posts: 29
Joined: Wed Mar 09, 2016 11:04 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by BenediktMagnus »

Ranakastrasz wrote: No, that just applies to the spawner kill decay, not to the counting how many chunks for pollution.
Why do you think so?
Looping through all the chunks is much more work to do than decrease an integer value. And even if you remove all the spawner features, the 59.9 FPS/UPS is still there.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Ranakastrasz »

BenediktMagnus wrote:
Ranakastrasz wrote: No, that just applies to the spawner kill decay, not to the counting how many chunks for pollution.
Why do you think so?
Looping through all the chunks is much more work to do than decrease an integer value. And even if you remove all the spawner features, the 59.9 FPS/UPS is still there.
Oh, I thougt you were refering to the change I made, which did not touch that part. Yes, that occurs each second, but so far as I can tell, that doesn't cost much.
Still, I am not sure why that was added in the first place. Doesn't really add much.
Also, there is no way around the loop. You still NEED to count the global pollution count for the mod to work. No other way to have Evo factor scale by global pollution without counting it. If you increse the tick delay, it might help some, or if there is a way to stagger it, but It isn't really avoidable.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Ranakastrasz »

Anyhow, Updated.
Increased Config options significantly. should be far more customizable now.
Can apply the exponent part however you want, mainly. Also, there is overlap now, so it is actually quite possible to hit 100% Evo factor, even if you were to turn off your factory to cut pollution, if you attacked enough enemy bases.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
BenediktMagnus
Inserter
Inserter
Posts: 29
Joined: Wed Mar 09, 2016 11:04 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by BenediktMagnus »

Thanks! Looks very nice!

One thing I noticed:
"-- Currently disabled. I can't see any reason to have your exploration reduce how much biters hate pollution."
I used the explorated chunks as a way to indicate the size of a factory. The intention was to simulate that, over time and intensity of the factory's pollution, there is a little bit of evolutionary adaptation. A big and old factory should be allowed to produce more pollution than a small one. And the number of explored chunks seemed to be a better indicator than time is. In the new system I plan this will maybe be obsolet.

Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by Peppe »

Ranakastrasz wrote:
Peppe wrote:
Ranakastrasz wrote:Here.
I have modified it however. Added config options, altered formulas and balance, and so on, but it should work at least.

Spawner kills cap at 120 intead of 60 or 40, whatever it was originally, and decay every 12 minutes, instead of each hour, and it is continous.
Pollution has a square root equation, so it goes up fast, then slows down massively. Also caps at 30 million, or rather 240 million. Kinda. The equation was already a bit confusing.
Time is unchanged.
Seems like the processing this does once a second eventually takes longer than a tick.

If i had to guess the long processing time is probably looping through all the chunks?

Code: Select all

	
local s = game.surfaces["nauvis"]
for c in s.get_chunks() do
			summe = summe + s.get_pollution({c.x *32,c.y *32})
			anzahl = anzahl + 1
		end
Makes the game slow down for the one tick it processes every chunk once a second, so you don't get 60/60 FPS/UPS.

Maybe a strategy could be used to check the same amount of chunks still, but staggered so you only check a percentage every tick. Like 1/3 every 20 ticks. Or calculate pollution in a way that does not visit every chunk on the map...
No, that just applies to the spawner kill decay, not to the counting how many chunks for pollution.

That loop is affecting performance.

Code: Select all

		--[[
		for c in s.get_chunks() do
			summe = summe + s.get_pollution({c.x *32,c.y *32})
			anzahl = anzahl + 1
		end
		]]--
		summe = 1000
		anzahl = 1000000

With it in I get 58-59 meaning it always skips one tick a second and sometimes has to skip 2.
full zoom out
I commented out and get 60/60 FPS/UPS on this same map standing in the same spot doing the same action.

User avatar
dtoxic
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Fri Apr 01, 2016 8:40 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by dtoxic »

any updates planed for 0.13.X?

User avatar
BenediktMagnus
Inserter
Inserter
Posts: 29
Joined: Wed Mar 09, 2016 11:04 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by BenediktMagnus »

Yes. As soon as 0.13 will be stable and I will have the time to update the mod.

User avatar
dtoxic
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Fri Apr 01, 2016 8:40 pm
Contact:

Re: [MOD 0.12.x] Rescaled Evolution Factor

Post by dtoxic »

BenediktMagnus wrote:Yes. As soon as 0.13 will be stable and I will have the time to update the mod.
cool thx for the info :)

Post Reply

Return to “Mods”