Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update performance helptext for farm-like buildings #6362

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bunnybot
Copy link

@bunnybot bunnybot commented Feb 15, 2024

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 #5268
First ideas here: #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 bunnybot changed the title Update performance helptext for farm-like buildings WIP: Update performance helptext for farm-like buildings Feb 15, 2024
@bunnybot
Copy link
Author

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
Copy link
Author

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: #6068 (comment)
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
Copy link
Author

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
Copy link
Author

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.

Copy link
Author

@bunnybot bunnybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NordfrieseMirrored from Codeberg
On Thu Feb 15 18:55:14 CET 2024, Benedikt Straub (Nordfriese) commented.

-- TRANSLATORS: Performance helptext for an Atlantean production site: Farm, part 1
pgettext("atlanteans_building", "The farmer needs %1% on average to sow and harvest a sheaf of corn."):bformat(format_minutes_seconds(1, 4)),
-- TRANSLATORS: Performance helptext for an Atlantean production site: Farm, part 2
pgettext("atlanteans_building", "It is possible to decrease time to %1$s on average, if you leave %2$d fields near the flag free and other fields of work area occupied, e.g. by roads and buildings."):bformat(format_seconds(56), 5)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


%2$d fields needs an ngettext call

@bunnybot bunnybot added this to the v1.3 milestone Feb 15, 2024
@bunnybot
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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 bunnybot added ci:success CI checks succeeded and removed ci:success CI checks succeeded labels Apr 2, 2024
@bunnybot bunnybot added ci:success CI checks succeeded and removed ci:success CI checks succeeded labels May 1, 2024
@bunnybot bunnybot added ci:success CI checks succeeded and removed ci:success CI checks succeeded labels May 14, 2024
@bunnybot bunnybot added ci:success CI checks succeeded and removed ci:success CI checks succeeded labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:success CI checks succeeded
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants