Home › Forums › Destiny of an Emperor › Destiny of an Emperor RH Guide ( MOVED! to http://doaerhguide.wikidot.com )
Tagged: Battles, Destiny of an Editor, Destiny of an Emperor, Destiny of an Emperor hacking, Destiny of an Emperor Mods, Destiny of an Emperor Rom, DoaE rom, DoaE Rom hacking, FCEUX, Feidian, Graphics, hacking DoaE, Map, NES ROM hacking, nes8 template, Portraits, ROM Hacking, ROM hacking information
- This topic has 985 replies, 17 voices, and was last updated 2 years, 9 months ago by
MiDKnighT.
-
AuthorPosts
-
November 9, 2011 at 1:38 am #39805
MiDKnighT
ModeratorWell it's not looking good Lud. We are fortunate that we can use the new ROM pages for graphics but with the MMC1 format (MMC1 ROMs have a max size of 256k) I doubt we can do much assembly hacking on the new ROM pages. At least we won't be able to use $2000-$7FFF while on those pages… From reading the above links I understand the page switch method more now. It loads 5 times into register 3 to do a page switch. In the DoaE ROM register 3 lives in $FFF9.
November 9, 2011 at 2:02 am #39806ludmeister
ParticipantThanks for looking into it, MiDKnighT. I was afraid it was going to be a brutal difficulty. At the very least, we can use those extra pages as transitory pages, branching into the extra space that may be lurking in pages 00 through 0E… I've done that with the Agility augmentation code that I'm basically ready to post. It's coming… real soon.
When all else fails... manipulate the source code.
November 9, 2011 at 2:21 am #39807ludmeister
ParticipantAgility based multi-attacks:
Edits:
@ 0x3a1d2-0x3a1f9:
—- a91c 2082 c400 0000 0000 0000 0000
0000 0000 0000 0000 0000 d006 208d ab4c
5aa1 0000 0000 0000 a678 …..
@ 0x721d0-0x721f9:
0000 0000 0000 004c fbb1 0000 0000 0000
0000 0000 00a9 0e20 82c4 0000 0000 0000
0000 00a9 0e20 82c4 0000
@ 0x73200-0x7320f:
0000 0000 0000 0000 0000 00a9 0b20 82c4
@ 0x73300-0x7330f:
0000 0000 004c e3a1 0000 0000 004c d5a1
@ 0x2f210-0x2f30f (0x100, or 256 bytes)
bdd0 61d0 2aa9 409d d061 980a 0a0a a8b9
0061 c9c7 f010 eaea eaea eaea eaea eaea
eaea c9cb d003 4c9d b2c8 9829 07d0 e0a4
4ab9 b461 8510 a900 8511 bdd0 61a8 c040
f017 8884 12a9 00a0 3cc6 1088 c510 f02d
c000 d0f5 a412 4c3e b2a9 0085 12a5 ad65
ae65 10ea 85ad 290f a8b9 e0b2 8515 205b
c138 a44b b9b4 614c 8ab2 eaea ea4c d7b2
a44a fed0 61a9 004c f8b2 a8a9 00c6 1188
c511 f0e9 c000 d0f5 4c80 b200 00a5 ad65
ae65 1085 ad4c f8b2 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 00ea eaa9 00a4 4a4c f0b2
1926 3340 4c59 6673 8099 a6b3 c0cc e6ff
a91c 2082 c400 0000 a91c 2082 c400 0000
What it does:
1. Keeps the Bow/Crossbow bonus hit… applies this first. This is only valid for allies, as only allies have item packs.
2. After that, Agility is modified by a random percentage from a table @ 0x2f2f0. This is achieved by multiplying by a chosen value, then dividing by 256.
1926 3340 4c59 6673 8099 a6b3 c0cc e6ff
These values correspond to these percentages:
10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 60%, 65%, 70%, 75%, 80%, 90%, 100-%
3. Then, that modified value is compared with the defender's agility.
4. If the defender's Agility is greater, then the turn ends. If not, a new attack is performed…. and the check is done again.
5. Each successive hit renders a cumulative 60 Agility penalty to all checks against the enemy's agility. Therefore, the chance to make another attack becomes nil very quickly… only the very fastest officers ever get a legitimate chance for three hits… and only on slow generals.
6. The Agility-based check is valid for allies as well as enemies hitting you… if you plan on using this modification, Agility will be a very important stat and thought will need to be spent on how you balance out officer's Agility throughout the game.
7. One interesting thing about this implementation… bonus attacks are not always awarded. A 255 Agility officer could hit a 160 Agility officer up to three times (255 – 120 penalty = 135… which would automatically fail that check against 160 Agility. However, because of the random table, it is *much* more likely that they would strike once, or twice.
Possible customization to the algorithm:
1. There are twelve "EA" NOPs in 0x2f226-0x2f231. These are intentionally left in, because that space is perfect for placing up to 3 extra item checks. This is what an item check looks like:
0x2f222 – 0B:B212:
Code:C9 C7– CMP #$C7(Is it an equipped Bow?)
0x2f224 – 0B:B214:
Code:F0 10– BEQ $B226*
*$B226 = $B214 + $#0010 (from statement) + $#0002 (trust me). To create a valid branch, you'll need to take whatever address to which you want to branch (always $B226 here), subtract the address of your branch statement (in this case, that's $B214), and subtract also the length of your branch statement (in 6502 assembly, I believe this value is always 2). That's how I arrived at the "10" at 0x2f225.
2. Obviously, the table for percentages (0x2f2f0-0x2f2ff) is editable.
3. To remove the Random Agility check, and use this edit simply for expanded item checking:
Change 0x2f23f-0x2f241 to "4cd7b2"
0x2f23f – 0B:B22F:
Code:4C D7 B2– JMP $B2D7(what that statement says)
4. To cap the number of extra hits from Agility at one, do this:
Change 0x2f252-0x2f254 to "4cd7b2"
0x2f252 – 0B:B242:
Code:4C D7 B2– JMP $B2D75. To edit the cumulative Agility penalty on successive hits, edit this:
Change 0x2f258 to whatever you want.
0x2f257 – 0B:B247:
Code:A0 3C– LDY $#3c(Default penalty is 60)
Let's review.
1. Any bonus attack for equipment/item possession is applied first. There is a maximum of one item-based attack bonus. After that's out of the way…
2. Attacker Agility is first penalized based on the number of attacks made.
3. Then, it is multiplied by a random value from the table.
4. Then, the result is divided by 256.
5. Finally, this value is compared against the defender's agility.
6. If, after all that, the defender's agility is lower, a new attack is made… and after that attack is completed (and there's still an enemy standing), we'll do this check all over again.
7. With my default setup, it's rarer than it sounds to make extra attacks… unless the defender's Agility is abysmal.
Happy serendipities
In stock DoaE, if you get two attacks (for example, via equipped Crossbow), and manage a critical hit on strike #1, strike #2 is an automatic critical. This has been corrected, at least within successive hits based on Agility. I believe the auto-critical is also corrected if you make a critical on strike #1 with an equipped bow, though this has not been explicitly tested.
Errata
I noticed that after I had used a successful Negate tactic, Pang Tong got a second hit. That was not expected, but not bad. I wonder if this modification will suffer from the same difficulty that the Ambush tactic does… if an officer successfully uses Ambush and uses a Healing tactic the next round, often times he will strike his ally. More testing may be necessary to track this and fix it. However, I have used healing tactics successfully without extra attacks being applied to allies, so I don't think this is too much of a worry.
Also… Jiang Wei just hit that absolute maximum number of non-bow attacks… struck a group of chapter 2 Brigands 5 additional times. (He was repelled once). Of course, he has 255 Agility, and the poor Brigands only had an Agility of 12… poor poor Brigands.
When all else fails... manipulate the source code.
November 9, 2011 at 2:55 am #39808MiDKnighT
ModeratorThis is great Lud! :thumleft:
I'll add to the guide tomorrow.
November 9, 2011 at 2:57 am #39809ludmeister
ParticipantThanks! I'm still tweaking it but I'll be done by tonight.
EDIT: Got it! Finally… the successive penalties add up as they should and I'm 99% sure I don't have any outstanding show-stopping branching bugs from moving code around. Yay!
When all else fails... manipulate the source code.
November 9, 2011 at 4:17 am #39810Zhuge Liang
ParticipantCool stuff as always, gentlemen :huohu:
DoaE gave birth to Huo Hu.
November 9, 2011 at 4:40 am #39811MiDKnighT
ModeratorQuote:Thanks for looking into it, MiDKnighT. I was afraid it was going to be a brutal difficulty.The only way I can think of is to convert the ROM from MMC1 to some better format but that would require pretty much an entire re-architect the game. So I think I'm officially off that project lol… We'll have to made do with what we have.
November 9, 2011 at 5:14 am #39812MiDKnighT
ModeratorAdded Agility Based Multiple Attacks section to the guide.
November 9, 2011 at 12:35 pm #39813ludmeister
ParticipantQuote:So I think I'm officially off that project lol… We'll have to made do with what we have.Totally understand, and agree. That space might still be useful for display purposes (portraits)… or maybe extra strings that we might want to place… or anything that can be calculated straight from temporary memory ($0000-$1fff).
It might be instructional if we were to figure out memory locations within $0000-$1fff that were not used during the game (or used very rarely), because it may be possible to store more permanent data that we need in temporary memory, go to an extended page and play, and then return and store the results from temporary memory back where they should go.
Okay, that might be grasping at straws. Just trying to look at the issue from every angle (or as many as my feeble brain can at 7:30 in the morning :scratch: ) Anyways, I don't think the situation is a total loss.
When all else fails... manipulate the source code.
November 9, 2011 at 1:13 pm #39814MiDKnighT
ModeratorI agree with finding unused memory. Unfortunately for us DoaE is a pretty full game. They utilized most of the ROM and use most of the memory. I've tried using some memory that I thought was unused and I ended up seeing weird glitches in the game like rocks showing up where they shouldn't and such.
I think the biggest benefit of the extra ROM pages will be for portraits and sprites. And as you said a jump off point for other page switches. We'll have to make due with the original ROM pages for complicated assembly changes which means we'll probably have to replace stuff more rather than add new stuff.
One other thing I was thinking about. Maybe for some more complicated fixes like the 8 tactics stuff or agility fix we should do an ips patch. Or maybe combine a bunch of enhancements into one ips patch bundle. That would save people from putting in the hex manually and possibly messing up. We've also been making so many changes that we need to make sure our fixes don't step on each other. Usually searching for the hex location on page 1 of this thread shows if that space is being used for something else.
November 9, 2011 at 1:30 pm #39815MiDKnighT
ModeratorAnd on a side note, I started looking at the "Life" tactic last night. I've found the main code that drives Tui Lu and Gui Huan. The plan is to replace "Tui Lu" with "Life" and replace "Gui Huan" with "Revive". I'll change the "Wan Fu" name to "Restore" since "Revive" fits a "Life2" tactic more.
It seems space will be the biggest challenge (again) as Tui Lu and Gui Huan don't actually use much space. They mostly call existing subroutines. I plan on trying to do the same thing with Life by calling some "Resurrect" subroutines. The trick is to basically do the resurrect without taking a resurrect from the inventory… :) I'll also try to give more HP with Life than a resurrect.
November 9, 2011 at 1:44 pm #39816sonic.penguin
ModeratorQuote:noticed that after I had used a successful Negate tactic, Pang Tong got a second hit. That was not expected, but not bad. I wonder if this modification will suffer from the same difficulty that the Ambush tactic does… if an officer successfully uses Ambush and uses a Healing tactic the next round, often times he will strike his ally. More testing may be necessary to track this and fix it. However, I have used healing tactics successfully without extra attacks being applied to allies, so I don't think this is too much of a worry.Doesnt Jie Ce restore EVERYTHING on the battle field to the effects of the first turn ie: normalized agility, no status buffs, etc. Wonder why he got a 2x attack then unless it doesnt do that for enemies for agility. Wonder if the agility tactic is restored once used on enemies? What about the castle tactic? I was never even sure it did anything although it was supposed to raise AC somehow?
November 9, 2011 at 2:40 pm #39817ludmeister
ParticipantQuote:Wonder why he got a 2x attack then unless it doesnt do that for enemies for agility.I do not know. When I used Negate, there were no Agility values to reset…
Quote:What about the castle tactic? I was never even sure it did anything although it was supposed to raise AC somehow?Again, I don't know, but that would be a fun thing to test. Now, from what I remember from Meteorstrike's research into the Castle tactic, it doesn't actually modify AC, but it modifies a separate value… the enemy's defensive fortification value. This is only actually set in gate/fort/castle battles… all but one- when you attack Nan Yang from the west (that gate is supposed to be under construction, according to intelligence gathered :wink: ). When the enemy uses Castle, it increases the fortification value, and if an ally uses it, it decreases the fortification value. I do not know if the enemy can fortify itself if it happens to use the tactic in the field.
Quote:One other thing I was thinking about. Maybe for some more complicated fixes like the 8 tactics stuff or agility fix we should do an ips patch. Or maybe combine a bunch of enhancements into one ips patch bundle.That's a great idea, MiDKnighT! On the subject of the patch bundle… maybe a new post with a poll where people can vote for one/all of their favorite rules modifications?
When all else fails... manipulate the source code.
November 9, 2011 at 2:46 pm #39818MiDKnighT
ModeratorQuote:maybe a new post with a poll where people can vote for one/all of their favorite rules modifications?Yes good idea, I'll start that. I think ROM expansion and portrait/sprite code are already a must become some of our fixes assume an expanded ROM but the rest we can vote on.
November 9, 2011 at 2:56 pm #39819ludmeister
ParticipantCould we include Portrait/Sprite code/and some of your better portrait work in the patch?
When all else fails... manipulate the source code.
-
AuthorPosts
- You must be logged in to reply to this topic.

