Jump to content

Aren't power wires just pipes with charge flowing inside?


Recommended Posts

20 minutes ago, KittenIsAGeek said:

Oh, they did step 2.  This game functions amazingly well for what it does.  I think that most players fail to understand the sheer number of computations this game handles every second.  

Oh, sounds like you are the only person among us to have the right about considering something is doable or not.

Link to comment
Share on other sites

1 minute ago, DreamApart said:

Oh, sounds like you are the only person among us to have the right about considering something is doable or not.

*Ahem*

"Oh, sounds like you are the only person among us to hae the right to have an opinion about if something is doable or not."

Link to comment
Share on other sites

I think most of us agree that it would be nice to have a system, which calculate currents in wires and use that information for overload damage. However what the rest of us says is nothing is free. The CPU will need more time if it calculates more numbers. Since the game is already working at a reduced framerate due to lack of CPU power, adding more calculations will make the problem worse. That's what the rest of us talks about.

Unsurprisingly we can't agree on anything if we aren't even talking about the same thing.

Link to comment
Share on other sites

 

3 minutes ago, Nightinggale said:

I think most of us agree that it would be nice to have a system, which calculate currents in wires and use that information for overload damage. However what the rest of us says is nothing is free. The CPU will need more time if it calculates more numbers. Since the game is already working at a reduced framerate due to lack of CPU power, adding more calculations will make the problem worse. That's what the rest of us talks about.

Unsurprisingly we can't agree on anything if we aren't even talking about the same thing.

There are 2 topics here already.

One is about the mechanics itself, If we can have the pipe system, we can have a system that's similar to that.

The other is about CPU power. Some says a system as heavy as pipes will certainly impact the performance, but I think not.

 

Link to comment
Share on other sites

1 minute ago, DreamApart said:

One is about the mechanics itself, If we can have the pipe system, we can have a system that's similar to that.

Which you just described some major ways they aren't similar.

The other is about CPU power. Some says a system as heavy as pipes will certainly impact the performance, but I think not.

And you would be empirically wrong.

Link to comment
Share on other sites

  • Developer
1 hour ago, DreamApart said:

The other is about CPU power. Some says a system as heavy as pipes will certainly impact the performance, but I think not.

Have you actually programmed anything before? if you haven't(and based on your responses I'm gonna go with a no) then your not really in a position to be making comments on how something would affect performance; the only time a system can be "reused" is if its a simple math problem, something like this:
10 things produce X power each(they all produce the exact same power). therefore the calculation is 10*X.
adding 5 more of the "things" wouldn't decrease performance, since the calculation is now 15*X.
but with pipes, there is no "simple math problem", each pipe has to do calculations for itself, based on the contents of the pipes; applying that to wires would result in doing the same calculations more times, so the answer is it would heavily affect performance, probably more than pipes, since the flow would be far more constant than pipes(in most cases).

Link to comment
Share on other sites

Just now, DreamApart said:

Fine. So I insist my point, and you have yours.

So let's just agree that we disagree.

That's not what "empirically" means.

You might as well be claiming that gravity doesn't exist IRL.

Your opinion doesn't affect the fact of the matter.

Link to comment
Share on other sites

4 minutes ago, Yunru said:

That's not what "empirically" means.

You might as well be claiming that gravity doesn't exist IRL.

Your opinion doesn't affect the fact of the matter.

Well, then not point to continue this conversation between us, you can claim your fact, while I might not agree your fact.

My opinion doesn't change the fact, and yours don't either.

Link to comment
Share on other sites

@DreamApartI read your post about how electricity behaves like pipes and I still disagree.  There are similarities in the end result of their behavior, yes, but there are some crucial differences. 

First, the calculations done for an electrical network are quite different than those from the piped network.  I am quite certain that the electrical network requires far less CPU time than an equally-sized piping network.  The algorithm is something like this:

  • For each consumer, check if power is available.
  • If power is sufficient, reduce available power and operate building.

For the piping network there are calculations at each branch to decide where the liquid (or gas) flows.  These calculations involve looking for directional modifiers (input, output ports), and other branches.  For example, the electrical network shown below will be an order of magnitude more efficient than the piping network beside it.

image.thumb.png.8958d73426a33121bd9b8a11659202a8.png

In fact, there's a thread here where someone was having EXTREMELY poor performance and they posted their map.  They had a piping network somewhat similar to the one above, where the liquid could flow down multiple paths.  Once their piping network was changed to allow for only one possible direction of flow, their game performance improved DRAMATICALLY.  

 

The next major difference between electricity flow and liquid/gas flow in pipes is the thermal calculations.  For the electric grid above, thermal calculations are done between the buildings and the environment, and the wires and the environment.  For the pipes, there's a further calculation between the contents of the pipe and the pipe.  This means that for any given length of pipe or wire, the CPU burden for thermal calculations will be at least 30% greater for pipes than for wires.

 

Yet ANOTHER major difference between pipes and wires is behavior.  If your generator runs out of fuel, ALL consumers on the network will fail immediately.  However, if your pump shuts down due to lack of power, liquids will keep moving in the pipe until all liquids are gone.  Having a charge carrier within wires makes absolutely no sense because it means that your consumers would continue operating until the last packet of power was used.  That's NOT how electricity works.  It would add a significant CPU burden to calculate how each individual charge carrier flows, and it would further burden the thermal code.

 

Finally, I don't understand why your response to an argument is to claim that the other person has no idea what they're talking about.  I may not be the smartest individual on the internet, but computer programming and electrical circuits are the field I have been trained in.  I understand quite a bit about their behavior and about the physics involved -- even if I'm not very good at conveying those concepts to everyone else.

 

In my humble opinion, it would be EXTREMELY detrimental to ONI for the developers to make wires behave like pipes.

Link to comment
Share on other sites

12 minutes ago, Zarklord said:

Have you actually programmed anything before? if you haven't(and based on your responses I'm gonna go with a no) then your not really in a position to be making comments on how something would affect performance; the only time a system can be "reused" is if its a simple math problem, something like this:
10 things produce X power each(they all produce the exact same power). therefore the calculation is 10*X.
adding 5 more of the "things" wouldn't decrease performance, since the calculation is now 15*X.
but with pipes, there is no "simple math problem", each pipe has to do calculations for itself, based on the contents of the pipes; applying that to wires would result in doing the same calculations more times, so the answer is it would heavily affect performance, probably more than pipes, since the flow would be far more constant than pipes(in most cases).

Let's say you have 1000 gas pipes.

Suppose the time complexity is worse than linear, and the cost is F(1000). 

Then you have 1000 liquid pipes, the cost is F(1000), so it's F(1000)+F(1000) = 2 F(1000) in total.

Then you have another pipe system and have another 1000 pipes, the total cost just changes from 2 F(1000) to 3 F(1000).

 

Link to comment
Share on other sites

5 minutes ago, DreamApart said:

 

Simple way to test this.

Make a liquid loop 400 tiles long. Measure game performance.

Make a wire loop 400 tiles long. Measure game performance.

The one that impacts game performance the most taxes the CPU the most.

It's really that simple.

Link to comment
Share on other sites

  • Developer
59 minutes ago, DreamApart said:

Let's say you have 1000 gas pipes, the cost is F(1000).

Then you have 1000 liquid pipes, the cost is F(1000), so it's F(1000)+F(1000) = 2 F(1000) in total.

Then you have another pipe system and have another 1000 pipes, the total cost just changes from 2 F(1000) to 3 F(1000).

 

good, you grasped that concept.
now the next concept you need to grasp, is that F(1000) is a super expensive calculation, so doing it a 3rd time would be awful.

Link to comment
Share on other sites

Just now, DreamApart said:

Let's say you have 1000 gas pipes, the cost is F(1000).

Then you have 1000 liquid pipes, the cost is F(1000), so it's F(1000)+F(1000) = 2 F(1000) in total.

Then you have another pipe system and have another 1000 pipes, the total cost just changes from 2 F(1000) to 3 F(1000).

 

No.  You're severely underestimating the load for calculating both the flow of pipes and the thermal transfers that are occurring.  At best, each segment's calculations are logarithmic.  So you're looking at 1000* log(n) for a 1000 segment pipe. 

Link to comment
Share on other sites

4 minutes ago, Zarklord said:

good, you grasped that concept.
now the next concept you need to grasp, is that F(1000) is a super expensive calculation, so doing it a 3rd time would be awful.

Even If F(1000) is expensive, we already paid the price twice and survived, doing it a 3rd time is not too awful to tolerate.

It won't increase CPU cost by so much as 50% if you take the gas and liquid exchange (I mean among the tiles) into consideration.

Link to comment
Share on other sites

3 minutes ago, Saturnus said:

Simple way to test this.

Make a liquid loop 400 tiles long. Measure game performance.

Make a wire loop 400 tiles long. Measure game performance.

The one that impacts game performance the most taxes the CPU the most.

It's really that simple.

Realistically, you need to make a pipe with branches.  The performance hit for this is MUCH worse than a straight pipe of the same number of segments:

image.png.d3f64d7c6ac7d6fc2670c404b46734d4.png

Link to comment
Share on other sites

  • Developer

