Latest Posts

Topic: Rework Atlantean Crystal Mine

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3105
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-21, 16:03

Copied over from https://wl.widelands.org/forum/post/24156/

teppo wrote:

WorldSavior wrote:

GunChleoc wrote:

They also need to build Crystal mines to get precious stones - quarries won't do it.

This reminds me at the fact that crystal mines are bugged. If they don't find any resources, their probability to produce quartz or diamond is far less than the desired 5%.

This might (=did not try) be quite easy to make the situation slightly better:

  • mine_granite program is executed only if economy needs granite, else skipped. Currently, the miner attempts to mine granite if granite or quartz are missing.

  • mine_quartz program is executed only if economy needs quartz, else skipped. Currently, the miner attempts to mine quartz if granite or quartz are missing.

  • mine_diamond is executed only if economy needs diamond, else skipped. Currently, the miner attempts to mone diamonds if granite or diamond are missing.

If the first program fails (95% odds after trying on depleted mine), the next steps are not considered.

If the miner would skip more programs, the 5% odds would be spared to the correct step in the production program.

The downside would be that the mines would be somewhat slower, as more steps would be skipped.

Even after this change, if the economy lacks everything, mostly granite would come out of the crystal mine.


Busy indexing nil values

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3105
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-21, 16:10

Actually, the "mine granite" program will also produce 1 quartz. It just produces a lot less quartz than the "mine quartz" program.

How about replacing 1 granite with 1 diamond as an output in the "mine granite" program, and vice versa in the "mine diamond" program?

Program Input Granite Quartz Diamond
"mine granite" 2 meat or fish, 2 bread 5 -> 4 1 0 -> 1
"mine quartz" 2 meat or fish, 2 bread 3 3 0
"mine diamond" 2 meat or fish, 2 bread 1 -> 2 0 2 -> 1

Busy indexing nil values

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 1420
Ranking
One Elder of Players
Location: GER
Posted at: 2018-02-21, 16:58

GunChleoc wrote:

Let's continue the Crystalmine discussion in https://wl.widelands.org/forum/topic/4212/

Okay

teppo wrote:

WorldSavior wrote:

GunChleoc wrote:

They also need to build Crystal mines to get precious stones - quarries won't do it.

This reminds me at the fact that crystal mines are bugged. If they don't find any resources, their probability to produce quartz or diamond is far less than the desired 5%.

This might (=did not try) be quite easy to make the situation slightly better:

  • mine_granite program is executed only if economy needs granite, else skipped. Currently, the miner attempts to mine granite if granite or quartz are missing.

  • mine_quartz program is executed only if economy needs quartz, else skipped. Currently, the miner attempts to mine quartz if granite or quartz are missing.

  • mine_diamond is executed only if economy needs diamond, else skipped. Currently, the miner attempts to mone diamonds if granite or diamond are missing.

I once suggested that and still support it

If the first program fails (95% odds after trying on depleted mine), the next steps are not considered.

Are you sure? I thought that the lines with "mine" will cancel the program, not the whole cycle of programs. Canceling a program usually doesn't cancel the cycle, but the next program will run...

If the miner would skip more programs, the 5% odds would be spared to the correct step in the production program.

The downside would be that the mines would be somewhat slower, as more steps would be skipped.

I thought that skipping requires only parts of seconds?

GunChleoc wrote:

Actually, the "mine granite" program will also produce 1 quartz. It just produces a lot less quartz than the "mine quartz" program.

How about replacing 1 granite with 1 diamond as an output in the "mine granite" program, and vice versa in the "mine diamond" program?

Program Input Granite Quartz Diamond
"mine granite" 2 meat or fish, 2 bread 5 -> 4 1 0 -> 1
"mine quartz" 2 meat or fish, 2 bread 3 3 0
"mine diamond" 2 meat or fish, 2 bread 1 -> 2 0 2 -> 1

May I ask: What is the motivation for that?

