Question: Can The AI Be Manipulated?

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.
Post Reply
User avatar
usr-sbin
Posts: 126
Joined: July 26th, 2009, 6:49 pm

Question: Can The AI Be Manipulated?

Post by usr-sbin »

I would like to know if you can set certain parameters for the ai, for example can I make it more aggressive or more defensive? Also it it possible to tell it to split its troops to attack two different points on the map and maybe define a ratio of fighters, scouts and archers that will be sent to each location?

I have tried a search but I couldn't see anything useful.

Thanks in advance!
Continuing Siege of Soradoc
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Question: Can The AI Be Manipulated?

Post by Gambit »

All that and more can be yours for two easy payments of $19.99!
But wait if you call within the next ten minutes, because we can't do this all day, we'll throw in Formula AI Functions List for free!

If whoever wrote FAI were german this joke would be a million times funnier.
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: Question: Can The AI Be Manipulated?

Post by Yogibear »

I think this is more like what the OP had in mind: http://wiki.wesnoth.org/AiWML

There are a couple of tricks you can try. It will be difficult (if not impossible) to control things like splitting into two forces, those switches rather control the general behaviour of the AI. I am also not sure, how rigorously they have been tested. You might find that certain tags don't have the influence you expect from them (and sometimes it is difficult to find meaningful ranges for certain parameters).

Hope that helps you get along.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
User avatar
usr-sbin
Posts: 126
Joined: July 26th, 2009, 6:49 pm

Re: Question: Can The AI Be Manipulated?

Post by usr-sbin »

Thanks both of your for your posts. Would I be able to apply these tags to the different ai leaders. For example to make one really defensive and the other really offensive?

Thanks in advance
Continuing Siege of Soradoc
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Question: Can The AI Be Manipulated?

Post by Gambit »

The [ai] tag goes inside of [side], so unless your question is asking for multiple leaders on the same side, then yes.
User avatar
usr-sbin
Posts: 126
Joined: July 26th, 2009, 6:49 pm

Re: Question: Can The AI Be Manipulated?

Post by usr-sbin »

Thank you again Gambit. Another question I have is can I force the ai to send its units along a preset route?

Thanks in advance
Continuing Siege of Soradoc
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Question: Can The AI Be Manipulated?

Post by Gambit »

By storing the units you want to move and then looping through them and setting
stored_unit[$i].goto_x="24"
and
stored_unit[$i].goto_y="25"
You could make them go to point 24, 25. Then when they get there you'd store them again and set the next waypoint. But goto_x and goto_y are kinda buggy. They tend to forget their behaviour if you don't remind them every krifing turn.

You could also try move_unit_fake. I can't explain it because I've never used it, so maybe someone else can chime in. It's probably the easiest way, I just don't know much about it.

Or you could try the formula AI.
Anonymissimus
Inactive Developer
Posts: 2460
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Question: Can The AI Be Manipulated?

Post by Anonymissimus »

Gambit wrote:But goto_x and goto_y are kinda buggy. They tend to forget their behaviour if you don't remind them every krifing turn.
This is a current bug being worked on by Crab. It's intended to be kept until the destinations are reached (It does for a human player if no new commands are given).
You could also try move_unit_fake. I can't explain it because I've never used it, so maybe someone else can chime in. It's probably the easiest way, I just don't know much about it.
I don't see how move_unit_fake could be helpful here.

Formula ai is cryptic for me.
You can also try "ai herding". Basically, you would create a unit of type=lure at the destination position which is only there during the ai's turn and set a very high [target]type=lure.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
usr-sbin
Posts: 126
Joined: July 26th, 2009, 6:49 pm

Re: Question: Can The AI Be Manipulated?

Post by usr-sbin »

Ok, thank you. What I am trying to do is create a tower defense scenario for my campaign but I am starting to see that it is going to be quite hard!
Continuing Siege of Soradoc
Post Reply