Forester plants trees where probability to grow is nearly zero

Bug #1574379 reported by kaputtnik
32
This bug affects 7 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Low
Unassigned

Bug Description

On mountains and other type of terrains the probability for growing trees is nearly zero. This means that a tree planted by a forester will rarely grow until it is mature or old and could be cut by a woodcutter. A forester waste a lot of time with planting trees on terrains where probability of growing is nearly zero.

So an idea is to prevent the forester to plant trees where the probability to grow is less than X percent.

See also forum thread: https://wl.widelands.org/forum/topic/1956/

This isn't needed for build19

Tags: gameplay

Related branches

kaputtnik (franku)
Changed in widelands:
importance: Undecided → Low
Revision history for this message
GunChleoc (gunchleoc) wrote :

It's probably better to add an attribute to the mountain terrains so that the worker's findspace program can filter for it.

Changed in widelands:
status: New → Confirmed
Revision history for this message
GunChleoc (gunchleoc) wrote :
Revision history for this message
GunChleoc (gunchleoc) wrote :

The current consensus on the forum is to rank the fields by the highest probability to grow in the findspace program, e.g. by adding a parameter "grows:sapling". This should be configurable, e.g. in case we will want terrain affinity for fields in the future, and for modders.

summary: - Forester plants trees where probality to grow is nearly zero
+ Forester plants trees where probability to grow is nearly zero
kaputtnik (franku)
Changed in widelands:
milestone: none → build20-rc1
Revision history for this message
Teppo Mäenpää (kxq) wrote :

If the player elects to build a forester to places where only marginally usable land is present, the player could be in desperate need of wood.

Should the forester tune the threshold dynamically: If there are both good and poor spots around, the forester would mostly use the good soil. If all land is bad, he would still do something instead of nothing.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

I could do this, if skipping Release 20 is not a major upset to anybody. I might have time next week (or 6 months from now).

Revision history for this message
GunChleoc (gunchleoc) wrote :

Nobody is working on this right now, so we'd be glad if you took care of this bug whenever you find the time :)

Teppo Mäenpää (kxq)
Changed in widelands:
assignee: nobody → Teppo Mäenpää (kxq)
Revision history for this message
Teppo Mäenpää (kxq) wrote :

Would it be okay to assume that the tree growth probability of each spot remains constant over time?

Revision history for this message
kaputtnik (franku) wrote :

The Probability to grow is calculated for each node from the values defined for each type of terrain. So they don't change over time (e.g. during a game, if you mean that).

At least as long the current implementation don't change.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Not true - terrains can be changed by scripting, e.g. the Atlantean scenario when the water rises, or the lava in Trident of Fire. While these 2 cases don't matter, the engine does allow any other terrain change, so we need to support it.

Revision history for this message
kaputtnik (franku) wrote :

Didn't thought of scripting...

I shouldn't post to any tree related things :D

Revision history for this message
Teppo Mäenpää (kxq) wrote :

Is there a single piece of C++ that gets called when the terrain changes?

Revision history for this message
Teppo Mäenpää (kxq) wrote :

I now have a working implementation (if terrain changes are neglected). The code is so lousy that a complete rewrite is needed, though. In short: goal exists, and is easy to reach (but far away).

Changed in widelands:
status: Confirmed → In Progress
Revision history for this message
Teppo Mäenpää (kxq) wrote :

Attached a branch with a fix. Appears to work, but is not yet well tested even on my scale yet.

In the original bug description, a threshold was asked-for. Well, the fix is different. In the attached branch, the foresters prefers good soil, but occasionally also tries his luck with the less good one. In more details, the forester takes n free random spots from its work area, and uses the best of those.

There was a request in one of the duplicate tickets for non-equal performance between tribes, which is implemented here. Currently, Atlantean foresters are most careful and barbarian lumberjacks least. (technically: one can specify the n separately for each tribe).

The constants are not well-thought-of. I put a simple cache in there, as else the number of nested loops would have been big in my taste. As result, it is okay to use large values of n, without making planting too heavy. If any of you are in desperate need of more playing, try it out and give feedback here. Else, wait for the merge request button push.

Revision history for this message
kaputtnik (franku) wrote :

Can you make a merge request? Then we will get a appveyor windows build. Then i will post link in the forum thread and our users using windows can test also your branch :-)

Revision history for this message
Teppo Mäenpää (kxq) wrote :

Now the appveyor builds are done.

GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
assignee: Teppo Mäenpää (kxq) → nobody
Revision history for this message
Teppo Mäenpää (kxq) wrote :

No feedback on forum -> force-feeding to beta testers ;-)

Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-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.