AE:Projectile awareness: Difference between revisions

From OniGalore
Jump to navigation Jump to search
No edit summary
(added AI2 part of firinspred/projectile dodging. Asking Neo for help if he is interested.)
Line 29: Line 29:
==Fixing AI Logic==
==Fixing AI Logic==


Loser, please add stuff here.
Every [[ONCC]] has set of parameters which adjust how this ONCC will react on firingspread (''ai2_showfiringspreads=1'') and projectile dodge sphere (''ai2_showprojectiles=1'', it is blue sphere). Some of them are already known, some are not. Help please, [[user:Neo]] ^_^?
 
 
0x128 : '''General AI2 options:''', those bits which interest us are:
*0x02 - firingspread/projectile dodge enabled for melee, with weapon AI2 does NOT dodge
*0x04 - requires 0x02 to be set; firingspread/projectile dodge enabled for weapons; if AI2 is armed, it tries to face shooter and fire back while dodging.
*0x08 - requires 0x02 to be set, overrides 0x04 if both are set; firingspread/projectile dodge enabled for weapons; if AI2 is armed, it doesn't shoot back, just tends to run away, not facing shooter (maybe behavior for case when civillians pick up weapon?)
*0x10 - unknown; only "advanced" classes (Konoko, Muro, Mukade, red Furies, red Elites and some more) have this bit set, I have feeling it does something with gunfire dodging, Neo help please?
 
 
Next, when bits are properly set, we can set these parameters:
 
