Home › Forums › Destiny of an Emperor › DoaE Artificial Intelligence Enhancements + New Tactics
Tagged: Destiny of an Emperor, Destiny of an Emperor hack, Destiny of an Emperor hacking, Destiny of an Emperor Rom, DoaE artificial intelligence, NES AI, NES Artificial Intelligence, NES hacking, ROM Hacking, Yuan Shu
- This topic has 645 replies, 10 voices, and was last updated 2 years, 11 months ago by MiDKnighT.
-
AuthorPosts
-
July 10, 2012 at 4:01 pm #5743MiDKnighTModerator
DoaE Artificial Intelligence Enhancements + New Tactics
You can use the following mod to test completed changes:
https://www.box.com/s/c28f0a02f152dc1cb29c
Please let me know if you find any buggies.
Phase 1: COMPLETE
Life and Raise will not be used on "alive" enemies. This causes an enemy to waste turns when it casts Life or Raise when all of its allies are alive.
Solution: If there are no dead enemies and the enemy was going to pick Life or Raise, go back to the drawing board and choose something else to do (could be an attack or different tactic). This is now done.
Phase 2: COMPLETE
If INT > 180 (or whatever value you choose for your mod) then do not waste turns. Ie…if any of the following tactics are already active, don't cast them again: Ji Rou, Huo Jian, Shui Jian, Ce Mian, Ji Mian, Cheng Nei, Yi Xin, Li Jian, Qi Shou, Bei Ji.
Full list of changes:
– Enemies with INT > 180 should be complete bastards now as they should not re-use tactics that are already active… Difficulty should be higher against smart enemies.
– If Thwart is already active, they won't run it again (unless negated or expired).
– If the good guys used Thwart, smart enemies (180+) with negate will only attack or attempt to negate.
– If Evade is already active, they won't run it again (unless negated or expired).
– If Guard is already active, they won't run it again (unless negated).
– If Douse is already active, they won't run it again (unless negated or canceled by Thwart, Evade, or Guard).
– If Levee is already active, they won't run it again (unless negated or canceled by Thwart, Evade, or Guard).
– If Barrier is already active, they won't run it again (unless negated or canceled by Thwart, Evade, or Guard).
– If Doubt is already active vs one of your allies, they shouldn't try to doubt the same person.
– If Mislead is already active vs one of your allies, they shouldn't try to mislead the same person.
– If Haste is already active for one of the bad guys, they won't run it again (unless negated).
– If Rally is already active, they won't run it again (unless negated).
Phase 3: COMPLETE
Use this save state (put in your fcs folder and use save state 1) then just walk around, get into a fight, and use "Charge": https://www.box.com/s/918c929430399c7a14ff
– New tactic called "Charge" (power pill effects) to replace Cheng Nei
…Uses Cheng Nei's tactic slot.
…If "Charge" is used, the Cheng Nei status is *not* added.
…Still using Cheng Nei's success/fail code so INT does play a factor.
…Calls power pill code for a guaranteed critical hit then may hit again with a normal hit due to agility based attacks.
– Cheng Nei effects added to Wuo Jian
– Cheng Nei effects added to Shui Jian
Phase 4: COMPLETE
Make Ji Rou, Ce Mian, and Ji Mian mutually exclusive. Ie… If you cast one it cancels out the other two. This would prevent enemies from preventing you from doing anything and it would also prevent you from being too powerful if you used Lud's "each general has his own tactics" enhancement.
Full list of changes:
– If Ce Mian is used by an ally or enemy, it cancels Ji Mian, Ji Rou, Wuo Jian, Shui Jian, and Cheng Nei
– If Ji Mian is used by an ally or enemy, it cancels Ce Mian, Ji Rou, Wuo Jian, Shui Jian, and Cheng Nei
– If Ji Rou (Guard) is used by an ally or enemy, it cancels Ce Mian, Ji Mian, Wuo Jian, Shui Jian, and Cheng Nei
Phase 5: COMPLETE
– Combine Wuo Jian, Shui Jian, and Cheng Nei into a new tactic called "Protect" (in Wuo Jian's slot).
– This is to make room for the new "Charge" tactic and "Duel" tactic in phase 6.
– Charge (critical hit) tactic replaces Cheng Nei.
– Enhance An Sha to make it less prone to save state cheating and expand the "No An Sha" list.
Protect:
– Protect combines Wuo Jian, Shui Jian, and Cheng Nei into 1 tactic.
– Enemies will not use it if Ji Mian, Ce Mian, or Ji Rou (Guard) are active.
– The tactic will fail if you use it with Ji Mian, Ce Mian, or Ji Rou (Guard) active as those 3 tactics are more powerful.
More info on "Charge":
– Uses Cheng Nei's tactic slot.
– If "Charge" is used, the Cheng Nei status is *not* added.
– Guaranteed success unless the target is dead (like Final Fantasy 1).
– Calls power pill code for a guaranteed critical hit then may hit again with a normal hit due to agility based attacks.
More info on the Enhanced An Sha:
– The attacker's INT will be compared to the defender's INT. If the defender has 20+ more INT than the attacker then An Sha will fail.
– If the defender is smarter than the attacker (by less than 20) then it's possible for the tactic to succeed but it will be pretty rare.
– If the attacker is smarter than the defender, the more he is smarter the better the chance An Sha will succeed.
– But if an officer has INT > 160, it will be twice as hard to An Sha them vs an officer with INT < 160.
– There is an additional "No An Sha" list where you can add up to 32 officers (in addition to the original 7). This is stored at 0x44F0-0x450F. Simply put general IDs there if you don't want them An Sha'd.
– There is a "secret sauce" formula to generate a "random number" that won't change much in battle unless major changes happen in the battle. That will make save state hacking a lot tougher if not impossible. If you save state and re-cast An Sha over and over, you'll almost definitely get the same result every time.
– As for An Sha A.I., an enemy won't attempt An Sha on someone who is 15+ INT smarter than them.
Phase 6 – COMPLETE
DUEL Tactic
How it works:
1. Caster initiates "duel" with custom text:
2. Target decides to accept or reject without user input. Higher INT generals will weigh the odds of winning and intelligently decide whether to accept or reject. Lower INT generals are more likely to blindly accept. Higher STR generals are also more likely to accept. Lower INT generals may receive some kind of penalty for rejecting (Yi Xin and loss of Bei Ji/Qi Shou status). A very high INT general or general on the "rare duel list" (meant for rulers) might send a stronger general to duel in their place. Ie…if you cast duel on Zhuge Liang, he sends Zhao Yun out to duel. The "Rare Duel" list is at 0x44D0-0x44EF. Just put general IDs there (for rulers mainly…like Cao Cao, Sun Quan, Liu Bei, Dong Zhuo, Yuan Shu, etc…)
Example of someone accepting a duel and taunting back:
3. If the duel is accepted, the two duel participants step forward and clash:
There are many possible outcomes for a duel:
Close Match:
– Draw (2/3rd chance) – Neither participant gets any status change
– Both participants An Sha'd (1/3rd chance)
Clear Winner:
– One person is An Sha'd (2/3rd chance)
– Winner but both parties unharmed (1/3rd chance)
* The winner will either receive an agility boost (2/3rd chance) or a Bei Ji boost (1/3rd chance) after victory.
Mismatch (Think: Lu Bu vs Song Yong) –
– One person is An Sha'd (1/3rd chance)
– Loser flees and is his own men are disgusted (1/3rd chance). The fleeing general will lose Qi Shou and Bei Ji status and get Yi Xin status.
– Loser gets KILLED (An Sha'd and removed from the game) (1/3rd chance but this will also have stat protections (nobody over 220 STR, AGI, or INT will be killed unless on the mismatch list) and a no kill list. If the officer is protected it will just be An Sha).
Important lists:
4450-446F (mismatch list – winner)
4470-448F (mismatch list – loser)
4490-44CF = no kill list
44D0-44EF = rare duel list (for rulers mainly)
44F0-450F = bigger no an sha list
The "mismatch list" overrides any protections (no kill list or stat protections). If 2 generals on the mismatch list meet in a duel the mismatch loser will likely die. How it works… You put the winner in the first 2 rows and the loser in the last 2 rows. However, they must line up exactly. For example if I wanted Guan Yu to automatically kill Yan Liang in a duel I could put Guan Yu's general ID at 0x4458 and put Yan Liang's general ID at 0x4478 (exactly 2 rows under). Now if Yan Liang sees Guan Yu in battle he better run…
The formula for winning a duel is:
Own STR: 50%
Own AGI: 16.5%
Party Leader's STR: 16.5%
Secret Sauce Random Number: 16.5%
The final number from the above is compared to the opponent's final number of the above (but they have a different secret sauce random number). If they either only has a +10 or less advantage (0A) there is a draw, otherwise the one who wins by 10+ is the victor.
That said dueling against Lu Bu where Lu Bu is leading the enemy party would be very, very tough to beat but not impossible.
After Duel, there are 4 tactic replacements after this phase:
– Cheng Nei (Tactic ID: 10)
– Wuo Jian (Tactic ID: 11)
– Shui Jian (Tactic ID: 12)
– Original An Sha (Tactic ID: 1A)
With:
– Charge (Power Pill Affects – Tactic ID: 10)
– Protect (Wuo Jian + Shui Jian + Cheng Nei – Tactic ID: 11)
– Duel (Tactic ID: 12)
– Enhanced An Sha (Tactic ID: 1A)
Phase 7: COMPLETE
Make all damage and healing tactics more level based… Ie…if you cast Lian Huo at level 10 it will be stronger than it would be at level 1. This would allow us to consolidate fire and water tactics down to 3-4 each and have other non-elemental damage based tactics (perhaps "Arrows" and "X-bows" that always succeed and have damage increased by STR)
– Tactic damage is level, soldier, and optionally STR, AGI, and INT based.
– To calculate damage, use this spreadsheet and fill in the yellow boxes. The final estimated damage potential is in the gray box for each level. –> https://www.box.com/s/c550a40e0c0d8adf5cd7
– There are 3 lists to control whether a tactic gets a STR, AGI, or INT damage bonus. Simply put the tactic ID on the list (ie…01 for Lian Huo)
– There is a list to control whether a damage/healing tactic always succeeds. For Lian Huo you would put "01" at 0x5720, Ye Huo at 0x5721, etc…
Lists are:
0x5720-0x572F: Tactic always succeed list. 01=always work (only for tactics 01-0F)
0x5730-0x573F: STR bonus list (put tactic ID in this list for STR bonus)
0x5740-0x574F: AGI bonus list (put tactic ID in this list for AGI bonus)
0x5750-0x575F: INT bonus list (put tactic ID in this list for INT bonus)
Phase 8: TESTING
Add "Profiles" for certain officers.
– Water tactic restriction is removed, you and the enemy can and will use water tactics anywhere.
– Choice between attack vs tactics is the same as before but once we decide to use a tactic we randomly pick between the 8 slots then the A.I. is applied. That is…unless an officer has a "profile".
– You can assign "profiles" to different officers. There are up to 29 profiles available. To assign a profile:
0x7A400-0x7A4FF is where you assign a profile to an officer. If Guan Yu's general ID is A9 you would assign his profile at 0x7A4A9 (last 2 numbers = general ID). If Lu Bu's general ID is C0 you would assign his profile at 0x7A4C0 (last 2 numbers = general ID). The profiles are:
00 = default (normal/random DOAE behavior)
01-1D = Custom profile
You set the attack/tactics for each profile at:
Profile Number – Location
01 – 0x7A510-0x7A51F
02 – 0x7A520-0x7A52F
03 – 0x7A530-0x7A53F
04 – 0x7A540-0x7A54F
05 – 0x7A550-0x7A55F
06 – 0x7A560-0x7A56F
07 – 0x7A570-0x7A57F
etc…
A profile would look like this:
FF FF FF FF 00 00 00 01 01 01 02 03 04 05 06 07
FF = attack and all the other numbers = tactic slot number.
With a profile like this, this officer will attack 1/4th of the time (4/16), he will use the tactic in slot 00 or 01 18.5% of the time (3/16) or will use a tactic in slot 02, 03, 04, 05, 06, or 07 6% of the time each (1/16).
As you can see with this system different officers can have unique personalities. You might have an officer that favors duel, favors attack, favors attack tactics, favors healing, etc… There are tons of possibilities for different personality types.
July 10, 2012 at 5:38 pm #43832sonic.penguinModeratorQuote:Additional item: if Ce Mian is active, (smart) enemy switches his tactic to Jie Ce (Negate) if he has that tactic.so do they keep trying to negate even if they fail over and over?
Phase 1 and 3 is a must.
Phase 4 is a good idea as I saw in Zylowolfbanes playthrough, it was just Thwart+ Ji Mian for every battle
Phase 5 sounds fun if at all feasible to do.
July 10, 2012 at 5:45 pm #43833MiDKnighTModeratorQuote:Additional item: if Ce Mian is active, (smart) enemy switches his tactic to Jie Ce (Negate) if he has that tactic.so do they keep trying to negate even if they fail over and over?
Here's a practical example…
Your guy casts Ce Mian…
In the current round everybody does their normal stuff… Enemy tactics don't work.
Then if Ce Mian lasts until the next round… NOW the (smart) enemy knows they can't use tactics. In the normal enemy turn we might have something like:
Enemy 1 attacks
Smart Enemy 2 uses fire tactic
Enemy 3 attacks
Smart Enemy 4 uses Bei Ji
Dumb(er) Enemy 5 uses water tactic
Enemies, 1, 3, and 5 proceed as normal. But enemies 2 and 4 who are smart and using tactics know they are blocked via Ce Mian so switch their tactic to "Negate" assuming they have it. If the Ce Mian holds another round any smart generals using tactics will try to do the same.
So in other words smarter enemies will be trying to ax the Ce Mian if they are using tactics. This is something a human opponent would try to do…which is the point of the A.I. boosting.
July 10, 2012 at 7:34 pm #43834MiDKnighTModeratorPhase 1 complete but I'd appreciate some testing:
0x783BF: 4CDFA6
0x7A6EF: A90E2082C4
0x30360:
A91E2082C4188AA6789DE46184BEBC00
62C01DB00CAAE678A4BEA90085BE4C50
83A8ADFA01690585BFC8C00AD002A005
B9AA60C900F0F2B99E60C900F005C6BF
4C9983989DE461C6BFA5BFC900D0DABD
E461A8B99E60C900F005A91E2082C4A9
0085BEE6784C5083 <– Enemy target selection code (the hard part)
Solution in bold in the Enemy Target Choice code for Life/Raise:
00:8355:18 CLC
00:8356:8A TXA
00:8357:A6 78 LDX $0078 = #$05 <– General who's turn it is
00:8359:9D E4 61 STA $61E4,X @ $61E9 = #$02 <– Store target
00:835C:84 BE STY $00BE = #$00
00:835E:BC 00 62 LDY $6200,X @ $6205 = #$1E <– What tactic are they using?
00:8361:C0 1D CPY #$1D <– Is it life or raise?
00:8363:B0 0C BCS $8371
00:8365:AA TAX
00:8366:E6 78 INC $0078 = #$05 <– Go to next ally.
00:8368:A4 BE LDY $00BE = #$00
00:836A:A9 00 LDA #$00
00:836C:85 BE STA $00BE = #$00
00:836E:4C 50 83 JMP $8350
00:8371:A8 TAY
00:8372:AD FA 01 LDA $01FA = #$06 <– Random number
00:8375:69 05 ADC #$05 <– Cycle through at least 5 times to look for dead allies
00:8377:85 BF STA $00BF = #$00
00:8379:C8 INY
00:837A:C0 0A CPY #$0A <– If we've hit the last ally, start at top again
00:837C:D0 02 BNE $8380
00:837E:A0 05 LDY #$05
00:8380:B9 AA 60 LDA $60AA,Y @ $60AF = #$54 <– Load general ID of target
00:8383:C9 00 CMP #$00 <– Is there a general in this slot?
00:8385:F0 F2 BEQ $8379
00:8387:B9 9E 60 LDA $609E,Y @ $60A3 = #$80 <– Is the target alive or dead?
00:838A:C9 00 CMP #$00 <– Ignore and choose a different target if they are alive
00:838C:F0 05 BEQ $8393
00:838E:C6 BF DEC $00BF = #$00
00:8390:4C 99 83 JMP $8399
00:8393:98 TYA
00:8394:9D E4 61 STA $61E4,X @ $61E9 = #$02 <– Store target to bring back
00:8397:C6 BF DEC $00BF = #$00
00:8399:A5 BF LDA $00BF = #$00
00:839B:C9 00 CMP #$00
00:839D:D0 DA BNE $8379
00:839F:BD E4 61 LDA $61E4,X @ $61E9 = #$02 <– Load target
00:83A2:A8 TAY
00:83A3:B9 9E 60 LDA $609E,Y @ $60A5 = #$80 <– Is the target alive or dead?
00:83A6:C9 00 CMP #$00
00:83A8:F0 05 BEQ $83AF <– If target is alive, choose something else to do.
00:83AA:A9 1E LDA #$1E
00:83AC:20 82 C4 JSR $C482
00:83AF:A9 00 LDA #$00
00:83B1:85 BE STA $00BE = #$1E
00:83B3:E6 78 INC $0078 = #$07
00:83B5:4C 50 83 JMP $8350
The other changes are jumps back to where we pick something else to do at $A6E4.
With these changes enemies should never use life or raise on guys that are alive. Will update the guide with these changes.
July 10, 2012 at 9:14 pm #43835sonic.penguinModeratorQuote:So in other words smarter enemies will be trying to ax the Ce Mian if they are using tactics. This is something a human opponent would try to do…which is the point of the A.I. boosting.So what if Zhuge Liang is leading and they keep failing @ negating your party? Do they keep trying turn after turn?
Will try your code and see how it turns out
July 10, 2012 at 10:23 pm #43836MiDKnighTModeratorQuote:So what if Zhuge Liang is leading and they keep failing @ negating your party? Do they keep trying turn after turn?A smart enemy will either attack or use negate if they are Ce Mian'd. They will know that doing a fire or water tactic is futile. And even if Zhuge Liang is leading they still have some chance at negating (I think).
July 11, 2012 at 12:19 am #43837sonic.penguinModeratorSo in order to use "negate", do you have them selecting a specific tactic slot or the actual tactic itself?
July 11, 2012 at 12:43 am #43838MiDKnighTModeratorQuote:So in order to use "negate", do you have them selecting a specific tactic slot or the actual tactic itself?I've actually got a preliminary version of this code done. It chooses the tactic itself (tactic #19). Right now it is switching to negate even if they don't have it but hopefully I can change it to only switch to negate if they have the tactic. But then again, if you're using 8 tactics and are a high enough level to have Ce Mian, then your highly intelligent enemy should have negate… So right now it should work fine for the 8 tactic mods…
I've got the framework set up for phase 2. Just got to code it up. I expect phase 2 might be finished in the next few days.
July 11, 2012 at 2:54 am #43839DragonAtmaModeratorIf you're going from An Sha to Duel, then you should do something that's consistent locally but not globally.
For example, suppose my game has Xiahou Dun defeat Ma Dai in a duel. Minor changes (such as hitting reset or winning a random battle) shouldn't change that. But a nontrivial change — such as my recruiting Yu Jin — should be enough that Ma Dai just might defeat Xiahou Dun.
July 11, 2012 at 3:37 am #43840MiDKnighTModeratorYa I'll have to put more thought into that. Once I have a formula I might not even reveal the "secret sauce" but can make it available for others to use. I'll think about it more after phase 4 :)
July 11, 2012 at 3:59 am #43841DragonAtmaModeratorThat's okay, we'll Shui Long the secret sauce out of you yet! :Þ
July 11, 2012 at 4:44 am #43842sonic.penguinModeratorWell, if its anything like ROTK, there is a "CHANCE" that the officer will accept the duel whether you want to or not. What would be kind of cool is if you could make the duel, instead of Ansha, do some kind of "all out function" between the two officers and not everyone… or you could just ax the guy :P
As far as negating goes, having a low limit on it I've found to be just ridiculous. I mean, what 180 int. guy is going to be negating your 240+ int guys? I've been setting my "negate" prone officers to be of at least 220+ int, that way it is more believable that they actually CAN negate you, even if not always successful.
July 11, 2012 at 5:02 am #43843DragonAtmaModeratorPresumably the chances for negate and such working can be something like this:
1/16 of the time: (YourInt) out of 256 chance of it working.
1/16 of the time: (EnemyInt) out of 256 chance of it NOT working.
4/16 of the time: (128+(.5*(YourInt-EnemyInt))) out of 256 chance of it working.
6/16 of the time: (128+YourInt-EnemyInt) out of 256 chance of it working.
4/16 of the time: (2*(64+YourInt-EnemyInt)) out of 256 chance of it working.
That way, there are times when you have a chance of it working no matter how smart the opponent is and times where there's a chance of it failing no matter how smart your user is. Usually, though, it's influenced by who's smarter!
Also you'd think there would be some Str-based skills. Sure, Zhang Fei won't be pulling off any Shui Longs anytime soon, but I'm sure he could do some excellent cavalry charges…
July 11, 2012 at 12:53 pm #43844MiDKnighTModeratorQuote:do some kind of "all out function" between the two officers and not everyone… or you could just ax the guyIdeally (and I'm not sure how hard all this to do is yet):
1. Enemy proposes duel
2. Your guy accepts or rejects the duel without your input. It is based on STR and INT. (high INT is used to figure out if it is wise for him to accept the duel – ie…Zhuge Liang won't be accepting any duels unless it is vs Song Yong's sister).
3. If the duel is accepted, ideally both participants march to the middle and either someone gets axed or there is a draw.
Quote:Also you'd think there would be some Str-based skills. Sure, Zhang Fei won't be pulling off any Shui Longs anytime soon, but I'm sure he could do some excellent cavalry charges…Absolutely, I have two ideas for this.
1. The "power pill" type tactic. "Charge" would be a perfect name for that I think.
2. OK a little secret sauce reveal… I'm thinking part of the duel formula could be the STR of the guy leading your party. Let's say Ma Chao challenges Xu Chu to a duel. If Zhuge Liang is leading Ma Chao's party and Zhang Liao is leading Xu Chu's party then Xu Chu probably wins. However if Zhang Fei is leading Ma Chao's party and Guo Jia is leading Xu Chu's party then Ma Chao probably wins.
Now to get sonic all excited… Imagine Lu Bu leading a party… That makes everyone under him a better "dueler" and makes Lu Bu himself nearly invincible in duels.
July 11, 2012 at 1:03 pm #43845MiDKnighTModeratorAnother interesting duel twist idea… What if you challenge Zhuge Liang to a duel and after weighing the odds he sends out Zhang Fei on his behalf? Ouch… I probably wouldn't do that one though because of complexity but I can certainly look into it.
-
AuthorPosts
- You must be logged in to reply to this topic.