Suggested Simple AI Change
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
-
- Posts: 69
- Joined: April 1st, 2004, 11:05 pm
- Location: Lincoln, Nebraska, United States
Suggested Simple AI Change
I play a lot of human vs. AI games (I don't have many friends). My favorite types of maps to play are large and varied continents with many different AI players here and there. I've noticed that the AI has a general trend to go North.
Presumably this is because the pathfinding algorithm starts looking North and then proceeds counterclockwise, so all things being equal, it will go North. Obviously this isn't a huge deal, but what it usually means is that on large maps, the players on the far southern parts will be able to expand rapidly (since there will be little resistance initially travelling south to oppose them), and the AI players in the North almost always get defeated quickly since they send all of their units north and get slaughtered by the obsessively north travelling southern armies.
Anyway, it's not a big deal, but if the problem is, as I suspect, with the pathfinder, could we add a quick "initialSearchingDirection = rand() % 6;" sort of thing so that the AI doesn't look like a flock of birds returning North in the summer (for us Northern hemisphere folk)?
Thanks,
Charles
Presumably this is because the pathfinding algorithm starts looking North and then proceeds counterclockwise, so all things being equal, it will go North. Obviously this isn't a huge deal, but what it usually means is that on large maps, the players on the far southern parts will be able to expand rapidly (since there will be little resistance initially travelling south to oppose them), and the AI players in the North almost always get defeated quickly since they send all of their units north and get slaughtered by the obsessively north travelling southern armies.
Anyway, it's not a big deal, but if the problem is, as I suspect, with the pathfinder, could we add a quick "initialSearchingDirection = rand() % 6;" sort of thing so that the AI doesn't look like a flock of birds returning North in the summer (for us Northern hemisphere folk)?
Thanks,
Charles
"For to me, to live is Christ and to die is gain." - Phil. 1:21
Perhaps instead of looking in a fixed or random direction, it should start looking in the longest direction.
"When a man is tired of Ankh-Morpork, he is tired of ankle-deep slurry" -- Catroaster
Legal, free live music: Surf Coasters at Double Down Saloon, Las Vegas on 2005-03-06. Tight, high-energy Japanese Surf-Rock.
Legal, free live music: Surf Coasters at Double Down Saloon, Las Vegas on 2005-03-06. Tight, high-energy Japanese Surf-Rock.
-
- Posts: 69
- Joined: April 1st, 2004, 11:05 pm
- Location: Lincoln, Nebraska, United States
My suggested change to the algorithm (in theory) would not make an AI controlled character change direction each turn, because generally the AI has "reasons" for going a particular direction. Presumably some kind of weighted A* algorithm is being used for pathfinding such that an AI player will place extra value on certain hexes (villages, hexes adjacent to weakened enemies, etc.) The change I suggest would theoretically only make the AI choose randomly between two equal choices. An example: Two villages are each 5 hexes away and this unit is the only unit that can reach them. It seems to me that in the current implementation, the AI will (almost) always go to the Northern of the two.
Anyway, it's not a big deal, and it's probably something that I should patch myself and try out for a while before submitting, but having never submitted any code changes to Wesnoth, the whole concept of that is a bit intimidating. Especially since some of the coding style in Wesnoth grossly violates my own style and Sirp would probably beat me up.
As far as looking in the "longest" direction, I assume that means that an AI on the left side would /tend/ to move to the right. That seems reasonable. I was going to suggest that they tend toward the map's center which would essentially come to the same thing.
Well, thanks again!
Charles
Anyway, it's not a big deal, and it's probably something that I should patch myself and try out for a while before submitting, but having never submitted any code changes to Wesnoth, the whole concept of that is a bit intimidating. Especially since some of the coding style in Wesnoth grossly violates my own style and Sirp would probably beat me up.
As far as looking in the "longest" direction, I assume that means that an AI on the left side would /tend/ to move to the right. That seems reasonable. I was going to suggest that they tend toward the map's center which would essentially come to the same thing.
Well, thanks again!
Charles
"For to me, to live is Christ and to die is gain." - Phil. 1:21
-
- Retired Developer
- Posts: 2633
- Joined: March 22nd, 2004, 11:22 pm
- Location: An Earl's Roadstead
Actually, there are a lot of issues about the ordering/tendencies of the current AI. I hope to address some of these in my (delayed but still working on it) AI.
"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