Barbarian weaving mill produces endless cloth

Bug #988870 reported by wl-zocker
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Wishlist
Unassigned
widelands (Debian)
Fix Released
Unknown

Bug Description

The Barbarian weaving mill checks only if enough thatch reed is in the economy, not if cloth is needed. As the default target quantity of thatch reed is 1, one can easily run out of it when some buildings are built simultaneously.

I suggest to set the default target quanity of both thatch reed and cloth to 10 (so that one always has some of it if one wants to build a building or a ship) and to add a line "return=skipped unless economy needs cloth" to the weaving mill's conf file.

Related branches

Revision history for this message
Nasenbaer (nasenbaer) wrote :

sounds like a reasonable suggestion. :)

Changed in widelands:
status: New → Confirmed
importance: Undecided → Wishlist
milestone: none → build18-rc1
Revision history for this message
Angelo Locritani (alocritani) wrote :

just to be precise, at the moment the line says:
return=skipped when economy needs thatchreed and not economy needs cloth

so in that case if you have enough thatchreed and enough cloth, production will continue indefinitely.
Production will stop only if you have enough cloth but not enough thatchreed.

Rising the default target quantity seems ok to me, because it gives you a safe margin for building buildings.

Are you suggesting to add another "return" line? Is it possible to have more than one return line?
Or to change it?

In case of change, I suggest to keep the "economy needs thatchreed" part and so:
return=skipped unless economy needs cloth or economy needs thatchreed

Is this correct? will it be parsed as "skipped (unless economy needs cloth) or (economy needs thatchreed)"
or will it be parsed like "skipped unless (economy needs cloth or economy needs thatchreed)" ?

Revision history for this message
wl-zocker (wl-zocker) wrote :

I have found the following:

The Atlantean coal mine says:
return=skipped when economy needs bread and not economy needs coal
return=skipped when economy needs smoked_fish and not economy needs coal

In the Barbarian micro-brewery's conf file is written:
return=skipped unless economy needs beer or workers need experience

It is parsed as "skipped unless (economy needs beer or workers need experence), so beer is produced if the economy needs beer of if the workers need experience.

So: Several return lines are possible. But it can also be written in one line, which should work too. (At least I hope I got it right.)

Revision history for this message
Angelo Locritani (alocritani) wrote :

thanks for checking!
so on one line it should be
"return=skipped unless economy needs cloth and not economy needs thatchreed"
right?

in other words:
skip always but not when you need cloth and at the same time you don't need thatchreed.
if you need thatchreed, skip
if you do not need cloth, skip

This is "how to do" it, but let's see "if" we want to do it.

Time ago, I've opened a similar topic here: http://wl.widelands.org/forum/topic/922/ where I found that the same behavior you describe is valid for cattle farm, too.

It seems there is more logic than it may appear at first look, but I've not got it yet :)

Revision history for this message
wl-zocker (wl-zocker) wrote :

The way it is described in the forum topic, it makes no sense. On the one hand, ixprefect says that water is an endless ressource that can be "wasted" by creating hundreds of oxen. On the other hand, he says that water should stored "because later in the game your consumption might go faster than production".

In case of the thatch reed, it is not that tragic: It is only used as a building material and not as a permanently used ware (as wheat and water to create bread).

Nevertheless, I think both should be fixed. If the player has a high default target quantity (e.g. 10 or 20), he always has a stock that can be used (equal whether oxen, thatch reed or cloth). If he uses one of those wares, it will be immediatly replaced because the producing building is full of the ressource it needs. I cannot imaginge a scenario where 20 of a ware are not enough.

If others agree, we should still check whether other buildings (not only Barbarian ones) also waste wares because the are endless (but are needed by other buildings).

Revision history for this message
wl-zocker (wl-zocker) wrote :

I was wrong about the return logic: A comination of "unless" and "and" seems not possible. So I have replaced the existing return line by the following two:
return=skipped when economy needs thatchreed
return=skipped unless economy needs cloth

First, the weaving mill checks whether the economy needs thatch reed. If there is too little, it will skip.
If the economy has enough cloth, it will skip too.

