Latest Posts

Topic: How does the AI rate port spaces?

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-02-18, 16:04

I have a map with one available port space for both the player and the ai. If the ai reaches it, i can read in console:

4: ( 72x 52) expedition spot scoring, colony_scan_area == 34
4: Sunstone at  73x 48: PORTSPACE found, we valued it: 2
4: Sunstone at  73x 48: explore uphold, visited first time
4: Sunstone: continue island circumvention, dir=1

How can i force the ai to build a port at this place (the only port space)? Is there anything i can do, e.g. edit the map to make the AI value it higher?


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-02-18, 19:44

The most important aspect is amount of free space (without enemies but also without own territory). AI is using some checking radius and walk from the port space and if owned territory is found - the score is lower.

Try to look here: https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai_seafaring.cc#L27


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-02-19, 06:28

Cool, thanks face-smile.png After placing some rocks and trees:

4: Caicos at  74x 49: PORTSPACE found, we valued it: 6
Forcing flag at (72, 53)

Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote