Latest Posts

Topic: tree planting locations

GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-04-28, 10:46

DragonAtma wrote:

Why not have them recalculate nearby land when they go out to plant a tree? Foresters only go out once every half-minute or so, so that should not be a slowdown, and it'll correct for scripted terrain change (except, of course, for the rare nearby changes that occur between when they leave the hut and plant the tree).

This is already what we're doing. The forester only searches for a spot when he goes out.

Tibor wrote:

GunChleoc wrote:

We can still keep the implementation flexible though, in case we ever want it. Whether or not it is used can then be decided entirely by the lua files, which will also allow easy modding.

I was thinking of something like

~~~~ forester: "findspace size:any radius:5 avoid:field grows:sapling" blackroot_farmer: "findspace size:any radius:2 grows:blackroot_field", ~~~~

Then work with attributes on the immovables to filter which immovables are filtered for probability to grow, rank them and use that as the field's ranking.

Well, still the basic question is: will we pick random field that meets condition like "grows:sapling",

This is what we're already doing right now (except that we have no probability threshold)

or pick a filed that "grows:sapling" the best (has highest fertility/whatever number for saplings)

This would be the change we want.


Busy indexing nil values

Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-04-28, 10:49

GunChleoc wrote:

Well, still the basic question is: will we pick random field that meets condition like "grows:sapling",

This is what we're already doing right now (except that we have no probability threshold)

Be more precise, now we just search for empty field (field as a space)


Top Quote
teppo

Joined: 2012-01-30, 08:42
Posts: 423
Ranking
Tribe Member
Posted at: 2016-04-28, 16:43

GunChleoc wrote:

The terrain can be changed by scripting (Atlantean Scenario, Trident of Fire).

This is not really a problem.

So, we have an efficiency/memory tradeoff here - I don't know which way would be better.

In my experience, WL runs out of CPU before running out of memory. At least on small and medium sized maps.

The calculation won't be as heavy as for example pathfinding or economy routing, so I wouldn't worry about it.

There are more than one way to do it.

The real problem here is that we haven't agreed on what "worse" is yet in this case.

That is a real problem.

Tibor wrote:

fishbreeder: "findspace size:any radius:7 breed

fisher: "findspace size:any radius:7 resource:fish",

forester: "findspace size:any radius:5 avoid:field",

[more lines like this]

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

Not really. Fishers and fishbreeders would benefit, too. Maybe even farmers in the distant future, if somebody makes terrain affinities for all the crops. I suppose that the code could be written so that the other workers are not harmed (but did not do any reading before writing this).


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-04-29, 07:34

teppo wrote:

I suppose that the code could be written so that the other workers are not harmed (but did not do any reading before writing this).

Yes it could, no problem. This will be an optional parameter, and whether it's used will depend entirely on the lua init files.


Busy indexing nil values

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-04-29, 16:12

i just realized something. someone mentioned - if i understood correctly - that a forester will pick randomly one of the six trees with the best chance to grow on the terrain. that means some terrains are actually much less fertile than they are meant to be. for example, desert meadow is supposed to be the most fertile desert place, and in fact palm roystonea has 100% of growing there. But, since other desert trees are adapted for drier places, it means the second most favorable tree has only a 40% chance. The sixth more likely plant only has 28%. So, it means meadow is actually rather infertile, with only 50% chance of growing a tree planted by a forester.

If the forester can already calculate the growth probability, it should choose more smartly than that. I don't say that it should always choose the best tree, because we want some variability. but maybe it should not choose trees that have less than half the chance of the best tree?

unless the forester does not pick with random chances but rather it is more likely to choose the best trees, so that would be fine too.


Top Quote
teppo

Joined: 2012-01-30, 08:42
Posts: 423
Ranking
Tribe Member
Posted at: 2016-04-29, 18:41

king_of_nowhere wrote:

If the forester can already calculate the growth probability, it should choose more smartly than that. I don't say that it should always choose the best tree, because we want some variability. but maybe it should not choose trees that have less than half the chance of the best tree?

Currently, the probability of picking a tree is weighted by the square of its growth probability. In your example, there would be about thirteen of the best trees for each 6th best one.

If the forester would only pick the best tree, then the map would look rather boring. This way, there are still eye candies and the overall the selection of trees is decent.

Edited: 2016-04-29, 18:43

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-04-29, 21:08

teppo wrote:

Currently, the probability of picking a tree is weighted by the square of its growth probability. In your example, there would be about thirteen of the best trees for each 6th best one.

If the forester would only pick the best tree, then the map would look rather boring. This way, there are still eye candies and the overall the selection of trees is decent.

oh, ok, wheighted probability is fine.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-04-30, 16:31

Thanks for looking that up, teppo.


Busy indexing nil values

Top Quote
teppo

Joined: 2012-01-30, 08:42
Posts: 423
Ranking
Tribe Member
Posted at: 2016-05-02, 14:18

GunChleoc wrote:

Thanks for looking that up, teppo.

What do we want to do with this issue? Who draws the conclusion?

I still like the minimally invasive solution where forester simply would not plant the no-grow trees: almost trivial to implement. However, I have the feeling that that does not gain wide acceptance. The next best way would, in my opinion, to be a weight in slot choice: Hopeless terrains would be visited less often, but still a >0 probability, and the forester always attempts to plant a tree into a slot he visits. I would like to cache the probabilities instead of recalculating them over. This of course would couple this issue with the unsolved bug regarding very infrequent but still existing terrain changes.

One bonus question: Should we also give the forester the ability to plant nearly-inpenetrable forests (=ones that never mature, and therefore acts as some sort of defence line)? Of course that would be "unnatural" if the aggressor would be unable to instruct his woodcutters to chop the no-log trees, too, but would add another aspect to the game.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-05-02, 15:24

I think the consensus so far is to rank the unoccupied fields by probability to grow. I think we can ponder more on caching possibilities once we have an actual implementation - things might just fall into place during the coding process.


Busy indexing nil values

Top Quote