I have seperated the "economy needs thatchreed" part from the "not economy needs cloth" part because I think that if both are missing, no cloth should be produced (I consider thatch reed to be more important).

Nevertheless, the default target quantity should be changed. I think 20 thatch reed and 20 cloth are a good values, then the player always has at least 20 of both in his stock, which should be enough.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Might be off-topic, but I wonder whether the underlying issue here might also be related to bug 680209 and perhaps http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=671720 (or the first half of it, as it seem to describe two bugs).

Revision history for this message
wl-zocker (wl-zocker) wrote :

You are right, these buildings (mines and carrier animal farms) have conditions like: "return=skipped when economy needs <input> and not economy needs <output>". I guess this is when the input is infinite so that the player never should lack of it. But this way leads to the described behaviors:
- Too few thatch reed if the target quantity is too low
- Other mines do not get enough food if the player has many coal mines (e.g.) and too few taverns (or whatsoever)
- No water and wheat are stored, but useless carriers are created

Other buildings, where the input resource is limited (e.g. all smithies) have a condition like: "return=skipped unless economy needs <output>". With this condition, a ware is only created if it is needed to fulfill the economy request, but then in every case. This might lead to problems that cloth is produced (and therefor thatch reed is consumed) although the thatch reed would be needed for buildings. But I do no think that this is as critical as the other option because as soon as one has enough cloth, the thatch reed will be available for other projects.

Revision history for this message
Shevonar (shevonar) wrote :

Following wl-zockers analysis I think the bug is that it shoul be "return=skipped when economy needs <input> OR not economy needs <output>" instead of AND. With and the condition will be true in very few cases so the production is infinite. With OR it makes much more sense.

tags: added: economy
Changed in widelands (Debian):
status: Unknown → New
Revision history for this message
_aD (ad-simplypeachy) wrote :

The Empire's Mill produces endless quantities of flour. It would be useful if it adhered to target quantities.

Changed in widelands (Debian):
status: New → Fix Released
Revision history for this message
cghislai (charlyghislain) wrote :

According to the comment in production_program.h:
 /// when_condition:
 /// This will cause the program to return when all conditions are
 /// true.
 /// unless_condition:
 /// This will cause the program to return unless some condition is
 /// true.

I guess all 'skipped when economy needs <input> and not economy needs <output>' could be replaced by 'skipped unless economy needs <output> or not economy needs <input>'.

Revision history for this message
Nasenbaer (nasenbaer) wrote :

@#11 seems right to me, but that would lead to the exact same behaviour as before, wouldn't it?

In general I guess we think to complex concerning the barbarian weaving mill.

What we want is, that the weaving mill does not eat up all thatchread to ensure, there is always some thatchreed left for construction sites.

in #6 wl-zocker proposes:
return=skipped when economy needs thatchreed
return=skipped unless economy needs cloth

which basically fits the needs, but additionally stops production if no cloth is needed. I would either go that way or simply return=skipped when economy needs thatchreed

However the real goal would be to do something like
return=skipped when economy needs thatchreed
return=skipped when stored cloth > stored thatchreed

But thats something I would move to a new wishlist item.

So let us go
return=skipped when economy needs thatchreed
return=skipped unless economy needs cloth

and finally close this bug :)?

Revision history for this message
Nasenbaer (nasenbaer) wrote :

ahhh almost forgot ... same should of course be implemented for the cattle/horse/dokey farms (see dublicate bugs)

Revision history for this message
wl-zocker (wl-zocker) wrote :

Please do not forget to add a default_target_quantity to the wares (e.g. 20 for thatch reed and clothes, and maybe 20 or 30 for wheat/corn and water).

Revision history for this message
cghislai (charlyghislain) wrote :

The two-lines conditions will behave exactly the same as the one-line unless/or conditions The one-line item has the advantage to be more easily changed back with a script that parses files, although maybe a bit harder o grasp.
I'll check ware quantities and suggest the merge

Nasenbaer (nasenbaer)
Changed in widelands:
status: Confirmed → Fix Committed
Revision history for this message
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.