209 lines
No EOL
13 KiB
HTML
209 lines
No EOL
13 KiB
HTML
<html>
|
||
<head>
|
||
<title>MOHAA - SDK</title>
|
||
</head>
|
||
|
||
<body>
|
||
<b><u><font size=+2>Pathnode Flags</font></u></b>
|
||
<br>
|
||
<p>
|
||
DONT_LINK<br>
|
||
- Marks the node as not linking into navigation. Conserves memory and cpu usage.
|
||
<br>
|
||
<br>
|
||
DUCK<br>
|
||
- Tells the AI to duck at this node. Currently only used with cover nodes.
|
||
<br>
|
||
<br>
|
||
COVER<br>
|
||
- Tells the AI that this node is potentially a cover node. The definition of cover is that the enemy cannot see me. The AI will only consider cover nodes that satisfy leash, mindist, and maxdist constraints. This can target one or more nodes for the AI to randomly step toward when it is ready to attack the player again. If there are no targeted nodes, the AI will try to step out along a path to it’s enemy.
|
||
<br>
|
||
<br>
|
||
CONCEALMENT<br>
|
||
- Acts just like COVER, except that no sight trace is done to validate that it is in fact cover. This is useful for foliage and short walls and other things that provide some partial cover or make it harder for the player to see through. It can be used with any of the other cover flags, though it really shouldn’t be used with anything except DUCK and possibly CRATE.
|
||
<br>
|
||
<br>
|
||
CORNER_LEFT<br>
|
||
- Never used with any other flags, except possibly COVER. The COVER flag is assumed, so it is not necessary. Tells the AI to do special corner attack behavior. The corner is to the AI’s left with his back to the wall. The center of the node should be 16 units in from the corner and 16 units out from the wall. The node’s angles should point away from the wall; ie, the way the AI would be facing with his back to the wall.
|
||
<br>
|
||
<br>
|
||
CORNER_RIGHT<br>
|
||
- Never used with any other flags, except possibly COVER. The COVER flag is assumed, so it is not necessary. Tells the AI to do special corner attack behavior. The corner is to the AI’s right with his back to the wall. The center of the node should be 16 units in from the corner and 16 units out from the wall. The node’s angles should point away from the wall; ie, the way the AI would be facing with his back to the wall.
|
||
<br>
|
||
<br>
|
||
SNIPER<br>
|
||
- Currently only works with turret attack behavior. Never used with any other flags. Tells the AI that this is a good place to stand still and shoot people. Use at windows, for example. Can also be used to encourage guys to go inside a building to attack a guy shooting out of a window.
|
||
<br>
|
||
<br>
|
||
CRATE<br>
|
||
- Never used with any other flags, except possibly COVER. The COVER flag is assumed, so it is not necessary. Tells the AI to do special over-the-top attack behavior, as if he were behind a crate. The center of the node should be 16 units back from the crate. The node’s angles should point towards the crate.
|
||
<br>
|
||
</p>
|
||
|
||
<b><u><font size=+2>AI Parameters</font></u></b>
|
||
<br>
|
||
|
||
<ul>
|
||
<li>mindist: The AI will run away from its enemy if he is inside this distance. Cover and sniper nodes inside this distance of the enemy are ignored. Must be at least 128 units less than maxdist to get good behavior.
|
||
<li>maxdist: The AI will charge its enemy if he is ouside this distance. Cover and sniper nodes outside this distance of the enemy are ignored. Must be at least 128 units more than mindist to get good behavior.
|
||
<li>leash: The AI will not stray more than this distance from its leash home, except for responding to grenades. Cover and sniper nodes outside the leash are ignored. The leash is set at the AI’s spawn point. It can be reset to the AI’s current position at any time with the “resetleash” event. It can be tethered to any entity with the “actor tether any_entity” event. It automatically resets to the AI’s current position when they enter attack mode. You can prevent it from changing with the statement “actor.fixedleash = 1”, and let it change again by “actor.fixedleash = 0”. Fixedleash is ignored by tethers.
|
||
<li>sight: The AI will not see anything outside this radius.
|
||
<li>hearing: The AI will not hear anything outside this radius.
|
||
<li>sound_awareness: The AI notices sounds with this probability. If 0, they will never notice sounds; if 50, they will notice sounds half the time; and if 100, they will always notice sounds. This probability drops off to zero at the outer edge of a sound’s radius.
|
||
<li>noticescale: This scales how long it takes AI to see an enemy. At 100, it takes 100% as long as normal to see something; at 50, it takes half as long; at 200, it takes twice as long.
|
||
<li>enemysharerange: The AI will not receive notification that a teammate has a new enemy if outside this radius from his teammate. By default, whenever an AI gets a new enemy, he tells all his buddies within a 512 unit radius or a direct line-of-sight about this fact. Keep in mind that this parameter controls the radius for receiving the notification, not for sending the notification. If set to 0, the default behavior is used, so 1 should be considered the minimum for this parameter.
|
||
<li>accuracy: Percentage chance for the AI to get a hit against its enemy when shooting, assuming the weapon had no spread and the enemy is in range.
|
||
<li>ammo_grenade: number of grenades the AI spawns with.
|
||
<li>gren_awareness: chance the AI will notice a grenade when they see it. This is used to slow down their responsiveness to grenades to make them easier.
|
||
<li>interval: used to space AI apart when they are moving with each other and when there are a bunch of them attacking the player. Default is 128, but it can be tweaked per guy. Can be set to 0 to allow bunching, but only as a last resort to fix a serious problem.
|
||
</UL>
|
||
<br>
|
||
|
||
<p>
|
||
This is not an exhaustive list, but is most of the common parameters.
|
||
</p>
|
||
<br>
|
||
|
||
<b><u><font size=+2>Leash</font></u></b>
|
||
<br>
|
||
|
||
<p>
|
||
Leashes reset under the following conditions:
|
||
</P>
|
||
<ul>
|
||
<li>if fixedleash is 0 and the AI enters either turret or cover attack state, the leash home is reset to the AI’s current origin.
|
||
<li>if the AI is tethered to an entity and that entity moves, the leash home is reset to that entity’s new origin, regardless of the value of fixedleash.
|
||
<li>if the AI is issued a “resetleash” command, the AI’s leash home is reset to it’s current origin, regardless of the value of fixedleash.
|
||
|
||
</Ul>
|
||
|
||
<p>
|
||
The AI can leave their leashes for the following reasons:
|
||
</P>
|
||
<ul>
|
||
<li>They are responding to a grenade.
|
||
<li>They were issued any of the “moveto” commands in script that tells them to go outside the leash, such as friendly AI following the player.
|
||
<li>They are following a patrol path that takes them outside their leash.
|
||
<li>They are running to an alarm node.
|
||
</Ul>
|
||
|
||
<b><u><font size=+2>Enemy Selection</font></u></b>
|
||
<br>
|
||
|
||
<p>
|
||
The AI picks the current best enemy to attack based on distance to the enemy, the number of other AI that are attacking that particular enemy, the enemy’s weapon, whether or not that enemy is completely visible, and whether or not that enemy is in pain. The AI prefer to not switch enemies, but they will if the new enemy is of enough higher threat.
|
||
<br>
|
||
<br>
|
||
When an AI changes enemy, he transfers perfect knowledge about that enemy’s existence and location to all other AI in his “squad”, if they are within 512 units or line-of-sight and they are not outside their “enemysharerange”. This transfer of information takes place 0.5 seconds after he switches enemies. Each AI that becomes aware of this enemy’s location can now decide to switch to the new enemy, or to continue attacking their current enemy.
|
||
<br><br>
|
||
As soon as an AI fires its weapon, all other AI within that weapon’s sound radius immediately know that the weapon was fired and by who and where the shooter was. The weapon sound radius is currently the same for all weapons.
|
||
</p>
|
||
<br>
|
||
|
||
<b><u><font size=+2>How AI Initially Sees An Enemy</font></u></b>
|
||
<br>
|
||
|
||
<p>
|
||
Note that this is only how an AI initially detects an enemy; once he has locked on to an enemy, sight is done by a simple traceline, without all this extra checking.
|
||
<br>
|
||
<br>
|
||
AI sight is achieved based on the time it takes to first notice an enemy given the current conditions. This is scaled based on how long it has been since the conditions were last checked to come up with a percentage recognition; for example, if it has been 1 second since we last checked, and it takes 3 seconds to notice the enemy, the percentage recognition increases by 33.3%. When percentage recognition reaches or exceeds 100%, the enemy is sighted.
|
||
<br>
|
||
<br>
|
||
Recognition time is standard at 2 seconds. There are multipliers to this time based on the LMRF function (light, motion, range, fov). The recognition time gets multiplied by all these factors to get the actual recognition time.
|
||
<br>
|
||
<br>
|
||
* The light portion:<br>
|
||
- if the enemy is the same brightness as self, the light scale is 0.5 for bright areas and 2.0 for dark areas<br>
|
||
- if the enemy is much brighter than self, the light scale is 0.125<br>
|
||
- if the enemy is much darker than self, the light scale is 8<br>
|
||
<br>
|
||
* The motion portion:<br>
|
||
- set for players by the state file; ranges from 0.2 for jumping forward to 1.25 for being ducked while not moving<br>
|
||
- currently not set for AI, so it stays at 1 for AI<br>
|
||
<br>
|
||
* The range portion:<br>
|
||
- function of self's sight range; using a normalized range of 0-1, the scales are as follows:<br>
|
||
<br>
|
||
</p>
|
||
|
||
<table border=1>
|
||
<tr>
|
||
<td>Range</td>
|
||
<td>Scale</td>
|
||
</tr>
|
||
<tr>
|
||
<td>0.000</td>
|
||
<td>0.000</td>
|
||
</tr>
|
||
<tr>
|
||
<td>0.250</td>
|
||
<td>0.500</td>
|
||
</tr>
|
||
<tr>
|
||
<td>0.500</td>
|
||
<td>0.750</td>
|
||
</tr>
|
||
<tr>
|
||
<td>0.750</td>
|
||
<td>1.000</td>
|
||
</tr>
|
||
<tr>
|
||
<td>1.000</td>
|
||
<td>2.000</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<p>
|
||
- the normalized range is current range divided by maximum range. For fogged levels, maximum range is capped to 82.8% of the fog farplane.<br>
|
||
<br>
|
||
* The FOV portion:<br>
|
||
- set to 1 for directly ahead, and increases to 1.25 at periphery<br>
|
||
<br>
|
||
In addition to this, there is also a minimum sight time that is a function of FOV. It is almost 0 for directly in front of the AI, and about 1 second for the periphery. This will make the AI turn its head to look at something before seeing it.<br>
|
||
</p>
|
||
|
||
<b><u><font size=+2>Making AI Look Smart</font></u></b>
|
||
<br>
|
||
|
||
<p>
|
||
Just an un-ordered list of ways to make the AI look smart:
|
||
</p>
|
||
|
||
<ul>
|
||
<li>Place info_grenadehint entities in doors and windows. These are just point entities that are places through which the AI will try to throw grenades. It has no parameters, and it does not eat up entity count, and it can make the AI seem a lot smarter about its world.
|
||
<li>Place SNIPER nodes at doors and windows if the AI cannot get there without leaving their leash, or because there is no path, or because the AI does not have an angle to shoot a guy in a building from the street.
|
||
<li>Place COVER and CONCEALMENT nodes where possible, unless it is going to make the AI want to continually run up and down stairs or frequently switch between nodes.
|
||
<li>Remove a cover node if it will never be good cover, or if the AI is frequently switching between it and better cover.
|
||
<li>Make sure you set the angles properly for CORNER, CRATE, and SNIPER nodes.
|
||
<li>Play with the exact placement and orientation of special nodes to get AI to look good along the most likely (or only) player path. Feel free to nudge the nodes a little if it will make the AI look better.
|
||
<li>Flag COVER nodes as CORNER_LEFT, CORNER_RIGHT, and CRATE as much as possible.
|
||
<li>Have cover nodes target one or more other nodes if you want the AI to consistently pop out at a known location. For example, you could put pop-out nodes to the left and right of a pillar that is cover.
|
||
<li>Whenever possible, spawn guys near the cover you want them to take.
|
||
<li>Don’t have a bunch of guys in tight spaces. Basically, don’t put a guy in the map who will probably get in the way of other AI. This is particularly a problem if you have an area where all but one guy in a large group can take cover.
|
||
<li>Don’t give grenades to a bunch of guys right next to each other. Only one or two guys should have grenades, or you’ll get synchronized grenade tossing.
|
||
<li>Have careful placement of pathnodes! Don’t have pathnodes too near complex terrain / geometry that can cause the AI to get stuck.
|
||
<li>Don’t spam the AI with movement commands.
|
||
<li>Pick an appropriate leash, mindist, and maxdist. This is very important! Setting the leash and / or maxdist too small can prevent the AI from getting to cover and consequently cause them look stupid. Only use a small maxdist if you want the AI to charge its enemy.
|
||
<li>Leave the AI disabled as long as possible (self ai_off). If a guy is in a locked room, leave his AI off until the door is unlocked and / or opened (self ai_on).
|
||
<li>The lightgrid affects how quickly the AI will see an enemy. If you don’t do a light compile with –extragrid, you are not getting a perfectly accurate idea of how long it takes for the AI to see an enemy.
|
||
<li>AI that spawns within 1024 units of each other automatically know about each other’s existence, joining “squads”. AI in a squad are not surprised or curious by noises generated by squadmates. Also, only squadmates get the magical “new enemy” notification messages mentioned above.
|
||
<li>Reduce “enemysharerange” to 1 for guys who are going to blow up the bridge, so that they only run off if the player sees them.
|
||
</ul>
|
||
|
||
|
||
</body>
|
||
|
||
|
||
<p>
|
||
|
||
</p>
|
||
|
||
|
||
|
||
<pre>
|
||
<i><font color=blue>
|
||
|
||
</font>
|
||
</i>
|
||
</pre> |