Topic: tree planting locations

einstein13
Avatar
Joined: 2013-07-29, 00:01 UTC+2.0
Posts: 1116
Ranking
One Elder of Players
Location: Poland
Posted at: 2016-04-25, 09:23 UTC+2.0

king_of_nowhere wrote:

I still say that I like the system as it is now. Sometimes I make a forester near a mountain and I have to fill the space with roads to force the forester to only plant where I want, and that's something I like. it's part of the strategy.

Yes, I like current system too. You have to think a bit and learn something to be an experienced player.

I can agree for a one solution: the probability of planting a tree somewhere can be dependent on probability of grow on that terrain. So if there is a terrain with probability of grow less than 10%, it can be dug very rarely by a forester.

DragonAtma:

Technically, I've done that XD Project Greenwall: (...)

We can't prohibit any useful (and fair play) strategy. This one is very good for beginners, and can't be used if you prohibit planting trees on bad type terrain (f.e.: barren steppe).


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56 UTC+2.0
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-04-25, 12:46 UTC+2.0

Currently, the forester gets a list of the 6 trees that are most likely to grow, and then plants one of them (I haven't checked if there is a ranking for those 6 trees as well).

What makes the code complicated is that the forester will select a spot, then walk to the spot, and only then calculates which tree to plant. When the forester picks the spot, he doesn't know anything about the trees. So, with terrains where no tree will grow well, a low probability threshold will cause the forester to still go there and plant nothing.

This means that we will need to change how the spot gets picked. The easiest way to do so would be to add an attribute "treeless" to terrains where trees won't grow well. We can then add an option "avoid:treeless" to the spot-picking function.


Busy indexing nil values

Top Quote
DragonAtma
Avatar
Joined: 2014-09-14, 01:54 UTC+2.0
Posts: 351
Ranking
Tribe Member
Posted at: 2016-04-25, 21:58 UTC+2.0

I stand by previous statement to use "best tree" odds to help determine where to plant them. So a spot whose best tree is 80% is four times as likely to be picked as one whose best tree is 20%. And if that's not enough (say, mostly bad areas with a few fertile spots), square the numbers (so an 80% spot would be 16 times as likely as a 20% spot).

That way, they'll usually prefer good areas to plant, but won't completely shun areas with only a 20% success rate.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56 UTC+2.0
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-04-26, 08:52 UTC+2.0

Maybe we can use a mix of both approaches - my approach takes less calculations in the code, and will also allow us to have true "treeless" terrain tags in the editor. Your approach will make the Foresters more efficient, which is also a good thing.


Busy indexing nil values

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35 UTC+2.0
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-04-26, 15:10 UTC+2.0

the question is, do we really want to put that much effort into such a small matter? as i understand it, doing any of those ideas would require rewriting much of the forester's code. all for something that would not affect a strong player and would only make the game a bit easier for a new player.


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01 UTC+2.0
Posts: 1116
Ranking
One Elder of Players
Location: Poland
Posted at: 2016-04-26, 16:56 UTC+2.0

easier?

as DragonAtma said, there is a defensive strategy based on foresters planting trees on the border. For very beginners it will be a much harder to defend that way.

For moderate* players it will be much easier. They will have (almost) no rules to remember about foresters & terrain types.

'*' - is it a good word about players who are not beginners any more and they aren't experts yet?

Edited: 2016-04-27, 10:00 UTC+2.0

einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
teppo

Joined: 2012-01-30, 09:42 UTC+1.0
Posts: 425
Ranking
Tribe Member
Posted at: 2016-04-26, 19:58 UTC+2.0

einstein13 wrote:

I can agree for a one solution: the probability of planting a tree somewhere can be dependent on probability of grow on that terrain. So if there is a terrain with probability of grow less than 10%, it can be dug very rarely by a forester.

I like the idea of einstein13 and DragonAtma. The forester would still always go somewhere and plant something, and avoid the marginal land whenever possible.

GunChleoc wrote:

Maybe we can use a mix of both approaches - my approach takes less calculations in the code, and will also allow us to have true "treeless" terrain tags in the editor. Your approach will make the Foresters more efficient, which is also a good thing.

Does the code have to be heavy? The terrain does not change and therefore the probabilities do not change over time. There are only so many spots within the working radius of a single forester. One could stamp the probability to each slot when the forester's hut is built (or when the map is loaded - the numbers should be the same for all tribes, as all foresters can plant all trees). Only the selection of slot to walk to should be altered a bit.

One-time calculations at the beginning of a game (or during the initialization of a new production site) should not be of concern.

(I haven't checked if there is a ranking for those 6 trees as well).

There is, or at least has been.

king_of_nowhere wrote:

the question is, do we really want to put that much effort into such a small matter? as i understand it, doing any of those ideas would require rewriting much of the forester's code. all for something that would not affect a strong player and would only make the game a bit easier for a new player.

Widelands is made by volunteers. If somebody invests his/her time and makes the change, then I see problems only if the game gets worse.

Edited: 2016-04-26, 20:08 UTC+2.0

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56 UTC+2.0
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-04-27, 10:50 UTC+2.0

einstein13 wrote:

For moderate* players

'*' - is it a good word about players who are not beginners any more and they aren't experts yet?

One would say "Intermediate". Don't ask me why face-tongue.png

teppo wrote:

Maybe we can use a mix of both approaches - my approach takes less calculations in the code, and will also allow us to have true "treeless" terrain tags in the editor. Your approach will make the Foresters more efficient, which is also a good thing.

Does the code have to be heavy? The terrain does not change and therefore the probabilities do not change over time. There are only so many spots within the working radius of a single forester. One could stamp the probability to each slot when the forester's hut is built (or when the map is loaded - the numbers should be the same for all tribes, as all foresters can plant all trees). Only the selection of slot to walk to should be altered a bit.

The terrain can be changed by scripting (Atlantean Scenario, Trident of Fire). While it isn't relevant for these 2 scenarios, we cannot know which ideas some scenario designer might come up with in the future. So, for each node, we will have to grab the probability to grow for each tree on the fly, which depends on the 6 terrains surrounding the node.

What we could calculate in advance is is the probability to grow for each terrain - we could put that into a trees x terrains matrix. So, we have an efficiency/memory tradeoff here - I don't know which way would be better. The calculation won't be as heavy as for example pathfinding or economy routing, so I wouldn't worry about it.

Widelands is made by volunteers. If somebody invests his/her time and makes the change, then I see problems only if the game gets worse.

The real problem here is that we haven't agreed on what "worse" is yet in this case. So, anything we code here needs to be what we actually want. From the discussion so far, a ranking of the planting location according to the probability to grow seems best.

Edited: 2016-04-27, 10:53 UTC+2.0

Busy indexing nil values

Top Quote
Tibor

Joined: 2009-03-23, 23:24 UTC+1.0
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-04-27, 11:58 UTC+2.0

Just small comment to the coding point of view. Rangers share the same code with other similar workers, as defined in init.lua files, see the particular line from the files

fishbreeder: "findspace size:any radius:7 breed
fisher: "findspace size:any radius:7 resource:fish",
forester: "findspace size:any radius:5 avoid:field",
blackroot_farmer: "findspace size:any radius:2",
farmer: "findspace size:any radius:2",
gamekeeper: "findspace size:any radius:3",
fisher: "findspace size:any radius:7 resource:fish",
gardener: "findspace size:any radius:1",
ranger: "findspace size:any radius:5 avoid:field",
farmer: "findspace size:any radius:2 space",
vinefarmer: "findspace size:any radius:1",
fisher: "findspace size:any radius:7 resource:fish",
forester: "findspace size:any radius:5 avoid:field",
farmer: "findspace size:any radius:2 space",

So we would need to create separate "code path" for rangers....


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35 UTC+2.0
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-04-27, 14:35 UTC+2.0

GunChleoc wrote:

The real problem here is that we haven't agreed on what "worse" is yet in this case. So, anything we code here needs to be what we actually want. From the discussion so far, a ranking of the planting location according to the probability to grow seems best.

yes, i think that would be a good compromise between those that would not want trees to be planted on some spots and those who would want trees to be planted everywhere with the same probability. probably the forester could calculate the probability of growth on all the land when it's built and store it in memory, since the land is not going to change. though that may cause bugs with the atlantean campaign, since the land is actually going to change in it.


Top Quote