• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 18, 2024, 10:54:14 pm

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen, RetroArch, and Duckstation are recommended for playing/testing, pSX is recommended for debugging.


Hex Discovery on Status Effects

Started by formerdeathcorps, April 10, 2010, 02:03:49 am

formerdeathcorps

OK, I think I might have just made a discovery on AI targeting of units with a given status effect.

Razele was able to get the AI to "target" transparent units.  I think what he actually did was to set transparent units to be attacked by the AI if transparent units are within range of the AI (meaning that if you had one transparent unit in an inaccessible corner of the map, you could still never lose as long he didn't do anything or take damage).  You can test this at Nogias by having a transparent unit do absolutely nothing in the corner.  The AI will not close in on your unit as long as your unit does not reveal himself.  Of course, if the AI can target the map, you're always in range, and if you have some other negative status effect, the AI will consider that as a valid reason to target you.

In BATTLE.BIN, the hex near the transparent fix was:
42 30 0F 00 40 10 80 00, where Razele changed 40 to 00.
The 4 bytes that preface it appear exactly 12 times in BATTLE.BIN.  There are exactly 12 status effects in which the AI will not target a unit: Charm, Confuse, DS, Dead, Wall, Transparent, Jump, Petrify, Charging (if set as innate rather than charging a spell, only the charging unit or any monster will be attacked), Perform (if set as innate rather than caused by preparing a dance, only the performing unit or any monster will be attacked), Crystal, and Treasure.  I suspect there may be a one-to-one correspondence between the two.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.


Timbo

Now, I understand the balance issues involved in transparency.  Transparency gives the transparent unit a 100% attack rate and the AI never uses transparency against the player and furthermore Transparency causes the AI to ignore the transparent unit but the player can still attack the AI should they actually use transparency against you.  

So, I absolutely understand that you guys want to fix this status, but what I don't understand is a combination of how and why you plan to actually fix this as opposed to removing it entirely.  So, are you trying to make it so that you can still get the attack bonus from transparency while simultaneously allowing the AI to target the player, are you trying to make it so the player cannot target the AI should the AI decide to use it, or are you trying to nerf both the attack bonus and the non-targetability so that transparency becomes a purely aesthetic status effect?  Finally, if you are trying to make it so that it doesn't do anything, what is the point?

FDC, You are probably the most helpful guy on these board, so I'm not trying to be rude and I'm not knocking what you are doing at all.  I just want to understand.  I tried asking about this once before in chat, but I never got a very good response.  I really like the idea of hiding but more importantly I like the idea of balance and challenge.  

Either way, keep up the good work.
  • Modding version: PSX
  • Discord username: Timbo

Samuraiblackbelt

hint: don't expect anything from chat
<JoZ> I'm not Wiz. Even if I were, I wouldn't be narcissistic enough to go under an alt and comment on my own team.

PGF: "You are ignoring this user. Click to see their post."

Timbo

  • Modding version: PSX
  • Discord username: Timbo

formerdeathcorps

What do you mean?  I actually give help on Chat.

The problem with transparent is that the AI cannot "see" transparent units but a player can (in fact, if you edited vanilla to create an invisibility spell, the AI would always spam on their first turn unless they had haste or damage).  Razele's fix is incomplete because you can still exploit it to simplify most enemy battles because all he did was change it from never target to target only if unit is in range of AI units.  Thus, if at any time, your entire squad becomes transparent and out of range of the AI, the AI will permanently switch to run like a rabbit (even when units become visible again) and hide in one corner of the map (0,0--I think).  With that setting the AI units will not move to protect each other (if one unit strays out of range of the rest) and you can then lure them one by one and kill them all that way.  Of course, this won't work for every map and battle, but to fix it in its current state, I would have to add, to each battle I don't want the player to exploit, Razele's hack + one of the following:
1) Make the AI have a target map unit (or similarly long range unit).
2) Make the AI start very close to the player so each unit can attack.  This has the problem of favoring physical builds over all others, though.
3) Find a way to change the AI behavior either towards transparent or their default attack pattern.  Their default attack pattern when there are "no valid targets" should be to have all units jointly move to scour randomly chosen points on the map.  Similarly, if that can't be done, the AI behavior towards transparent should be target transparent units only when no other valid targets exist (since they are hidden, after all), but to openly move towards them (if the player only has transparent units).  This code already exists, I think, for blood suck.

