Need help getting AI to perform tasks.
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.
Need help getting AI to perform tasks.
Not sure if this is the right board, but here goes.
The following are things I've tried to do in WML for a campaign I'm working on, and failed:
1) Have a group of units spawned before the game starts focus on attacking a specific unit or group of units, rather than the enemy units nearest them. [target] does not seem to have much effect unless they can reach the target in 1 turn, and I want the start to be farther apart than that.
2) Have a unit follow another unit. Protect is not doing the job, because again, I want opposing teams to not start close enough that they are a threat. And making a ton of protects with varying radii is too unwieldy and still might not work.
3) A specific case of #2, having a group of units surround a leader whenever they are not attacking the enemy.
4) Getting leader_goal to work, I suppose the unit has to be a leader? I was hoping not...I'd like to command specific units to head to a destination w/o making them leaders, is this possible?
The following are things I've tried to do in WML for a campaign I'm working on, and failed:
1) Have a group of units spawned before the game starts focus on attacking a specific unit or group of units, rather than the enemy units nearest them. [target] does not seem to have much effect unless they can reach the target in 1 turn, and I want the start to be farther apart than that.
2) Have a unit follow another unit. Protect is not doing the job, because again, I want opposing teams to not start close enough that they are a threat. And making a ton of protects with varying radii is too unwieldy and still might not work.
3) A specific case of #2, having a group of units surround a leader whenever they are not attacking the enemy.
4) Getting leader_goal to work, I suppose the unit has to be a leader? I was hoping not...I'd like to command specific units to head to a destination w/o making them leaders, is this possible?
Last edited by Lunar2 on January 24th, 2006, 6:04 am, edited 1 time in total.
-
- Retired Developer
- Posts: 2633
- Joined: March 22nd, 2004, 11:22 pm
- Location: An Earl's Roadstead
Re: Need help getting AI to perform tasks.
These are all good things to be able to do. #2 can be done, sort of, by targeting your own unit that you want followed. I hope to make all 4 possible/easier to do when my AI is released into the wild.Lunar2 wrote:Not sure if this is the right board, but here goes.
The following are things I've tried to do in WML for a campaign I'm working on, and failed:
1) Have a group of units spawned before the game starts focus on attacking a specific unit or group of units, rather than the enemy units nearest them. [target] does not seem to have much effect unless they can reach the target in 1 turn, and I want the start to be farther apart than that.
2) Have a unit follow another unit. Protect is not doing the job, because again, I want opposing teams to not start close enough that they are a threat. And making a ton of protects with varying radii is too unweildy and still might not work.
3) A specific case of #2, having a group of units surround a leader whenever they are not attacking the enemy.
4) Getting leader_goal to work, I suppose the unit has to be a leader? I was hoping not...I'd like to command specific units to head to a destination w/o making them leaders, is this possible?
"you can already do that with WML"
Fight Creeeping Biggerism!
http://www.wesnoth.org/forum/viewtopic. ... 760#131760
http://www.wesnoth.org/forum/viewtopic. ... 1358#11358
Re: Need help getting AI to perform tasks.
If [target] doesn't work, I'm a bit short on ideas.Lunar2 wrote:1) Have a group of units spawned before the game starts focus on attacking a specific unit or group of units, rather than the enemy units nearest them. [target] does not seem to have much effect unless they can reach the target in 1 turn, and I want the start to be farther apart than that.
I think you could do this by manually setting the AI unit's goto_x and goto_y before it's every turn to point to the unit he should follow. I'll test if this works in a little while, so I can post back the results.Lunar2 wrote:2) Have a unit follow another unit. Protect is not doing the job, because again, I want opposing teams to not start close enough that they are a threat. And making a ton of protects with varying radii is too unwieldy and still might not work.
Their own leader or the enemy's? I suppose it would be possible to make them surround their own leader, or even the leader of the enemy. It will be very tricky though.Lunar2 wrote:3) A specific case of #2, having a group of units surround a leader whenever they are not attacking the enemy.
Again, manually setting the goto_x and goto_y attributes of a unit might do the job. As I said, I'll try if this works.Lunar2 wrote:4) Getting leader_goal to work, I suppose the unit has to be a leader? I was hoping not...I'd like to command specific units to head to a destination w/o making them leaders, is this possible?
Ok, it seems that goto_x and goto_y can't be used to set paths for AI units. When they are set for player units, they are moved along the given path in the beginning of the player's turn, but this doesn't work for AI sides.
This pretty much disables all the ideas I had about making these things work. If you only need these for single campaign scenario(s), it'll probably be possible to do these in a hacky scenario-specific way (more or less). So if you want to, you can post some scenario code and describe how it should behave and I can try to figure something out.
This pretty much disables all the ideas I had about making these things work. If you only need these for single campaign scenario(s), it'll probably be possible to do these in a hacky scenario-specific way (more or less). So if you want to, you can post some scenario code and describe how it should behave and I can try to figure something out.
Well, in that case I think your best bet is the new support for Python AI's.
-
- Retired Developer
- Posts: 2633
- Joined: March 22nd, 2004, 11:22 pm
- Location: An Earl's Roadstead
#2 and #3 can be done by targeting your own unit that with a high value. #1 Would be hard to tell if the AI is doing it. I would suggest using debug mode. You can see what the AI is thinking. The only way to do #4 currently is to have a unit be a leader. This is the first task that my new AI will fix, and it already can handle doing this, but I am overhauling the whole thing. The dfool AI will allow you to define for any set of units a target to move to. That target could be either a location on the map, or a position relative to another unit. I also plan on making it possible to essentially define a series of waypoints. If your campaign is really 25 scenarios long, all this should be accomplished well before you are done. Once movement with the Dfool AI is done, I will be moving on to more useful things like teaching it how to fight and recruit.
"you can already do that with WML"
Fight Creeeping Biggerism!
http://www.wesnoth.org/forum/viewtopic. ... 760#131760
http://www.wesnoth.org/forum/viewtopic. ... 1358#11358