Influence maps v's Pathing algos
Hi all. I''m new to AI, but know the basics enough to get a game AI up and running. But recently in my readings, and in my latest game development I have come across an interesting question:
Q. What are the advantages/disadvantages of using influence mapping versus using pathing algos (A*, best-first, etc)?
From what I can see, influence maps will give the AI a good idea of where everything is on the map (IE: impassible terrain to avoid, objects on map, etc), and path algos will bring the AI to a more direct path. It''s probably just a case of influence maps working best for certain situations (a retreating army avoiding advancing enemy troops) and path algos for others (targetting a specific enemy unit).
Any comments?
-----------------------------Empires! Visit online at http://www.daleszone.comProgramming for a funner world.
Actually, the two go together. Often, you''ll use an algorithm like A* ON an influence map. For example, you may want to get from point A to point B with as little risk as possible. So you''ll pathfind using A*, but the cost of each node will come from an influence map, with places of high enemy influence having high costs and places of high friendly influence having low costs.
...and there are certain algorithms that combine the two, so that path costs are weighted by how close they take you to an obstacle. One can imagine that grinding your tank up against a wall is not so good (diminishes movement rate, breaks off bits (of the wall and the tank)) but being close to the wall may be good if you''re looking for cover.
Actually this is used most often in robotics where agents are not point masses, which is the general assumption made in most pathfinding implementations.
Cheers,
Timkin
Actually this is used most often in robotics where agents are not point masses, which is the general assumption made in most pathfinding implementations.
Cheers,
Timkin
ABSO-FREAKIN-LUTELY AWESOME!!!! :D
Please note that when reading this, that the game I'm writing is an iso-tile strategy game, set in medieval times.
I decided to have a play with my AI. First up I wrote a "dirty quick" influence map for the setup routine in the inital road placements. Excellent! The roads made a bit more sense. They wound around hills, connected all my cities, and converged on each other for sensible connections to each other.
So I thought to myself, "Let's keep going with this and see where it goes". So I made another influence map for my explorer ships to head towards unexplored areas. Worked like a charm. My AI's explorer ships headed off to the "New World", but I found a couple of problems. It wouldn't explore new coasts, and a number of explorers would head to the same spot. So a couple of conditions put into the map, (ie: increase influence for coastlines, and to pick destinations at least 20 tiles apart) and WOOHOO! The AI is now exploring a number of sites simultaneously, and when they find a coast, follow it around! :D
I wondered if my luck would hold out for armies. So the one I'm working on now is for my "threat analysis" module. I made an influence map of potential threat to my AI. I also made it display this on the minimap with a keystroke (for my benefit
). Anyways, compile, load up, and off I go. Bring up the influence map for the current AI player, and guess what! I'd moved the AI's diplo relations down to "hates you" for another AI (and vice-versa for them), and there was this big patch of "high threat" over the enemy. Over the next few turns, the relations kept dropping (hmmm..... what was the event code for "increase hate level" that I keep pressing), and the threat graphic got darker and darker. The AI's were madly moving troops from all over their respective countries to the mutual border. Eventually one declared war, and man, I've never seen my AI battle so hard!!!! My dirty quick threat influence map was being used by the AI to pick battle sites when at war as well as overall threat levels. I just made the threat level drop from overall level to unit level.
EDIT: Forgot to mention that the AI uses roads correctly too now. Roads give double or trips movement depending on whether they're dirt or cobblestone roads.
hahaha. It was unreal to see my AI's actually trying to hunt each other down and destroy each other!!!
Thankyou so much guys! :D
[edited by - Dale on July 23, 2003 1:34:31 AM]
Please note that when reading this, that the game I'm writing is an iso-tile strategy game, set in medieval times.
I decided to have a play with my AI. First up I wrote a "dirty quick" influence map for the setup routine in the inital road placements. Excellent! The roads made a bit more sense. They wound around hills, connected all my cities, and converged on each other for sensible connections to each other.
So I thought to myself, "Let's keep going with this and see where it goes". So I made another influence map for my explorer ships to head towards unexplored areas. Worked like a charm. My AI's explorer ships headed off to the "New World", but I found a couple of problems. It wouldn't explore new coasts, and a number of explorers would head to the same spot. So a couple of conditions put into the map, (ie: increase influence for coastlines, and to pick destinations at least 20 tiles apart) and WOOHOO! The AI is now exploring a number of sites simultaneously, and when they find a coast, follow it around! :D
I wondered if my luck would hold out for armies. So the one I'm working on now is for my "threat analysis" module. I made an influence map of potential threat to my AI. I also made it display this on the minimap with a keystroke (for my benefit

