Topic: tree planting locations

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, 18:48 UTC+2.0

king_of_nowhere wrote:

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.

And possible future scenarios/campaigns.... by that time, we will have forgotten this discussion and wonder where the bugs come from... so, storing the terrain properties in memory is a bad idea. We already have a bug related to terrain change, let's not add to them face-wink.png


Busy indexing nil values

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, 18:54 UTC+2.0

Tibor wrote:

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

<snip>

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

I seem to remember that there was an idea somewhere to give tribe immovables like fields terrain affinity as well - I can't find it right now though. So, when we implement something here, we should make it global enough to fit that too.


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, 19:28 UTC+2.0

GunChleoc wrote:

Tibor wrote:

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

<snip>

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

I seem to remember that there was an idea somewhere to give tribe immovables like fields terrain affinity as well - I can't find it right now though. So, when we implement something here, we should make it global enough to fit that too.

good comment, but it will not be straightforward to code though


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-28, 07:46 UTC+2.0

I can imagine new attribute 'consider' for lua config, the line would look like:

forester: "findspace size:any radius:5 avoid:field consider:fertility"

And poor man implementation would be to pick x (f.e. 5) random fields, and from them pick one with best fertility/whatever.


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48 UTC+1.0
Posts: 2657
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2016-04-28, 08:51 UTC+2.0

GunChleoc wrote:

I seem to remember that there was an idea somewhere to give tribe immovables like fields terrain affinity as well - I can't find it right now though.

It is this bug

Such an implementation has to be considered well. IMHO it would bring more complexity but less fun. Remembering all the problems with the trees until now, making terrain affinities for tribe immovables would cause similar problems, beginning with the editor (f.e restrictions about placing terrain in conjunction with build size/height of terrain).

Just a side note, back to topic face-smile.png


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-28, 08:56 UTC+2.0

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.

Edited: 2016-04-28, 08:57 UTC+2.0

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-28, 09:05 UTC+2.0

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).


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-28, 09:31 UTC+2.0

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", or pick a filed that "grows:sapling" the best (has highest fertility/whatever number for saplings)


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-28, 09:34 UTC+2.0

For me calculating 5 (or less) possible spots and pick randomly one of them (according to their fertility) is one of the best idea here. It will bring all approaches to the problem: less trees will die before being mature; but you can still make a green wall of defence; also it will avoid possible bugs on terrain change (scenarios). I like the idea very much! face-smile.png


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

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-28, 09:43 UTC+2.0

einstein13 wrote:

For me calculating 5 (or less) possible spots and pick randomly one of them (according to their fertility)

Just be more precise, not "randomly", but the one with best number (fertility)


Top Quote