The disadvantage would be that "mine diamond" would be worse than "mine granite". Players could set economy settings of diamond and granite to zero, so "mine diamond" would be skipped always (while economy settings of quartz could stay high), so it's superfluous.

Edit: Okay, that's not completely correct, because in this case the mine would also always do "mine quartz", so you get only half a diamond per each step.

But I don't like the idea that there is a bad program which the workers should always skip - which they will not do (if the suggestion of teppo and me will not be implemented at the same time).

By the way: If one stops the mine and restarts it after a while, the working cycle will be cancelled and the first program will always be the next one. So there would be a possibility for a weird micromanagement in the game: Stopping and restarting the mine always to avoid "mine diamond" in order to use only "mine granite" instead. And I think that stupid micromanagement like this should not be possible face-wink.png

Edited: 2018-02-21, 17:16

“It's a threat to our planet to believe that someone else will save it.” - Robert Swan

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3105
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-21, 17:44

OK, you've convinced me that my ideas was not good. Let's do something on the lines of changing the skip conditions instead as suggested by you and teppo.

Are you sure? I thought that the lines with "mine" will cancel the program, not the whole cycle of programs. Canceling a program usually doesn't cancel the cycle, but the next program will run...

That's true. Otherwise, trainingsites would have a big problem...

Edited: 2018-02-21, 17:45

Busy indexing nil values

Top Quote
teppo
Joined: 2012-01-30, 09:42
Posts: 372
Ranking
Tribe Member
Posted at: 2018-02-21, 20:05

WorldSavior wrote:

If the first program fails (95% odds after trying on depleted mine), the next steps are not considered.

Are you sure? I thought that the lines with "mine" will cancel the program, not the whole cycle of programs. Canceling a program usually doesn't cancel the cycle, but the next program will run...

Not sure. I have read the associated code, but that was long ago. Then, the miner only gained experience if all mining steps succeeded in the same cycle. This made training Empire miners in resource-poor areas difficult. The code has been changed since then, and this feature might have changed too.

However, if the steps are no longer coupled, then I do not understand why the odds of a success in depleted mines would be significantly below 5%.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3105
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-22, 08:34

I'd have to dig deeper into the code to try to understand when workers gain experience, but when mining and the mining fails, there is still a random chance that they will gain experience anyway.

teppo wrote:

However, if the steps are no longer coupled, then I do not understand why the odds of a success in depleted mines would be significantly below 5%.

Did the person who wrote that check the code, or just make an assumption? Human intuition about probabilities is usually completely wrong.

Edited: 2018-02-22, 08:38

Busy indexing nil values

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 1420
Ranking
One Elder of Players
Location: GER
Posted at: 2018-02-22, 19:11

GunChleoc wrote:

OK, you've convinced me that my ideas was not good. Let's do something on the lines of changing the skip conditions instead as suggested by you and teppo.

Okay face-smile.png

Are you sure? I thought that the lines with "mine" will cancel the program, not the whole cycle of programs. Canceling a program usually doesn't cancel the cycle, but the next program will run...

That's true.

Okay, that's surprising me.... And I still don't believe it:

I made a little experiment now; build a crystal mine in an area where it couldn't find stone resources and let it run, controlling that it has never a resource shortage and that all economy settings were always much higher than stock. (in build 19)

My observation: The crystal mines found many stones and diamonds, but not a single quartz. That's almost a prove for my thesis face-wink.png

Otherwise, trainingsites would have a big problem...

Oops, I forgot trainingsites. You're right about them. But they are working different to productionssites, I guess...

teppo wrote:

WorldSavior wrote:

If the first program fails (95% odds after trying on depleted mine), the next steps are not considered.

Are you sure? I thought that the lines with "mine" will cancel the program, not the whole cycle of programs. Canceling a program usually doesn't cancel the cycle, but the next program will run...

Not sure. I have read the associated code, but that was long ago. Then, the miner only gained experience if all mining steps succeeded in the same cycle. This made training Empire miners in resource-poor areas difficult. The code has been changed since then, and this feature might have changed too.

