AI not recruiting

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Velensk
Multiplayer Contributor
Posts: 4002
Joined: January 24th, 2007, 12:56 am

AI not recruiting

Post by Velensk »

Does anyone know what might stop an AI from recruiting when it has the gold and the ability? I am working on a scenario but for some reason the AI won't recruit. I have confirmed that they can recruit by using debug to take control of the side and recruiting.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
User avatar
Ravana
Forum Moderator
Posts: 3005
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: AI not recruiting

Post by Ravana »

Different possibilities what might be wrong depending on what you tried to do.
1 possibility is because recruit pattern is case sensitive.
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: AI not recruiting

Post by mattsc »

You didn't say which version you are using, but let me take a guess that you are talking about 1.11.7? A new recruitment engine was introduced in that version which was developed during GSoC. It now lets the AI save gold when it thinks that that's a good idea. You can turn that off or change the thresholds by setting the recruitment_save_gold aspect parameters as shown in the section below the one I link to there.

Hope that helps. If the question is not about 1.11.7, could you provide some more details and/or a savegame so that we can check out what exactly is happening?
Velensk
Multiplayer Contributor
Posts: 4002
Joined: January 24th, 2007, 12:56 am

Re: AI not recruiting

Post by Velensk »

It was for 1.11.7 sorry for not saying.

I'll play around with that and see if I can get it to work thanks.

EDIT:Was able to fix it, thanks.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: AI not recruiting

Post by ChaosRider »

I can have a same question :P, but also i wish to know how to force ai to recruit allways when he got gold and free castles hexes to do it :D. Sometimes in first scenario of World Conquest, and also for Modified World Conquest (as a modified version of earlier addon it have same bugs as original one :P, if they are not fixed in modified version). Anyone know some command or anything close to this thing :D ?
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: AI not recruiting

Post by mattsc »

ChaosRider wrote:I can have a same question :P, but also i wish to know how to force ai to recruit allways when he got gold and free castles hexes to do it
Umm, maybe I misunderstand the question, but if I do understand it, the answer is the same as for Velensk's question. Use the recruitment_save_gold aspect for the AI side with active=0 in order to disable gold saving.
Velensk
Multiplayer Contributor
Posts: 4002
Joined: January 24th, 2007, 12:56 am

Re: AI not recruiting

Post by Velensk »

If you look at the page he linked to there's a macro you can put in the [ai] section to tell it to spend.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: AI not recruiting

Post by SkyOne »

Awesome. :)
I, too, had been curious for a little while why [ai] side didn't recruit any units after the first turn on 1.11.7. If there is/are (an) ally-side(s), it possibly affects the game balance a lot. Actually, I was unable to finish one of own scenarios due to lacking ally units. I hope that mainline campaigns have already been prepared for this matter on 1.11.7.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: AI not recruiting

Post by mattsc »

SkyOne wrote:it possibly affects the game balance a lot.
Agreed, it does and ...
SkyOne wrote:I hope that mainline campaigns have already been prepared for this matter on 1.11.7.
... no, they have not, at least not in general. That's why the 1.11.7 announcement says the following (repeating it here only so that people don't have to find it):

As a result of the recruitment changes, some scenarios (both single and multiplayer) may have become somewhat unbalanced. Feedback about how the new recruitment engine affects the gameplay in scenarios is needed.

We will try to take care of resulting balance problems as we come across them (Turuk and I are currently taking care of Son of the Black Eye), but there are just too many scenarios for us to find everything ourselves, so please, if you notice anything, let us know. The goal is to have everything taken care of by the time Wesnoth 1.12 comes out.

Don't kill the messenger. :D
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: AI not recruiting

Post by Sapient »

What are the odds of this change being backed out as far as being the default setting? I'm not saying it should be, but that's just something to think about with all the balancing adjustments. It could be a pain to hunt down all those revisions later.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: AI not recruiting

Post by mattsc »

Sapient wrote:What are the odds of this change being backed out as far as being the default setting?
Honestly, I don't know. The people responsible for this GSoC project (flixx and Crab; I really just followed along with half an eye as I am generally interested in all things AI) felt that this was overall an improvement (see note below), but that it needed real testing to confirm, or not, that it should be the default. I think either way's fine, so my personal preference would be to stick with it as it was introduced in 1.11.7 unless there are real problems with it.
Sapient wrote:I'm not saying it should be, but that's just something to think about with all the balancing adjustments. It could be a pain to hunt down all those revisions later.
Agreed - but again, I don't know what to do about it other than saying we won't even try from the start.