Razele's hack has two parts.  One is removing the attack bonus (which I'm not deleting).  The other is the semi-fixed AI targeting hack (which I'm trying to improve/expand for other status effects).  Ideally, you want the AI to also target units with DS, Wall (which is now Astra in my game), and Confuse too.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

Timbo

It's true fdc is incredibly helpful in chat.  I learned more from him about fftpatcher in one chat session then just about anything from anyone on the forum (I hammered him with questions for about 30 minutes or so). I think Samuraiblackbelt's comment, and my corresponding comment was more about chat in general.  It's more of a silly fun kind of place then an educational one.

Now onto the business of transparency.  I was under the impression that you were just making the AI simply ignore transparency status.  What you are doing is probably the best thing I've ever heard of.  It adds some depth and makes it usable without being completely broken.  

Good Luck my friend.
  • Modding version: PSX
  • Discord username: Timbo

Samuraiblackbelt

Quote from: "formerdeathcorps"What do you mean?  I actually give help on Chat.

don't EXPECT anything from chat, you can go there and HOPE that someone will be there to help you, but there's a good chance there won't or that you will be ignored.
<JoZ> I'm not Wiz. Even if I were, I wouldn't be narcissistic enough to go under an alt and comment on my own team.

PGF: "You are ignoring this user. Click to see their post."

formerdeathcorps

OK, I'm the idiot here.  Razele's hack works perfectly as expected; I just messed up something else and caused the stupid AI behavior to occur.  Zodiac said that the 4 bytes after 42 30 0F 00 are ASM commands so I probably won't be able to simply change a byte and predictably change behavior.  However, I do think these correspond to status effects: all the 40 10 00 00 stuff has to do with charging/performing, for example.  Perhaps we need to expand our investigation to all hex offsets after 111000 in BATTLE.BIN in the form 42 30 XX 00 40 10 YY 00 where everything sharing the same 40 10 YY 00 should correspond to a given status effect.  Zodiac, Vanya if you have time, please look into this.

The 12 offsets in BATTLE.BIN are:

42 30 0F 00 43 10 80 00 (x1983A)
42 30 0F 00 63 30 00 1A (xE0F02)
42 30 0F 00 40 10 FF 00 (x11918A)
42 30 0F 00 40 10 04 00 (x11DB42--if 40 is changed to 00, the AI will attack charmed units)
42 30 0F 00 40 10 00 00 (x119186--if 40 is changed to 00, the AI will not attack any unit except units with charging status, which they'll hone in on--Note: before, they would attack monsters even if the monster wasn't charging; if no units are charging, the AI will act normally regardless of whether this is 40 or 00)
42 30 0F 00 40 14 00 00 (x125566)
42 30 0F 00 40 10 10 00 (x12D8CE)
42 30 0F 00 40 10 21 00 (x12DAFA)
42 30 0F 00 40 14 07 00 (x12EDD2)
42 30 0F 00 40 10 00 00 (x12F2BA--if 40 is changed to 00, the AI will cast status magic on units without charging status, which they normally would not attack)
42 30 0F 00 40 10 80 00 (x12FD62--Razele changed 40 to 00 to make the AI attack transparent)
42 30 0F 00 40 10 00 00 (x1322DE--if 40 is changed to 00, the AI will only consider units with charging status as valid targets--Note: the default AI behavior for no valid targets is run like a rabbit, which targets non-valid targets only if they are in range and flagged to be targetable [as in not having DS/charm] )

Note, the AI will target you if you cast confuse on yourself or if your initial/innate status is confuse.  The AI will only not target units that they personally confused in battle.  This, however, does not apply to charm or DS.  If your confused unit has any other negative status (including charging/performing but not berserk) that does not also have an ignore trigger, the AI will attack you.  I think it's because confuse/berserk/charm have special coding to only work properly when cast by a given side.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

R999

This is just some notes from our discussion earlier fdc,


1. If AI casts transparent on THEIR team, they will resort to "Run like a rabbit" behavior if using Razele's Transparent hack. Note that Run like a Rabbit does not mean they won't attack. But if they are in a corner they will try to stay in that corner unless there is very little threat on the map.