EDIT: Forgot to mention that the AI uses roads correctly too now. Roads give double or trips movement depending on whether they're dirt or cobblestone roads.
hahaha. It was unreal to see my AI's actually trying to hunt each other down and destroy each other!!!
Thankyou so much guys! :D
[edited by - Dale on July 23, 2003 1:34:31 AM]
-----------------------------Empires! Visit online at http://www.daleszone.comProgramming for a funner world.
It''s great to see you so happy. I''m curious though. How did creating an influence map make your roads wind "around hills, connected all my cities, and converged on each other for sensible connections to each other."?
My Website: ai-junkie.com | My Book: AI Techniques for Game Programming
My Website: ai-junkie.com | My Book: AI Techniques for Game Programming
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
After searching all the posts he made I found this link:
http://members.dodo.net.au/~thesdale/
http://members.dodo.net.au/~thesdale/
quote:
Original post by fup
It''s great to see you so happy. I''m curious though. How did creating an influence map make your roads wind "around hills, connected all my cities, and converged on each other for sensible connections to each other."?
Well, before I made the influence map my road pathing was using just the mapcells array for cost. It was causing roads to go over mountains in straight lines from one city to the next. Pretty much the only deviations were around lakes and coastlines. Going over mountains is bad in my game, as the following shows:
- Infantry movement points: 100
- Flat terrain (grass, plains) movement cost: 100
- Hills cost: 200
- Mountains cost: 300
- Flat + dirt road cost: 50, stone road 25
- Hill + dirt road cost: 100, stone road 50
- Mountains + dirt road: 150, stone road 100
So basically, my roads were being created in undesirable locations.
Add the influence map:
- negatives influence on hills, mountains and water (lakes/sea)
- positive influence on roads and cities
So when the road was looking for a path from City A to City B, it would wind around the favourable terrain instead of straight through the middle on unfavourable terrain.
Another bonus was that if the road passed through the influence well of City C then the road connected City C into it. Also, if roads pass within a few tiles of each other, they join up as well from the existing road''s influence well.
So all up, it caused the road network to "wind around hills, connected all my cities, and converged on each other for sensible connections to each other".

-----------------------------Empires! Visit online at http://www.daleszone.comProgramming for a funner world.
Kylotan:
As ggs pointed out, that''s the website for my game. However, that''s a pretty old demo (v0.2). I''m working hard on demo v0.3 and this is where the AI kicks in. There''s none in that old demo. But keep an ear out and you''ll hear about it soon (hopefully if the missus doesn''t mind too much)
ggs:
That''s the old demo. While it gives a good base for what the game''s all about, it''s not very current. I''ve changed a lot of ideas since then, especially in the economy. It''s a lot deeper now, and a lot more fun/harder to balance. I''ve gone from an economy in demo 0.2 where you can self-sustain yourself, to one where you WILL need friends and trading partners in the current build. It''s a lot more fun in the juggling.
As ggs pointed out, that''s the website for my game. However, that''s a pretty old demo (v0.2). I''m working hard on demo v0.3 and this is where the AI kicks in. There''s none in that old demo. But keep an ear out and you''ll hear about it soon (hopefully if the missus doesn''t mind too much)

ggs:
That''s the old demo. While it gives a good base for what the game''s all about, it''s not very current. I''ve changed a lot of ideas since then, especially in the economy. It''s a lot deeper now, and a lot more fun/harder to balance. I''ve gone from an economy in demo 0.2 where you can self-sustain yourself, to one where you WILL need friends and trading partners in the current build. It''s a lot more fun in the juggling.

-----------------------------Empires! Visit online at http://www.daleszone.comProgramming for a funner world.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement