Topic: tree planting locations
einstein13![]() |
Posted at:
2016-04-25, 09:23 UTC+2.0
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.
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 ![]() ![]() |
GunChleoc![]() |
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 ![]() ![]() |
DragonAtma![]() |
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. ![]() ![]() |
GunChleoc![]() |
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 ![]() ![]() |
king_of_nowhere![]() |
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. ![]() ![]() |
einstein13![]() |
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 ![]() ![]() |
teppo |
Posted at:
2016-04-26, 19:58 UTC+2.0
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.
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.
There is, or at least has been.
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
![]() ![]() |
GunChleoc![]() |
Posted at:
2016-04-27, 10:50 UTC+2.0
One would say "Intermediate". Don't ask me why
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.
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 ![]() ![]() |
Tibor |
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
![]() ![]() |
king_of_nowhere![]() |
Posted at:
2016-04-27, 14:35 UTC+2.0
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. ![]() ![]() |