Latest Posts

Topic: News about AI

Tibor

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

If the limits should be that specific, the best way would be to put them into lua configuration files. The C++ should not include hard coded values, especially per building and tribe.

As for redundancy - i dont like the idea of setting a hard-limit and immediately make exemptions to it face-smile.png

Anyway, changes to lua configuration is not directly related to my work on genetic algorithm... And when I watch AI in this branch it does not build second trainingsites, so the problem might be opposite than what is in trunk...


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-03-12, 23:05

Tibor wrote:

So what should be limits for trainingsites? Max one of each type? Or max 3 trainingsites per player?

Not max one of each type. I don't know if a maximum would be good in general, but the relation 1 colosseum + 4 trainings camps is perfect for training fully promoted soldiers.

With barbarians, it's almost the same: The perfect relation is 1 arena + 4 trainings camps.

Atlanteans are better balanced, the perfect relation is 4 dungeons + 5 labyrinths.

Okay, well, in some extreme situations it's not the best to train mainly fully promoted soldiers, but some more evade-trained soldiers. But I don't often play like that.

king_of_nowhere wrote:

Tibor wrote:

So what should be limits for trainingsites? Max one of each type? Or max 3 trainingsites per player?

You have to differentiate here. colosseum only gives 2 promotions to a soldier, while training camp gives 8. so you could have 4 training camps and 1 colosseum and they would all work fine. So if we were to code for hard limits, i would suggest 1 colosseum 4 training camps for empire, 1 arena 3 training camps for barbarians,

Why 3 instead of 4? Do you think that the calculated values for this buildings are absolutely wrong?

and 2 labyrinths plus 2 dungeons for atlanteans.

Well, is a maximum needed at all? Isn't only the relation important?


Wanted to save the world, then I got widetracked

Top Quote
Tibor

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

Also important question is how such relation can be listed in configuration file. To put there a limit is simple, but a proportion....


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-03-19, 02:28

I don't know that much about coding, but maybe something like that:

"Don't build Colosseum number n if trainings camp number 4n-4 is not about to be finished or already existing"

Same with barbarian arena

"Don't build trainings camp number m if there are less than (m-1)/4 colosseums (or colosseums which are about to be finished)."

Same with barbarian arena

"Don't build labyrinth number k if there are less than k*0.8-1 dungeons (or dungeons which are about to be finished)."

"Don't build dungeon number n if there are less than n*1.25-2 labyrinths (or labyrinths which are about to be finished)."


Wanted to save the world, then I got widetracked

Top Quote
Tibor

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

WorldSavior wrote:

I don't know that much about coding, but maybe something like that:

"Don't build Colosseum number n if trainings camp number 4n-4 is not about to be finished or already existing"

Same with barbarian arena

"Don't build trainings camp number m if there are less than (m-1)/4 colosseums (or colosseums which are about to be finished)."

Same with barbarian arena

"Don't build labyrinth number k if there are less than k*0.8-1 dungeons (or dungeons which are about to be finished)."

"Don't build dungeon number n if there are less than n*1.25-2 labyrinths (or labyrinths which are about to be finished)."

OK, but we still need a way to define these rules in lua files. I cannot come with a way. Perhaps with a single "proportions" number, like:

  • trainingsite1: 1
  • trainingsite2: 2

This would indicate just a proportions between these sites. Default would be 1, this would be safe enough in case of new tribes, or new trainingsites, or renaming of trainingsites...


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

How about a table in the AI hints, like this:

Dungeon

prerequisites = {
    atlanteans_barracks = {
        needed = 1
    },
    atlanteans_labyrinth = {
        needed = 0,  -- default value, so this line can be omitted
        proportion = 2
    }
}

Labyrinth

prerequisites = {
    atlanteans_barracks = {
        needed = 1
    }
    -- No entry for the dungeon, because the cyclic dependency would break stuff
}

Implementation: You can build a dungeon if:

  • There is at least 1 barracks
  • There are at least 2 * #dungeons labyrinths.

Busy indexing nil values

Top Quote
Tibor

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

It seems too complex to implement. The minimalistic implementation could be:

f.e in dungeon's init.lua:

 traininsites_max_proportion = 0.6

Indicating that if there already is a dungeon, build another one only if #dungenons / #all_trainingsites <= 0.6. If smartly crafted, it would keep traininsites in required proportions. For example 0.01 would provide that there would never be second traininsite of the type. Default could be 0.5.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-03-20, 13:46

Yes, that's a good idea face-smile.png

The default proportion if none has been set could be calculated in Tribes::postload().


Busy indexing nil values

Top Quote
Tibor

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

Well, if no entry in ai_hints section, the default would be 0.5, that would mean that in case of two buildings (types), the difference would never be more than one, so 0:1, 1:2, 2:3. Also the actual number would hint the preference, so 0.51 would be more preferred than 0.5 => build first - can it be?


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

But in case of 3 trainingsite types (Empire), the neutral proportion would be 0.33, not 0.5. And what about mods, maybe a tribe could have only 1 trainigsite (1.0) or 4 trainingsites (0.25), ... calculating the neutral proportion in Tribes:: postload() is no problem at all. I can code that part it you want, since I'm more familiar with the tribes code.


Busy indexing nil values

Top Quote