this is a quote from factorio's game devs who know what they are talking about when it comes to optimization:

Quote

A simplified version of this is what we consider the 'nuclear option'. In short, fluid network and pipes would work like the current electric network, instant transmission from production to consumption. This would increase performance by orders of magnitude, and remove the unintuitive flow of the current system, all consumers would get an equal split of the production, and storage tanks would act like accumulators.

this quote is taken for the discussion of optimizing fluid pipes, since they lag the game like crazy, the exact same situation is true here.

https://www.factorio.com/blog/post/fff-260 (scroll down a ways)

59 minutes ago, DreamApart said:

If F(1000) is expensive, we already paid the price twice and survived, doing it a 3rd time is not too awful to tolerate.

It won't increase CPU cost by 50% if you take the gas and liquid exchange (I mean among the tiles) into consideration.

we already shot ourselves in the leg twice, whats one more bullet!

Link to comment
Share on other sites

Just now, KittenIsAGeek said:

Realistically, you need to make a pipe with branches.  The performance hit for this is MUCH worse than a straight pipe of the same number of segments:

image.png.d3f64d7c6ac7d6fc2670c404b46734d4.png

I know. But the performance impact is measurable with a long enough liquid pipe. Whereas the performance penalty involved with wires is virtually zero.

Link to comment
Share on other sites

23 minutes ago, DreamApart said:

Well, then not point to continue this conversation between us, you can claim your fact, while I might not agree your fact.

My opinion doesn't change the fact, and yours don't either.

It's time to get out when the words fact and opinion are used interchangeably. It kills any fact based discussion.

The problem is that there seems to be opinions on how CPU should perform regarding to certain workloads. It's actually facts kind of like how heavy is a cup of water. We can measure it and we can based on past measurements predict results. It's not something like "I think the cup should contain a ton of water".

Link to comment
Share on other sites

21 minutes ago, DreamApart said:

Let's say you have 1000 gas pipes.

Suppose the time complexity is worse than linear, and the cost is F(1000). 

Then you have 1000 liquid pipes, the cost is F(1000), so it's F(1000)+F(1000) = 2 F(1000) in total.

Then you have another pipe system and have another 1000 pipes, the total cost just changes from 2 F(1000) to 3 F(1000).

 

If computing liquid pipes is your worst computation for the entire game, say takes 67% of the time for a single frame, going from 2 F(1000) to 3 F(1000) is going to go from 67% of the frame to 100.33% of a frame just calculating liquid pipes.  Meaning the frame rate will slow down.

 

Edit: Also if computations occur for each liquid branch, but for power lines the computations are only for each provider/consumer... Each liquid branch adds more computations, possibly in a linear fashion, each power branch adds 0 additional computation.

Link to comment
Share on other sites

4 minutes ago, Drethon said:

If computing liquid pipes is your worst computation for the entire game, say takes 67% of the time for a single frame, going from 2 F(1000) to 3 F(1000) is going to go from 67% of the frame to 100.33% of a frame just calculating liquid pipes.  Meaning the frame rate will slow down.

A very valid point.

Link to comment
Share on other sites

8 minutes ago, Drethon said:

If computing liquid pipes is your worst computation for the entire game, say takes 67% of the time for a single frame, going from 2 F(1000) to 3 F(1000) is going to go from 67% of the frame to 100.33% of a frame just calculating liquid pipes.  Meaning the frame rate will slow down.

Even if F(1000) only takes 10%, going from 2 F(1000) to 3 F(1000) will increase from 20% to 30%. However knowing the game the remaining 80% would still be in use and we end up with 110% total, which would also be loss of frame rate.

In fact it can be reduced to the simple fact that the CPU can't maintain 60 FPS as it is meaning any increase of CPU requirement will reduce the frame rate.

Link to comment
Share on other sites

40 minutes ago, KittenIsAGeek said:

There are similarities in the end result of their behavior, yes, but there are some crucial differences. 

First, the calculations done for an electrical network are quite different than those from the piped network.  I am quite certain that the electrical network requires far less CPU time than an equally-sized piping network.  The algorithm is something like this:

  • For each consumer, check if power is available.
  • If power is sufficient, reduce available power and operate building.

For the piping network there are calculations at each branch to decide where the liquid (or gas) flows.  These calculations involve looking for directional modifiers (input, output ports), and other branches.  For example, the electrical network shown below will be an order of magnitude more efficient than the piping network beside it.

You are right about this.

However, that means electric wires are even simpler than pipes, and can be optimized so it won't impact the performance. The electricity system doesn't not have to use the exactly same algorithm as pipes.

Yes, that will make it more complicated than the current logic, but the cost is acceptable.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...