However, if the steps are no longer coupled, then I do not understand why the odds of a success in depleted mines would be significantly below 5%.

I think I understand why. Let's take a look at a part of the quartz program:

"consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",

        "animate=working 20000",

        "mine=stones 4 100 5 2",

        "produce=granite:2",

        "animate=working 20000",

        "mine=stones 4 100 5 2",

        "produce=granite quartz",

At the line with "mine", the probability that the next line will follow is 5%. But then it produces 2 granite, doesn't it? After this, there is another line with "mine", so the probability that the line with "produce quartz" will be reached is (5%)².

GunChleoc wrote:

I'd have to dig deeper into the code to try to understand when workers gain experience, but when mining and the mining fails, there is still a random chance that they will gain experience anyway.

Isn't it also another bug that a miner doesn't get experience if he finds nothing?

teppo wrote:

However, if the steps are no longer coupled, then I do not understand why the odds of a success in depleted mines would be significantly below 5%.

Did the person who wrote that check the code, or just make an assumption? Human intuition about probabilities is usually completely wrong.

I checked the code and tested what happens in the game.

By the way: Probabilities of (most) mines are bugged. For example, I don't think that a depleted atlantean iron mine has got 5% efficiency when running, but rather 1 or 2 %. This is what the code says.


“It's a threat to our planet to believe that someone else will save it.” - Robert Swan

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1502
Ranking
One Elder of Players
Posted at: 2018-02-22, 20:37

I'm missing most of this code discussion, but quartz and diamond are the only resources that do not have 5% chances of being produced. it should be possible to produce them with a 5% chance.


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 1420
Ranking
One Elder of Players
Location: GER
Posted at: 2018-02-22, 21:48

king_of_nowhere wrote:

I'm missing most of this code discussion, but quartz and diamond are the only resources that do not have 5% chances of being produced.

Are you sure?

While barbarian iron mines need 20 times more resources when depleted, atlantean iron mines need 50 or 100 times more. I don't think that this is how it was intended... And it's not fair.


“It's a threat to our planet to believe that someone else will save it.” - Robert Swan

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3105
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-23, 08:25

WorldSavior wrote:

Are you sure? I thought that the lines with "mine" will cancel the program, not the whole cycle of programs. Canceling a program usually doesn't cancel the cycle, but the next program will run...

That's true.

Okay, that's surprising me.... And I still don't believe it:

I made a little experiment now; build a crystal mine in an area where it couldn't find stone resources and let it run, controlling that it has never a resource shortage and that all economy settings were always much higher than stock. (in build 19)

My observation: The crystal mines found many stones and diamonds, but not a single quartz. That's almost a prove for my thesis face-wink.png

Since the first program in the list doesn't produce any diamonds whatsoever, this actually disproves your thesis that only the first program is executed.

WorldSavior wrote:

Otherwise, trainingsites would have a big problem...

Oops, I forgot trainingsites. You're right about them. But they are working different to productionssites, I guess...

They are productionsites with an extra soldiers tab. So, they work exactly the same face-wink.png

WorldSavior wrote:

I think I understand why. Let's take a look at a part of the quartz program:

"consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",

        "animate=working 20000",

        "mine=stones 4 100 5 2",

        "produce=granite:2",

        "animate=working 20000",

        "mine=stones 4 100 5 2",

        "produce=granite quartz",

At the line with "mine", the probability that the next line will follow is 5%. But then it produces 2 granite, doesn't it? After this, there is another line with "mine", so the probability that the line with "produce quartz" will be reached is (5%)².

Then the solution would be to reorder the produce statements to have the precious stones on top.

WorldSavior wrote:

GunChleoc wrote:

I'd have to dig deeper into the code to try to understand when workers gain experience, but when mining and the mining fails, there is still a random chance that they will gain experience anyway.

Isn't it also another bug that a miner doesn't get experience if he finds nothing?

I don't really like how this is hard-coded. Maybe we should add a program for this that can be tweaked in the Lua init files.


Busy indexing nil values

Top Quote