Note: flixx mentions in two places on that wiki page that the defaults are not necessarily chosen because they make the AI the strongest, but because they make playing against it more fun (more varied recruiting, less siege-style fighting, ...). I bet people's opinions on that vary widely, I'm just saying that that was part of the motivation of this project. [There are many other aspects to it too, of course, like the fact that recruiting is now much more configurable and supports multiple leader recruiting.]

Edit: Btw, my expectation is that this does not strongly affect the overall difficulty of most scenarios, but there are some for which it can make a significant difference. And of course, a small percentage of all scenarios is still quite a few scenarios.
As a side note, the SotBE rebalancing Turuk and I are doing is not motivated by this recruitment mechanism change. We are just taking care of that on the side (where needed) since we're on it anyway.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: AI not recruiting

Post by SkyOne »

I've been testing all of owns on 1.11.7 (because it's been the first BfW version to support my OS since 1.11.2). My impression so far is that this [ai] performance-change affects the most in the scenario-setting of: - there is an ally-side with the leader. That side-leader is not in danger from enemies, but the player (side=1) definitely needs its (ally-side's) help to defeat the enemies (or there has to be some ally units on the map at the end of the scenario for the story reason).

In this case, we probably need something like:

Code: Select all

[ai]
    [aspect]
        id=recruitment_save_gold
        [facet]
            [value]
                active=10  # for example. it could be 0.
            [/value]
        [/facet]
    [/aspect]
[/ai]
in the ally-side.

The most of the other cases, changing the [ai] code is not really necessary (maybe, adding enemy's INCOME, though, to make the battle harder).
Well, these are just my impression.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: AI not recruiting

Post by Mabuse »

btw, from what i could get by following the link:
Important note: Although the intuition says that the AI will play better when it tries to save some gold, it doesn't. Tests shown that it is always good for the AI to have as many units as possible. (Probably it will do better in village-capturing then). The aspect is activated by default because playing against wave-like recruiting is fun.
btw, intuition tells me that a human also do better when he doesnt save lots of gold and send his units into battle asap. there are exceptions, but in general, you always do better if you constantly support your frontline with troops (ye earlier you train them, ye earlier they will arive where they are eagerly needed).

beside some rare gold saving tricks AT START (recruit only units nesessary for grabbing the desired villages and save the income of the other units) to save the one or other buck to get one more recruit on turn 2 or 3, i never save gold when i play regular wesnoth (not campaigns).

In general saving gold to build new waves makes sense when you are on low numbers while the enemy has outnumbered you. then sending units in one by one doesnt make sense. so you may save up and recruit another wave. (smart human players may give up now, the ai may start to save gold from its remaing two villages to build up a great force. yay.)

Or in Case you are at the income treshold, so you have as many units than villages, so recruiting more units actually mean you would lose income. in this case you may save up gold unless you dont need it either (you dont plan the big offense, retreat anyways, no danger actually)

anways, since im no top-player and i dont wanna discuss about advanced gold-saving strategies, let aside the human-aspect. Of course there are sitations where gold-saving makes sense. but to activate it by default after a very simple sheme that actually reduces the ai-performance?



so what we do have for the ai right now?
we have a feature that makes the ai weaker, since it does better without it. even worse, it is activated by default, so it also break a lot of carefully designed and daylong tested UMC's. :|

my two cents:
the default setting should be OFF, since there are too many disadvantages by having it activated by default -
The best bet is your own, good Taste.
User avatar
Crab
Inactive Developer
Posts: 200
Joined: March 18th, 2009, 9:42 pm

Re: AI not recruiting

Post by Crab »

What are the odds of this change being backed out as far as being the default setting?
It's totally possible that the feature needs tweaks, since the feature is new and might not work 'as intended' in situations with allied ai/human sides or in other cases.

I'd prefer the feature to be activated by default, but change the AIs understanding of when's the 'good idea to save gold', to make it save gold less often and to fix the problems mentioned in scenarios where there are human/AI allies. If there's would be no way to make it behave sensibly, it should be turned off by default.
Velensk
Multiplayer Contributor
Posts: 4002
Joined: January 24th, 2007, 12:56 am

Re: AI not recruiting

Post by Velensk »

The problem is that there are very few times while in a campaign that it makes sense for the AI to save it's gold at all. The way for it to behave sensibly would be if it never did it except in rare circumstances that would almost be easier for the designer to point out to it than for it to decide itself.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
Post Reply