Latest Posts

Topic: News about AI

hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2017-08-19, 18:31

What exactly are helper productionsites? How are they identified? I would be very pleased if you could explain this.
I always thought the AI is trying to build first the minimum amount of basic buildings and then start to build others but it is building more than the minimum amount for lumberjacks for example and not building the missing building. Did I get the intention wrong?
Another question is if the gamekeeper is really necessary as a basic building. If it is for basic food supply to be able to have mines supplying a toolsmith then why is the farm a basic building as well. I suggest to keep the basic buildings as short as they could be to reach basic economy establishes as fast as possible.
BTW: @ Tibor: did you have a look to my other suggetions for improving the AI performance? Especially the economy settings should grow with the area owned by AI. currently AI is building warehouses but does not store any "higher" material in it.


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-19, 18:51

hessenfarmer wrote:

What exactly are helper productionsites? How are they identified? I would be very pleased if you could explain this.

You can use any other word for these sites, but generally there are such that do not produce anything but supports other productionsites produce something, like ranger -> cutter -> log. They have own codepath in AI code, own scoring and so on

I always thought the AI is trying to build first the minimum amount of basic buildings and then start to build others but it is building more than the minimum amount for lumberjacks for example and not building the missing building. Did I get the intention wrong?

The issue here is score. AI was considering helpersites, but they got consistently too low score and other building won over them. This is what I am going to change in new branch.

Another question is if the gamekeeper is really necessary as a basic building.

I am also for as short list of basic buildings as possible - but lists were discussed here on forum and I dont intend to interfere here....

BTW: @ Tibor: did you have a look to my other suggetions for improving the AI performance? Especially the economy settings should grow with the area owned by AI.

There is function review_wares_targets() for this, and has been there for long time... maybe it needs a revision....

currently AI is building warehouses but does not store any "higher" material in it.

One of purposes of multiple warehouses is shortening transportation routes and provide some security for situation than one of warehouses is destroyed..


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-08-20, 11:28

I just approved the helper sites branch, so it should hit trunk soon.

I have just had another idea for the helper sites: Have an ai_hint for sites to define their helper sites. For example, atlanteans_fishers_house could have support_building="atlanteans_fishbreeders_house". The the AI could try not just to build the support building, but to build it as close as possible to the building that's being supported. At the moment, fish breeders can be a bit useless, because they can be built anywhere on the coast, but they need to be close to the fisher.


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-20, 18:08

No, no new hint is needed, AI is able to pair supporters and producers right now and is doing it.

When placing supporters (helpers), part of score is affected by nearby producers like here:

http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai.cc#L2593 http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai.cc#L2623

similarly when placing producers, the score reflects also supporters, like here:

http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai.cc#L2535 http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai.cc#L2554

Of course the binding is not strict, because that would bring more issues then benefit.


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2017-08-20, 18:26

In the training rounds with frisian AIs, I noticed two issues with helper sites:

  • AI often builds a berry farm but no fruit collector or bee-keeper, so the berry farm is completely useless

  • Aqua farms are built nowhere near a clay pit, so they can´t work. I don´t think it would be good to let the aqua farm get a hint "renews_map_resource=clay", but having the claypit "renews_map_resource=fish" would interfere with fishers houses. What hint should be set here?


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-20, 19:55

I am not familiar with frisian buildings and relations, but generally:

  • relationship (placing) of helper and actual productionsite is indeed weak
  • productionsite cannot have both - output(s) and renews_map_resource
  • productionsite can have only one item as renews_map_resource
  • multiple productionsites can have the same renews_map_resource

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-20, 21:18

I can imagine new ai_hint flag like:

requires_helper = true

that would build a productionsite only if there is at least one helper in vicinity... this could be quite easy and unobtrusive.

In regard to clay - is this new map resource like stone or water? AI then need some code to count it in vicinity of buildable fields and particular building would need hint similar like quarries have....


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-08-21, 10:49

The scoring is working and will be trained, it's just the positioning that I noticed.

Rather than waiting with a productionsite until the helper is finished, I'd say try to find a spot for 1 helper in the vicinity at the same time as the production site is placed, and place it immediately.

If you build the helper first, you might have trouble building a lumberjack if the gamekeeper already has spammed a lot of trees, for example.

The productionsite needs to know which helper belongs to it for this to work - if it already knows, no AI hint is needed. If it doesn't, the AI hint might as well contain the name of the helper building.


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-08-21, 11:32

But placing buildings in pairs is not implemented and would need quite a lot of coding... Right now a productionsite looks for resources (fish, trees, animals) and helper sites in vicinity are only additional bonus (= not required). If you place a lone ranger, over time there will be a lot of trees and lumberjack will be built in the vicinity. Animals migrate. Fish are bit different of course, but only one tribe has fish breeder.

As I said, when considering new productionsite, the count of adjacent helper sites (helping exactly the particular productionsite) is known, and when placing a helper site, count of adjacent supported sites (supported by this helper site) is known as well.So linkage exists...


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2017-08-21, 14:24

The AI will never be able to understand the pairing of frisian clay pits and aqua farms without a new hint. The clay pit digs up earth, mixes it with water and produces clay, which is processed into bricks, the most important building material. Earth is everywhere, so it´s not a resource – the clay burner walks to a free spot, digs and leaves behind an immovable pond_dry. The aqua farm fisher consumes water+fruit, then walks to a pond_dry and turns it into a pond_growing, which will become a pond_mature which can be used for fishing by the aqua farm (but not the normal fisher´s house).

The clay pit´s presence is necessary for the aqua farm to work, as only the clay pit produces this immovable. So the aqua farm needs to have a hint like supporter=frisians_claypit.

The bee-keeper is a more difficult case; his supporter building can be one of these (or any combination of): berry farm, reed farm, farm. Perhaps permit supporter to be a table (supporter={frisians_farm, frisians_berry_farm, frisians_reed_farm})?


Top Quote