How to persuade AI to do some basic things in a very different ruleset?

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

How to persuade AI to do some basic things in a very different ruleset?

Post by Corbeau »

In my Sim ruleset I have two problems with AI.

1. In Tribal government, Settlers are replaced by Tribe, a slightly more flexible unit that does have all properties of Settlers (and some additional ones). However, the AIs seem to refuse to build them and once I encounter them, they are left with the exact number of cities as was the number of initial Tribes that were given to them at the start of the game. Any idea how to make them build Tribes?

2. The game starts with no Palace. In order to progress to Despotism, the nation needs to build a Palace. But the AIs are not aware of this and they remain in Tribalism the whole time. I'm open to all suggestions about how to solve or go around this. Any way to give AIs an automatic palace?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by Ignatus »

I didn't dig the code, but maybe just having military capacities rules them out of civil production advisor. All I can pretend without core rewriting or great ruleset changes is replacing some warriors AIs build on tribes by a script.

About the palace, likely AI does not consider building->government dependencies. Give, like, some production bonus to AI Palace to make it understand it's useful.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by cazfi »

Which freeciv version we're talking about? Unhardcoding "Settler" capabilities to (action enabler controlled) actions might have changed the criteria of what the advisor considers potential city building units.

btw. if you currently have a 3.0 ruleset, it should be relatively easy to test how things behave in 3.1. Just run 3.1 freeciv-ruleup for your 3.0 ruleset, and load resulting ruleset to 3.1.

For the Palace issue, I recommend to open a ticket to request that AI would consider (value) buildings that are government dependencies at least in the future versions. https://osdn.net/ticket/newticket.php?group_id=12505
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by Corbeau »

Thanks.

The version is Fc21, so based on 3.0 so I don't know what changes affected what.
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by Corbeau »

So, the requirement for effects that will work only for AIs is

"AI", ... , "Player"

where "..." is the AI difficulty level?


Also, I checked action enablers. Everything related to building cities requires the "Cities" flag, and Tribe has that.
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by cazfi »

Corbeau wrote: Fri Jul 22, 2022 10:41 amunit that does have all properties of Settlers (and some additional ones)
So, what are those properties? Hard to comment what in them may make AI not to consider units for building cities without knowing what the units are.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by Ignatus »

Corbeau wrote: Wed Jul 27, 2022 9:17 am So, the requirement for effects that will work only for AIs is

"AI", ... , "Player"

where "..." is the AI difficulty level?
Seems like yes. And a problem is that version compiled with --enable-debug has different list of AI levels, and "None" value is not supported for it. I have requested "PlayerState" requirement in some ticket that should also tell if the player is AI controlled at all.
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by Corbeau »

cazfi wrote: Wed Jul 27, 2022 5:46 pm
Corbeau wrote: Fri Jul 22, 2022 10:41 amunit that does have all properties of Settlers (and some additional ones)
So, what are those properties? Hard to comment what in them may make AI not to consider units for building cities without knowing what the units are.
Actually, pretty standard.

Code: Select all

[unit_tribe]
name          = _("Tribe")
class         = "Small Land"
tech_req      = "None"
gov_req       = "Tribal"
obsolete_by   = "None"
convert_to    = "Settlers"
convert_time  = 20
graphic       = "u.tribe"
graphic_alt   = "u.settlers"
sound_move    = "m_settlers"
sound_move_alt = "m_generic"
sound_fight   = "f_settlers"
sound_fight_alt = "f_generic"
build_cost    = 5
pop_cost      = 1
attack        = 0
defense       = 1
hitpoints     = 10
firepower     = 1
move_rate     = 2
vision_radius_sq = 5
transport_cap = 0
fuel          = 0
uk_happy      = 0
uk_shield     = 0
uk_food       = 0
uk_gold       = 0
flags         = "Settlers", "NonMil", "Cities", "IgTer", "HasNoZOC"
; No veteran levels (level name is never displayed)
veteran_names = _("green")
veteran_raise_chance = 0
veteran_work_raise_chance = 0
veteran_power_fact = 100
veteran_move_bonus = 0
roles         = "CitiesStartUnit", "Settlers"
helptext      = _("\
In the early stages of civilization, expansion was a constant. \
People simply moved from one place to another and settled in  \
new locations, carrying only basic stuff, because that was all \
they had. \
"), _("\
Tribe is a predecessor of Settlers and is used for founding new 
cities. Tribe can also perform some of the same terrain alterations
as Workers.\
")

[unit_settlers]
name          = _("Settlers")
class         = "Small Land"
tech_req      = "None"
obsolete_by   = "Tribe"
graphic       = "u.settlers"
graphic_alt   = "-"
sound_move    = "m_settlers"
sound_move_alt = "m_generic"
sound_fight   = "f_settlers"
sound_fight_alt = "f_generic"
build_cost    = 10
pop_cost      = 1
attack        = 0
defense       = 1
hitpoints     = 20
firepower     = 1
move_rate     = 2
vision_radius_sq = 2
transport_cap = 0
fuel          = 0
uk_happy      = 0
uk_shield     = 1
uk_food       = 3
uk_gold       = 1
flags         = "Settlers", "NonMil", "Cities", "HasNoZOC"
; No veteran levels (level name is never displayed)
veteran_names = _("green")
veteran_raise_chance = 0
veteran_work_raise_chance = 0
veteran_power_fact = 100
veteran_move_bonus = 0
roles         = "Settlers"
helptext      = _("\
Settlers are one of the key units in the game, as they are your main \
means of founding new cities.\
"), _("\
Settlers can also perform some of the same terrain alterations as \
Workers.\
"), _("\
TIP: optimal production of Settlers occurs in cities of at most \
size 4, or cities with a Granary of at most size 6.\
")
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by Ignatus »

Hmm... Want for city founders is calculated in ai/default/aisettler.c:contemplate_new_city() and then put into city build consideration in ai/default/daidiomestic.c:domestic_advisor_choose_build(). Likely they both should understand which of the units is appliable, can't say what's the problem without running the ruleset in a debugger.
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to persuade AI to do some basic things in a very different ruleset?

Post by Corbeau »

If you's like to try, this is the version of the ruleset for 2.6. The problem existed there, too.

https://github.com/longturn/games/tree/master/LT63Sim
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Post Reply