widelands icon indicating copy to clipboard operation
widelands copied to clipboard

WIP: Update performance helptext for farm-like buildings

Open bunnybot opened this issue 1 year ago • 9 comments

palinoMirrored from Codeberg Created on Thu Feb 15 14:47:55 CET 2024 by Pavol Gono (palino)


Type of change Fix and add missing performance help texts in lua scripts. Subtask of https://github.com/widelands/widelands/issues/5268 First ideas here: https://github.com/widelands/widelands/pull/6068

Now I want to focus on farm-like buildings.

Initial proposal is for atlantean farm as an example (the same timings are for barbarian and empire farms). Not sure if 5 nearest fields is the correct number here.

First describing average calculation for single farm without nearby obstacles on flat terrain. Additionally describing the ideal (fastest) case and providing info how many fields need to remain free.

Alternative 1: describing ideal and worst cases, like for small outdoor buildings

  • I don't like it because worst case is highly improbable to achieve
  • average case can be easily calculated exactly (except maybe Frisian Fruit Collector)

Alternative 2: changing logic of "walk=coords" algorithm to use one of nearest possible fields instead of random field of working area

Advantages:

  • removes need of silly micromanagement (building artificial roads on the "bad" spots of farm work area) to have high-performance farms
  • it is then enough to describe ideal cases in performance helptexts

Disadvantages:

  • considerably changes logic of other workers too (like fishers and foresters)
  • (I am not able do this change alone)

Question

What I am missing is understanding how often the field states change. tiny -> small -> medium -> ripe After few measurements, these 3 transitions together took between 75 sec - 189 sec What is the possible time range here? The files data/tribes/immovables/cornfield/*/init.lua contain certain durations, but I am not sure if they are used at all.

bunnybot avatar Feb 15 '24 13:02 bunnybot

tothxaMirrored from Codeberg On Thu Feb 15 15:19:40 CET 2024, Tóth András (tothxa) wrote:


Alternative 1: describing ideal and worst cases, like for small outdoor buildings

I'm clearly for this.

  • I don't like it because worst case is highly improbable to achieve

Why? It's actually harder to make sure farmers can't use the farther fields than the closer ones. Don't forget that farms are big buildings, blocking 4 fields themselves, plus the flag. Most farms also have a workarea radius of only 2, which is measured from the main field of the building, but the worker always goes first to the flag, so this is much worse for farms than e.g. foresters.

  • average case can be easily calculated exactly (except maybe Frisian Fruit Collector)

IIRC I've presented the possible worst and best cases (also considering number of growing fiels needed for 100% performance) in the other PR's discussion, and they were different.

Question

What I am missing is understanding how often the field states change. After few measurements, these 3 transitions together took between 75 sec - 189 sec What is the possible time range here? The files data/tribes/immovables/cornfield/*/init.lua contain certain durations, but I am not sure if they are used at all.

I can't see how anything else could affect this... How do the times from the init.luas compare to your measurements?

bunnybot avatar Feb 15 '24 14:02 bunnybot

palinoMirrored from Codeberg On Thu Feb 15 17:02:48 CET 2024, Pavol Gono (palino) wrote:


Adding image of number of steps here, as I didn't do it properly first time (still learning how to use codeberg) farm.png

Alternative 1: describing ideal and worst cases, like for small outdoor buildings

I'm clearly for this.

  • I don't like it because worst case is highly improbable to achieve

Why? It's actually harder to make sure farmers can't use the farther fields than the closer ones. Don't forget that farms are big buildings, blocking 4 fields themselves, plus the flag. Most farms also have a workarea radius of only 2, which is measured from the main field of the building, but the worker always goes first to the flag, so this is much worse for farms than e.g. foresters.

I understand your point. My first impression when starting playing widelands was, that I should leave as much as possible free fields near farms, to have best production. Blocking some of fields was unlogical for me at that time. Average value is suitable for average player. But no problem with reworking it to min+max.

  • average case can be easily calculated exactly (except maybe Frisian Fruit Collector)

IIRC I've presented the possible worst and best cases (also considering number of growing fiels needed for 100% performance) in the other PR's discussion, and they were different.

If you are reffering this: https://github.com/widelands/widelands/pull/6068#issuecomment-1804888486 the calculation is the same, just results are different because you used 6 fields in ideal case, me 5 fields. 6 fields: 4*2.33*1.8+6+6+10+10+4+4 = 56.776 sec 5 fields: 4*2.2 *1.8+6+6+10+10+4+4 = 55.84 sec

Question

What I am missing is understanding how often the field states change. After few measurements, these 3 transitions together took between 75 sec - 189 sec What is the possible time range here? The files data/tribes/immovables/cornfield/*/init.lua contain certain durations, but I am not sure if they are used at all.

I can't see how anything else could affect this... How do the times from the init.luas compare to your measurements?

So particular state changes (watching both as atlantean and barbarian):

tiny->small according to script: "animate=idle duration:30s" measured values: 33, 35, 41, 42, 22, 39 and 17 sec

small->medium according to script: "animate=idle duration:45s" measured values: 60, 51, 78, 19, 58 and 43 sec

medium->ripe according to script: "animate=idle duration:50s" measured values: 89, 39, 14, 53, 25, 96 and 46 sec

bunnybot avatar Feb 15 '24 16:02 bunnybot

tothxaMirrored from Codeberg On Thu Feb 15 18:38:45 CET 2024, Tóth András (tothxa) wrote:


the calculation is the same, just results are different because you used 6 fields in ideal case, me 5 fields.

Oh, sorry, I meant single field min/max, just like we did for small buildings. Doing it differently would be just confusing.

small->medium according to script: "animate=idle duration:45s" measured values: 60, 51, 78, 19, 58 and 43 sec

That certainly needs investigation...

bunnybot avatar Feb 15 '24 17:02 bunnybot

NordfrieseMirrored from Codeberg On Thu Feb 15 18:48:31 CET 2024, Benedikt Straub (Nordfriese) wrote:


When herbivore animals move onto a node with something tasty on it, they eat some of it, delaying the next growth of that field (or tree sapling, deer only) by several seconds.

bunnybot avatar Feb 15 '24 17:02 bunnybot

NordfrieseMirrored from Codeberg On Thu Feb 15 18:53:40 CET 2024, Benedikt Straub (Nordfriese) wrote:


Alternative 2: changing logic of "walk=coords" algorithm to use one of nearest possible fields instead of random field of working area

Cautious +1 from me, could be handled with a new parameter to findspace that would be set for farms but not for other uses (fisher, forester etc). Or better IMHO, we could make the strength of the bias dependent on radius, so that findspace with a small radius (farms) greatly prefers nearby fields while findspace with a higher radius (forester, fisher) has only a very mild bias for closer fields.

bunnybot avatar Feb 15 '24 17:02 bunnybot

tothxaMirrored from Codeberg On Thu Feb 15 22:49:07 CET 2024, Tóth András (tothxa) wrote:


Or better IMHO, we could make the strength of the bias dependent on radius, so that findspace with a small radius (farms) greatly prefers nearby fields while findspace with a higher radius (forester, fisher) has only a very mild bias for closer fields.

That sounds backwards...

BTW the workarea radius is counted from the main field of the building, but walking distance counts from the flag. Does findspace consider that?

bunnybot avatar Feb 15 '24 21:02 bunnybot

palinoMirrored from Codeberg On Thu Feb 15 23:04:35 CET 2024, Pavol Gono (palino) wrote:


When herbivore animals move onto a node with something tasty on it, they eat some of it, delaying the next growth of that field (or tree sapling, deer only) by several seconds.

The corn fields with following times were measured on map without animals tiny->small measured values: 33, 35, 41, 42, 22 small->medium measured values: 60, 51, 78, 19 medium->ripe measured values: 89, 39, 14, 53 So the variance is caused by something else.

How big is delay of field growth after eating of herbivore?

bunnybot avatar Feb 15 '24 22:02 bunnybot

palinoMirrored from Codeberg On Fri Feb 16 15:50:45 CET 2024, Pavol Gono (palino) wrote:


Alternative 1: describing ideal and worst cases, like for small outdoor buildings

I'm clearly for this.

Proposal for text of min/max alternative:

The farmer sows and harvests one sheaf of corn between 56 seconds and 1 minute and 15 seconds, depending on how far the corn fields are from the building's flag. The highest speed can be achieved if you leave 5 fields near the flag free and other fields of work area occupied, e.g. by roads and buildings.

Original proposal was:

The farmer needs 1 minute and 4 seconds on average to sow and harvest a sheaf of corn. It is possible to decrease time to 56 seconds on average, if you leave 5 fields near the flag free and other fields of work area occupied, e.g. by roads and buildings.

Optional middle sentence (for both cases):

In case of slopes in the way or fewer than 5 free fields, the time is increased.

bunnybot avatar Feb 16 '24 14:02 bunnybot

tothxaMirrored from Codeberg On Sat Feb 17 01:10:56 CET 2024, Tóth András (tothxa) wrote:


Proposal for text of min/max alternative:

The farmer sows and harvests one sheaf of corn between 56 seconds and 1 minute and 15 seconds, depending on how far the corn fields are from the building's flag.

OK, or you could just use "how far the farmer has to walk" like the previous ones.

The highest speed can be achieved if you leave 5 fields near the flag free and other fields of work area occupied, e.g. by roads and buildings.

I'm not sure whether we should include such game tips in the performance texts, or just say that "The farm needs at least 5 growing fields to achieve 100% productivity."

Optional middle sentence (for both cases):

In case of slopes in the way or fewer than 5 free fields, the time is increased.

Maybe we could omit slopes for most farms which can only be built on near-level terrain. Repeating the optimal number of fields is redundant IMO.

bunnybot avatar Feb 17 '24 08:02 bunnybot