{{Table}}
{{OBDth}}
{{OBDtr| 0x134 | int16    |EBEBEB| 0F 00      | 15          | minimal count of frames spent in "danger" zone (firingspread/projectile) after which AI2 will start reacting on it. I can catch why it is here, but let's take into account fact that player can react on sight of armed enemy. AI2 can react only on firingspread/projectile. So in case of AE AI2, I reccomend this field to be 4x nice big ZERO ^_^}}
{{OBDtr| 0x136 | int16    |EBEBEB| 00 00      | 0          | maximal count of frames for AI2 to realize it is in  "danger" zone; again I reccomend to set it zero. }}
{{OBDtr| 0x138 | float    |8C8CCC| 00 00 80 3F | 1.000000    | dodge timer; for how long should AI2 maintain dodge vector when it was created. From what I have seen, AI2 cannot create more than ONE dodge vector. So beware with this value and set it low (but not too much low or character will not react on dodge vector). If you set it high, you will see '''dodge wall bug''' pretty often.  }}
{{OBDtr| 0x13C | float    |8C8CCC| 00 00 80 3F | 1.000000    | dodge vector size; how much is AI2 forced to dodge from its original path; again be cautious, if you set it high, you will see '''dodge wall bug''' pretty often.  }}
{{OBDtr| 0x140 | float    |8C8CCC| 00 00 00 3F | 0.500000    | unknown; always the same }}
{{OBDtr| 0x144 | float    |8C8CCC| 00 00 C8 41 | 25.000000  | unknown; always the same }}
{{OBDtr| 0x148 | float    |8C8CCC| 00 00 80 3F | 1.000000    | unknown }}
{{OBDtr| 0x14C | int32    |FF00C8| 00 00 00 00 | 0          | unknown, affects only AI2 with weapon; if you set it, armed AI2 tends to predict its target's movement, experiment with it and see weird results. Try setting it small value (like 14 00 00 00), then try big value (like 80 00 00 00). With small value I got something like semi-random-AI2-movement. }}
{{OBDtr| 0x150 | int32    |FF00C8| 05 00 00 00 | 5          | unknown }}
{{OBDtr| 0x154 | int32    |FF00C8| 0F 00 00 00 | 15          | unknown }}
{{OBDtr| 0x158 | int32    |FF00C8| 3C 00 00 00 | 60          | unknown }}
|}
 
 
Rest of fileds ("unknown") can be affecting gunfire dodging, but up to this day I haven't figured how. If somebody can, I would be grateful.
 
 
Nightmare of AI2 modder:  '''dodge wall bug'''
:*When AI2 is trying to dodge and it collides with certain types of tiles in pathfinding grid, it tries to slide along and continue dodging. However, if vector aims directly into line of stop-dodge tiles (90°), then AI2 stops at the line and "waits" until vector disappears. Which results in stupid-looking bahavior X_X.
:Stop-dodge tiles:
::IMPASSABLE (red)
::DANGER (orange)
::DARK GREEN (stairs)
::DARK BLUE & BLUE (Border4, Border3)
 
How to minimize appearance of '''dodge wall bug''' : correctly set dodge timer and dodge vector size to small values, so you have high chance that when near stop-dodge tiles, AI2 will compute next vector that will point along wall, not inside wall. But even then it still happens. Anybody has source for fix ^_^ ?
 
 
Enemy awarerness and firingspread/projectile dodging:
:In order to be able to dodge, AI2 has to be in '''definite mode''' with attacker. That is state when either this AI2 sees attacker with his central vision field (see [[ONCC]]) or it was told about enemy via script(''ai2_attack'' "attacker" "victim" for example). Definite mode lasts from last central vision field contact until '''hostilethreat''' timer (see [[ONCC]]) runs out. During this period, AI2 is given exact location of the enemy it has '''definite mode''' with as a flag where it should move.
:I don't know why it is that way, but let's accept it until Neo finds it and sees what can be done. If dodging procedure needs coordinates of some enemy in order to work, we can make workaround that it is given some default values (0,0,0 ^_^) if there are currently not any other valid values. And if it is that way that dodging is simply allowed only for "definite mode" AI2s, then we (Neo ^_^) could  redirect it so it is avilable for '''strong awareness mode''' as well. Since any damage or projectile's red (alert ^_^) sphere put AI2 into "strong mode", it would be enough.
 
For info about awareness modes, pursuit etc. see [[CHAR]]. Maybe you will learn here something abut weird behavior you can sometimes see from AI2s ^_♦.


It should be noted that the logic is (mostly) fixed in the newest version of AE.


==Fixing the Mad Bomber==
==Fixing the Mad Bomber==

Revision as of 16:17, 15 September 2008

A page to document fixes to the awareness system

Documentation

Particles spawned with Dodge and alert radii (one without the other won't work so well), gain danger spheres, which can be seen with "ai_showprojectiles = 1". While inside the red sphere (alert), nothing really happens, except that the AI is alerted. When it inside the blue sphere, the AI will attempt to escape outside of the sphere, if the sphere was configured properly. To see if everything is working properly, turn on "ai_showpaths = 1". There should be two blue lines that project out of all AIs who are on the sphere's border or inside the sphere, toward the sphere, no matter where the AI or the sphere goes. (GIF screenshot coming soon)

Things that need to be done to avoid breaking AI danger awareness and dodging:

  • Danger spheres should not be attached to a character, wall, or anything else.
  • Danger spheres should not rapidly move and change direction.
  • Danger spheres must be moving (very slow moving works).
  • Danger spheres must have a dodge radius (without one it wouldn't be a sphere).

Fixing the Engine

(PC Only, for now)

Offset Old hex New hex Description
0x0009C07C
0x0009C080
0x0009C084
0x0009C110
30
34
38
30
6C
70
74
6C
projectile awareness fixed

All but the last one should be in the latest EXE.

Fixing AI Logic

Every ONCC has set of parameters which adjust how this ONCC will react on firingspread (ai2_showfiringspreads=1) and projectile dodge sphere (ai2_showprojectiles=1, it is blue sphere). Some of them are already known, some are not. Help please, user:Neo ^_^?


0x128 : General AI2 options:, those bits which interest us are:

  • 0x02 - firingspread/projectile dodge enabled for melee, with weapon AI2 does NOT dodge
  • 0x04 - requires 0x02 to be set; firingspread/projectile dodge enabled for weapons; if AI2 is armed, it tries to face shooter and fire back while dodging.
  • 0x08 - requires 0x02 to be set, overrides 0x04 if both are set; firingspread/projectile dodge enabled for weapons; if AI2 is armed, it doesn't shoot back, just tends to run away, not facing shooter (maybe behavior for case when civillians pick up weapon?)
  • 0x10 - unknown; only "advanced" classes (Konoko, Muro, Mukade, red Furies, red Elites and some more) have this bit set, I have feeling it does something with gunfire dodging, Neo help please?


Next, when bits are properly set, we can set these parameters:

Offset Type Raw Hex Value Description
0x134 int16 0F 00 15 minimal count of frames spent in "danger" zone (firingspread/projectile) after which AI2 will start reacting on it. I can catch why it is here, but let's take into account fact that player can react on sight of armed enemy. AI2 can react only on firingspread/projectile. So in case of AE AI2, I reccomend this field to be 4x nice big ZERO ^_^
0x136 int16 00 00 0 maximal count of frames for AI2 to realize it is in "danger" zone; again I reccomend to set it zero.
0x138 float 00 00 80 3F 1.000000 dodge timer; for how long should AI2 maintain dodge vector when it was created. From what I have seen, AI2 cannot create more than ONE dodge vector. So beware with this value and set it low (but not too much low or character will not react on dodge vector). If you set it high, you will see dodge wall bug pretty often.
0x13C float 00 00 80 3F 1.000000 dodge vector size; how much is AI2 forced to dodge from its original path; again be cautious, if you set it high, you will see dodge wall bug pretty often.
0x140 float 00 00 00 3F 0.500000 unknown; always the same
0x144 float 00 00 C8 41 25.000000 unknown; always the same
0x148 float 00 00 80 3F 1.000000 unknown
0x14C int32 00 00 00 00 0 unknown, affects only AI2 with weapon; if you set it, armed AI2 tends to predict its target's movement, experiment with it and see weird results. Try setting it small value (like 14 00 00 00), then try big value (like 80 00 00 00). With small value I got something like semi-random-AI2-movement.
0x150 int32 05 00 00 00 5 unknown
0x154 int32 0F 00 00 00 15 unknown
0x158 int32 3C 00 00 00 60 unknown


Rest of fileds ("unknown") can be affecting gunfire dodging, but up to this day I haven't figured how. If somebody can, I would be grateful.


Nightmare of AI2 modder: dodge wall bug

  • When AI2 is trying to dodge and it collides with certain types of tiles in pathfinding grid, it tries to slide along and continue dodging. However, if vector aims directly into line of stop-dodge tiles (90°), then AI2 stops at the line and "waits" until vector disappears. Which results in stupid-looking bahavior X_X.
Stop-dodge tiles:
IMPASSABLE (red)
DANGER (orange)
DARK GREEN (stairs)
DARK BLUE & BLUE (Border4, Border3)

How to minimize appearance of dodge wall bug : correctly set dodge timer and dodge vector size to small values, so you have high chance that when near stop-dodge tiles, AI2 will compute next vector that will point along wall, not inside wall. But even then it still happens. Anybody has source for fix ^_^ ?


Enemy awarerness and firingspread/projectile dodging:

In order to be able to dodge, AI2 has to be in definite mode with attacker. That is state when either this AI2 sees attacker with his central vision field (see ONCC) or it was told about enemy via script(ai2_attack "attacker" "victim" for example). Definite mode lasts from last central vision field contact until hostilethreat timer (see ONCC) runs out. During this period, AI2 is given exact location of the enemy it has definite mode with as a flag where it should move.
I don't know why it is that way, but let's accept it until Neo finds it and sees what can be done. If dodging procedure needs coordinates of some enemy in order to work, we can make workaround that it is given some default values (0,0,0 ^_^) if there are currently not any other valid values. And if it is that way that dodging is simply allowed only for "definite mode" AI2s, then we (Neo ^_^) could redirect it so it is avilable for strong awareness mode as well. Since any damage or projectile's red (alert ^_^) sphere put AI2 into "strong mode", it would be enough.

For info about awareness modes, pursuit etc. see CHAR. Maybe you will learn here something abut weird behavior you can sometimes see from AI2s ^_♦.


Fixing the Mad Bomber

Even if you have a fixed Engine and AI, characters will not avoid the Mad Bomber properly. While they may dodge, it will only be in one direction. This is because the sphere is completely static. Luckily for us, this is fixable.

You need to export the particle named "BINA3RAPmad_p04x" to an XML file (back it up before making any changes).

Make sure the following lines are set properly:

       <Properties>
           <HasVelocity>true</HasVelocity>
           <HasOrientation>true</HasOrientation>
           <HasPositionOffset>false</HasPositionOffset>
           <HasAttachmentMatrix>false</HasAttachmentMatrix>
       </Properties>

Now change <Events /> to:

        <Events>
            <Update>
                <AttractHoming>
                    <TurnSpeed>1000</TurnSpeed>
                    <PredictPos>0</PredictPos>
                    <HorizOnly>0</HorizOnly>
                </AttractHoming>
                <SetVelocity>
                    <Speed>10</Speed>
                    <Space>1</Space>
                    <NoSideways>0</NoSideways>
		</SetVelocity>
            </Update>
	</Events>

Replace the old BINA3RAPmad_p04.oni with this one, recombine your level0, and enjoy your new and improved bomber.