Using Potential Fields in a Real-Time Strategy Game Scenario
[Johan Hagelback, 2009]
In this article/tutorial Johan explores a potential field based approach to real-time planning and navigation.
Potential fields are similar to influence maps in the fact that they are both constructed by placing numerical values on a grid map. The difference is that influence maps use player units/buildings to set the numerical values and potential fields place the numerical value in areas of interest.
An example of an influence map.
After the potenial map spreads through the map (fading its values to zero), a moving unit can easily reach it's destination by simply moving to its current more attractive adjacent tile. The idea is to use attractive fields in the destinations and repelling fields in the obsacles. This will create a potential map that will guide the unit through the terrain.
This can also have other applications, for example, when a unit ends its "attack phase" and enters a "reload phase", it can create repellant fields to flee if the enemy unit comes closer. Another application can be for long ranged units. If they place a small repellant field to enemy units to create a "ring" for the optimum firing range.
An example of a potenial field with obstacle repellant fields.
One of the advantages of using potential fields is the ability to handle dynamic game worlds. Agents only need to see one step ahead to move. They don't need to know the full path to their destination, eliminating the risk of obsolete paths due to changes in the game world. Also, it can easily create complex behaviors by just modifying the fields, for example, several unis will surround an enemy while being at shooting range and avoiding other friendly units who are also attacking the same enemy.
The main drawback from this approach would be the fact that it would need to be carefully programmed as to require an efficient amount of resources. Although the author solved this issue, it's definetely not something trivial.
For more information, including common problems and solutions, hit the link.
Hagelbäck, Johan, 2009. Using Potential Fields in a Real Time Strategy Game Scenario. Obtained in July 28th, 2011 from AiGameDev.com : http://aigamedev.com/open/tutorials/potential-fields/
0 comentarios:
Publicar un comentario