Display maximum historical pollution spread

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Display maximum historical pollution spread

Post by Lav »

The map mode displays only current pollution. However it may be well lower than the maximum possible value, since not all parts of your factory always run at 100%.

Thus it would be great if we could see not only current pollution cloud, but also maximum historical pollution cloud, i.e. all chunks that have ever been polluted.

That would be more useful when strategizing the eradication of alien nests.

The Eriksonn
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Jun 08, 2016 6:16 pm
Contact:

Re: Display maximum historical pollution spread

Post by The Eriksonn »

Or perhaps somekind of slider to show different Points in time?

User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Re: Display maximum historical pollution spread

Post by Lav »

What would that tell me? It would make sense if I could correlate historical pollution data with certain events in my factory's history, and how're you going to track those? And without that, all I would get from that slider is a funny red bubbles. Pretty useless and not even fulfilling my suggestion's goals for massively higher memory cost.

Engimage
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Wed Jun 29, 2016 10:02 am
Contact:

Re: Display maximum historical pollution spread

Post by Engimage »

Historical data requires a huge amount of memory to store. This applies to both RAM and savegame data.
I do not think this data is valuable enough to sacrifice more resources to it. Definitely not worth it.

User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Re: Display maximum historical pollution spread

Post by Lav »

PacifyerGrey wrote:Historical data requires a huge amount of memory to store. This applies to both RAM and savegame data.
I do not think this data is valuable enough to sacrifice more resources to it. Definitely not worth it.
I assume you're talking about Eriksonn's idea, cause what I want only needs 1 bit per chunk. :-)

JohnyDL
Filter Inserter
Filter Inserter
Posts: 533
Joined: Fri May 16, 2014 3:44 pm
Contact:

Re: Display maximum historical pollution spread

Post by JohnyDL »

Not one bit probably 2 bytes per chunk but it adds 3 lines of code to each chunk per tick, I'm not sure how that fits in the optimization

User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Re: Display maximum historical pollution spread

Post by Lav »

JohnyDL wrote:Not one bit probably 2 bytes per chunk but it adds 3 lines of code to each chunk per tick, I'm not sure how that fits in the optimization
I think you're overcomplicating things.

Why would you need 2 bytes?

And why would you need 3 lines?

There's already some code handling the pollution. So chunks that have pollution are already processed. Only a single boolean needs to be set for such chunks. There's no need to even check for it's previous value - it'll probably take more time than simply setting it.

JohnyDL
Filter Inserter
Filter Inserter
Posts: 533
Joined: Fri May 16, 2014 3:44 pm
Contact:

Re: Display maximum historical pollution spread

Post by JohnyDL »

You need to store the value of the maximum pollution vs current pollution which is probably going to be an int>255 or a float, 2 bytes not boolean

If current > max
Max = current
End if

3 lines of code

It's no good to just say if a chunk has been polluted cause if you drive through a chunk or similar to explore that's >1 pollution and thus would show up you need to see not only the size but intensity of maximum reach

User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Re: Display maximum historical pollution spread

Post by Lav »

JohnyDL wrote:You need to store the value of the maximum pollution vs current pollution which is probably going to be an int>255 or a float, 2 bytes not boolean

If current > max
Max = current
End if

3 lines of code

It's no good to just say if a chunk has been polluted cause if you drive through a chunk or similar to explore that's >1 pollution and thus would show up you need to see not only the size but intensity of maximum reach
First, I hope Factorio isn't written in Basic. :-)

Second, nope. That's irrelevant. What I want to get is the extent of my pollution cloud. I don't care what levels of pollution were at the center. They were pretty high anyway - otherwise those chunks wouldn't be at the center. I don't care what levels of pollution were at the edges. They were extremely low anyway - those chunks wouldn't be edges otherwise. And any car pollution is not a problem either - those trails are easily identifiable, so unless you intentionally drive in ever-increasing circles around your base, it's not a problem to see the difference between industry-produced pollution and driving excursions. Plus most of the time you won't be driving your car through spawner-infested chunks, which means that with a few exceptions spawner-containing chunks will remain pollution free on the map - and that's all that matters.

JohnyDL
Filter Inserter
Filter Inserter
Posts: 533
Joined: Fri May 16, 2014 3:44 pm
Contact:

Re: Display maximum historical pollution spread

Post by JohnyDL »

No but being able to identify the cause of pollution isn't that simple say you have an ore patch that's now completely mined out and your base's Boolean cloud looks like a peanut by being able to see the gradient you can better predict where that removal of the mine reduces the pollution cloud you need to be worried by. And now consider you want to set up a mine would knowing the size of the pollution cloud the mine would cause based on other mines you can see be helpful?

1 unit of pollution is not enough to bother bitters they have a threshold so should the Boolean be based on the threshold? If your Boolean cloud reaches 4 chunks further than the cloud that determines if attacks should be initiated would you want one more than another?

Also it doesn't matter what language most will have it as 3 lines for the benefit of the programmer and 3 things to consider in terms of the logic

C and Java are

If (current > Max){
Max = current;
}

And in assembly it's this (I think)

Code: Select all

01 clr	a			//clear register
02 mov	a, max		//move max to register
03 subb	a, current		//subtract current from register
04 ja		06			//if register is positive (max>current) skip next line
05 mov	max, current	//set max as current
06 ....
It boils down to (1) Compare, (2) do something if true or (3) go to line if false

User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Re: Display maximum historical pollution spread

Post by Lav »

JohnyDL wrote:And in assembly it's this (I think)

Code: Select all

01 clr	a			//clear register
02 mov	a, max		//move max to register
03 subb	a, current		//subtract current from register
04 ja		06			//if register is positive (max>current) skip next line
05 mov	max, current	//set max as current
06 ....
Haven't written a line in ASM in the last 20 years, but I'm pretty sure you don't need to clear a register before loading a value, and you need to compare (lt or gt), not substract. :-)

A threshold for recording the pollution makes sense, true.

As for the detailed data on pollution levels, I agree to disagree. For my purposes, a single bit is enough. A single byte is probably enough for yours (you won't get exact value, but accuracy will be enough to generate a gradient). In the end, it's the devs who are to decide if 2 bytes per chunk is too much or not.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Display maximum historical pollution spread

Post by eradicator »

@Lav:
With a few hacks this should be moddable. If you really want this in base you should make a mod for demonstration :P.

Step 1: How?:
  1. A tick handler regularly scans all chunks to check if they have any pollution. Scanning the whole surface every 60 seconds should be enough? This might be somewhat slow but sufficient for a demo.
  2. Store the "was polluted at least once"-flag you get in a per-chunk table.
Step 2: So how the fuck do we display the data?
  • Turn off pollution for the surface. This does not remove pollution but turns of spreading etc so we can get a consistent state.
  • Scan and store the exact current value of pollution for each chunk.
  • Clear all pollution from the surface
  • Insert 1 pollution into every flagged chunk according to data from step 'A'.
  • When done viewing the historical map clear pollution again, restore values from step '2' and turn pollution spreading on again.
Ofc you have to keep the pollution added for display in step '4' below the threshold so you don't accidentially mess something up. And while 'display mode' is on you don't produce any actual pollution. But for a proof-of-concept it should be sufficient.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

JohnyDL
Filter Inserter
Filter Inserter
Posts: 533
Joined: Fri May 16, 2014 3:44 pm
Contact:

Re: Display maximum historical pollution spread

Post by JohnyDL »

Code: Select all

01 mov   a, max        //move max to register a
02 mov   b, current      //move current to register b
03 gt      b, a      //compare register a and b
04 jgt     06         //if compare flag is true (max>current) skip next line
05 mov   max, current   //set max as current
06 ....
Something like this? :p doesn't clear though send the data to RAM? Not just 0 the data? Haven't actually done much in assembler.

My point was you were possibly over simplifying by saying it's one bit and no code impact, there's some it's negligible I think.

having thought about it some more I actually like the idea and think it's probably worth doing, but that it's only worth doing if you make it a historic maximum not a Boolean. As for memory vs lines of code I think it'd be better for performance if it's just max=current and max be the same type as current rather than max = function to turn type of max into a number between 0 and 255(current) the maybe 10s of kb per map in memory not worth several cycles of CPU per tick when the cloud is expanding rapidly.

Post Reply

Return to “Ideas and Suggestions”