Important Dates

Latest Posts

Topic: AI dont upgrade trainingssites

MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-02-10, 09:04

The AI dont upgrade the trainingssites of my tribe. I've change yesterday the trainingssites, so only two types of them are available.. battlearena_basic and trainingscamp_basic. Both sites have 4 upgrades up to _level_4. But the AI don't use them. Why?

I moved away from the scheme of having a separate building for each type (attack, defense, health and evasion). The training this way was quite inefficient and resulted in large numbers of only half-trained soldiers. Instead there are two buildings like the other tribes. A battlearena which trains evasion and defense and a training camp which trains health and attack. The basic buildings only make one upgrade level each. The enhancements then each have an upgrade level more. The Level 4 buildings then make a full upgrade across all 6 available upgrade levels.

BTW: Since my soldiers each have 6 levels in all four types, this makes 1296 different possible combinations. When I press X, the screen is not enough to list them all. face-wink.png

Edited: 2021-02-10, 09:09

My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-02-10, 09:08

Here my latest savegame.


Attachment:
wl_autosave_00.wgf (1.9 MB)

My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-02-11, 00:20

The problem is probably the following line:

if (enhancement != Widelands::INVALID_INDEX && ts_without_trainers_ == 0 && mines_.size() > 3 &&
	    ts_finished_count_ > 1 && ts_in_const_count_ == 0) {



The AI only upgrades a trainingsite if there are more than 3 mines. But the AI of my tribe never builts more than 3 mines. There exactly 3 mines over the course of the entire game: 1 coal, 1 iron, 1 gold. There is no granitemine, I use a advanced quarry to "mine" stone from mountains. And the AI never builts more than 1 mine per type. Only a replacement for an empty one.
Edited: 2021-02-11, 00:32

My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-02-11, 00:36

I was right. If I force another mine per Lua Console (Debug Script), the AI beginns to enhance the trainingsites. We should replace this line.


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2724
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2021-02-11, 09:03

MarkMcWire wrote:

The AI only upgrades a trainingsite if there are more than 3 mines. But the AI of my tribe never builts more than 3 mines. There exactly 3 mines over the course of the entire game: 1 coal, 1 iron, 1 gold. There is no granitemine, I use a advanced quarry to "mine" stone from mountains. And the AI never builts more than 1 mine per type. Only a replacement for an empty one.

The question is why does it build only 3 mines.

Edited: 2021-02-11, 09:04

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2724
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2021-02-11, 09:07

MarkMcWire wrote:

I was right. If I force another mine per Lua Console (Debug Script), the AI beginns to enhance the trainingsites. We should replace this line.

Well, this was a good safeguard for the AI playing our legacy tribes and it works with them quite well ensuring upgraded trainingsites are only built if enough supply could be assumed. For this i am hesitating changing something to make it fit your tribe whilst not being sure about the effects on the official ones.


Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-02-11, 10:24

hessenfarmer wrote:

MarkMcWire wrote:

I was right. If I force another mine per Lua Console (Debug Script), the AI beginns to enhance the trainingsites. We should replace this line.

Well, this was a good safeguard for the AI playing our legacy tribes and it works with them quite well ensuring upgraded trainingsites are only built if enough supply could be assumed. For this i am hesitating changing something to make it fit your tribe whilst not being sure about the effects on the official ones.

The only tribe that has an upgradeable trainingsite is the empire. It can expand the Arena to the Colosseum. Neither Arena nor Colosseum uses wares from weaponsmithy or armorsmithy, they only train soldiers to evade. So I don't understand the relationship with the number of mines, because Arena and Colosseum only uses food.

Edited: 2021-02-11, 10:28

My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-02-11, 10:25

hessenfarmer wrote:

MarkMcWire wrote:

The AI only upgrades a trainingsite if there are more than 3 mines. But the AI of my tribe never builts more than 3 mines. There exactly 3 mines over the course of the entire game: 1 coal, 1 iron, 1 gold. There is no granitemine, I use a advanced quarry to "mine" stone from mountains. And the AI never builts more than 1 mine per type. Only a replacement for an empty one.

The question is why does it build only 3 mines.

I don't know. The AI of my tribe never builds more than exactly one mine of each kind. Since the use of Build 22 / 1.0.


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2724
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2021-02-11, 10:35

MarkMcWire wrote:

hessenfarmer wrote:

MarkMcWire wrote:

I was right. If I force another mine per Lua Console (Debug Script), the AI beginns to enhance the trainingsites. We should replace this line.

Well, this was a good safeguard for the AI playing our legacy tribes and it works with them quite well ensuring upgraded trainingsites are only built if enough supply could be assumed. For this i am hesitating changing something to make it fit your tribe whilst not being sure about the effects on the official ones.

The only tribe that has an upgradeable trainingsite is the empire. It can expand the Arena to the Colosseum. Neither Arena nor Colosseum uses wares from weaponsmithy or armorsmithy, they only train soldiers to evade. So I don't understand the relationship with the number of mines, because Arena and Colosseum only uses food.

ok this is a good point will have look then


Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-02-12, 15:14

Is there any way to debug the decision making of the AI in a Debug build? Like to understand, why the AI decided to built only 1 mine per type.


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote