News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Secret of Mana, Turbo - Beta 201117  (Read 380851 times)

CVReynolds

  • Jr. Member
  • **
  • Posts: 20
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1640 on: November 13, 2020, 07:18:26 pm »
No, I didn't try it yet. I haven't had time. :(

But you give us excellent info and more great updates, Queue. Just keeps getting better. Thank you. :3

hmsong

  • Sr. Member
  • ****
  • Posts: 461
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1641 on: November 14, 2020, 09:40:58 am »
@Queue

Holy crap.  Dark_Lich_-_Nether_Pursuit is awesome.  Him going underground is actually dangerous, in a good way.  I love that.  I didn't think you'd be able to pull that off so quickly.  I'm sure it was quite a headache.  Thank you so much.  As for Mana Beast, if you can't speed up his rise/descent, then just making him to not rise from the bottom would be great.  That's probably easier than speeding up the Mana Beast.

Btw, for whatever reason, when I use ZPS Patcher, I get a message that says that rom was patched, but I can't close the window box (I can click the OK button, but it doesn't close).  I have to use Alt+F4 to close it.  Yes, I'm using Help Script.

Queue

  • Sr. Member
  • ****
  • Posts: 455
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1642 on: November 14, 2020, 03:01:35 pm »
It wasn't actually quick.

I'd been mulling over how to fix the boss defeated event being interrupted by the player stepping on tile event triggers (for example, during the Dark Lich fight, stepping on the warp tile at the bottom edge of the arena). If the player steps on a tile that activates an event at just the right time, it can interfere with the generic boss defeated "Way to go!" event (which stops the music and heals the heroes), or with the boss-specific event that then activates shortly after the "Way to go!" event. When the latter happens, it can break the game and require loading a save, or at least loading a save state / emulator rewinding. Anyway, this meant that I had been looking at boss code so was slightly more familiar with it than I was previously.

When you asked about changing those bosses, I was literally looking at the Dark Lich's code at the time, so started checking out his AI logic. Here's a brief rundown of the logic:
Spoiler:
if attacking
-   if above ground
-   -   do lots of stuff, not covering it here
-   else (if underground)
-   -   if head hidden
-   -   -   clench fists
-   -   else (if head showing)
-   -   -   do nothing

if moving
-   if above ground
-   -   20% chance
-   -   -   go underground
-   -   else if target close (< 0x0008)
-   -   -   do nothing
-   -   else (if target far, >= 0x0008)
-   -   -   move east / south / west / north for 0x24 animation frames
-   -   -   whichever direction the target is mostly in
-   else (if underground)
-   -   if head hidden
-   -   -   20% chance
-   -   -   -   go above ground
-   -   -   else if target south or north
-   -   -   -   move south / north for 0x18 animation frames
-   -   -   else (if target east / west)
-   -   -   -   50% chance
-   -   -   -   -   do nothing
-   -   -   -   else
-   -   -   -   -   show head
-   -   else (if head showing)
-   -   -   if target south or north
-   -   -   -   move south / north for 0x18 animation frames
-   -   -   else (if target east / west)
-   -   -   -   50% chance
-   -   -   -   -   do nothing
-   -   -   -   else
-   -   -   -   -   hide head
So the original Dark Lich AI issues stem from a combination of underground + head showing + attack = do nothing, and the 20% chance to go above ground only being possible if the head is hidden. If he went underground, you stand east / west of him to make him show his head, then stand south / north of him so he only moves south / north, and when he attacks he does nothing, so he can never attack, never hide his head, and never go above ground.

Kethinov's original Dark Lich Head Bang Fix removed his ability to move south / north while underground, which meant if he tried to move, it was 50% chance of doing nothing, or 50% chance of showing / hiding head, which meant eventually he'd hit the 20% chance to go above ground when his head was hidden. The movement logic became:
Spoiler:
if moving
-   if above ground
-   -   20% chance
-   -   -   go underground
-   -   else if target close (< 0x0008)
-   -   -   do nothing
-   -   else (if target far, >= 0x0008)
-   -   -   move east / south / west / north for 0x24 animation frames
-   -   -   whichever direction the target is mostly in
-   else (if underground)
-   -   if head hidden
-   -   -   20% chance
-   -   -   -   go above ground
-   -   -   else
-   -   -   -   50% chance
-   -   -   -   -   do nothing
-   -   -   -   else
-   -   -   -   -   show head
-   -   else (if head showing)
-   -   -   50% chance
-   -   -   -   do nothing
-   -   -   else
-   -   -   -   hide head

Obviously that'd conflict with changes to make the Dark Lich move more when underground, so first I rewrote this. Instead of disabling movement, I changed the attack logic, so that if his head was showing and he tried to attack, it'd hide his head and do the fist clench. Since it gave a mechanism to get back to the hidden head state, when it moved again, it'd have a 20% chance to go above ground, so that fixes the logic flaw that would let you trap him. So the attack logic is now:
Spoiler:
if attacking
-   if above ground
-   -   do lots of stuff, not covering it here
-   else if underground
-   -   if head hidden
-   -   -   clench fists
-   -   else (if head showing)
-   -   -   hide head
-   -   -   clench fists

With that resolved, I then needed to figure out how to make him move east / west while underground. The Dark Lich doesn't have any AI for horizontal movement while underground.

There's enough space in his AI table to add 4 more AI actions, and with some optimization, space can be made in his AI action scripts to add 4 more. But there's a problem: the Dark Lich has some animation lookup tables in bank $DC (0x1C) and they don't have room for 4 more AI actions. The relevant table is at $DCE4A9 which controls the Dark Lich's body animation while performing various AI actions. To make this approach work, I would have needed to either relocate something in bank $DC (to add 4 entries to that table) or change the Dark Lich's AI code to clamp the lookup in that table to its maximum value. Neither was very pretty. Besides that, if I had added 4-direction movement to either or both underground states (head hidden / showing), then what would trigger changing head state (showing / hiding head)? I actually set this approach up enough to try it and just ignored the glitched out body graphics. It wasn't going to work well this way: there wasn't a good way to wedge the underground state change back in other than random chance or triggered by attack, neither of which was good. So I scrapped the addition of 4 AI actions and went back to the drawing board.

I reevaluated what was wrong with his vanilla AI to begin with:
- can only go above ground if underground + head hidden
- cannot attack if underground + head showing
- underground state changes if in non-movement direction

So I figured, if underground + head hidden = move south / north or state change, maybe changing the head showing movement from south / north to east / west would allow the full range of movement, but still give a means of changing state. So that was the first change: reconfigure his AI code and actions so that underground + head showing would move east / west, and if the target was south / north, then 50% chance to do nothing or hide head.

But the random 50% chance to do nothing or change state meant he wasn't very aggressive at chasing as he'd often stop and sit there if you simply kept to a non-movement direction, so the next change was to remove the 50% chance to do nothing. Now, if you were in the direction where he couldn't move, he'd immediately hide or show his head and continue moving.

After some testing, it became obvious that he was prone to overshooting. He'd move towards you, then beyond, then turn around and move, again too far, and then do the fist clench attack, but he'd have moved out of range. It was easy to stand where he'd just overshoot back and forth, and never land the attack, even if you didn't move.

I was considering increasing his agility so that he could attack a little more frequently, so he wouldn't bounce back and forth over you multiple times before the fist clench attack, but even with that change he could still overshoot his movement, and I didn't really want to also be messing with his stats as that would make other mods that want to adjust boss stats more likely to conflict.

It was when reviewing his agility that I whipped up Combat\Faster_Bosses to see how he'd behave if he could attack more frequently. It helps, but doesn't really solve the overshoot issue.

To fix that, I halved how long he moves when underground, from 0x18 animation frames down to 0x0C, which meant he'd recalculate movement twice as often and could home in on a player more accurately. Even if his attack timer wasn't ready and his movement bounced back and forth over a player, he stayed in range for the fist clench once he finally used it.

This meant he tried the 20% underground -> above ground chance check twice as often though which meant he was too likely to leave the underground state. So I simply halved the chance down to 10%. However, he still only could go above ground if his head was hidden, so I adjusted the AI code to do that check before checking the head visibility state, so now he can go above ground even if underground + head showing (the animation for this is "wrong" as his head abruptly vanishes but it's not bad enough to worry about). So the final result is:
Spoiler:
if moving
-   if above ground
-   -   20% chance
-   -   -   go underground
-   -   else if target close (< 0x0008)
-   -   -   do nothing
-   -   else (if target far, >= 0x0008)
-   -   -   move east / south / west / north for 0x24 animation frames
-   -   -   whichever direction the target is mostly in
-   else (if underground)
-   -   10% chance
-   -   -   go above ground
-   -   else if head hidden
-   -   -   if target south or north
-   -   -   -   move south / north for 0x0C animation frames
-   -   -   else (if target east / west)
-   -   -   -   show head
-   -   else (if head showing)
-   -   -   if target east or west
-   -   -   -   move east / west for 0x0C animation frames
-   -   -   else (if target south / north)
-   -   -   -   hide head

So yeah, I spent hours on it. The "4 new AI actions" approach was day 1, and it was over dinner that I realized I might be able to divide up movement directions between the head visibility states, but didn't get a chance to try that until day 2.

Regarding the ZPS Patcher issue, I know basically what you're running into, but have never had it get completely stuck for me.
  • Does clicking the X in the messagebox corner work?
  • How about spacebar, enter or escape?
  • If you uncheck the (Helper_Script) checkbox and patch, the "Finished !" messagebox can be interacted with normally, correct?
  • When that messagebox is showing, can you press Ctrl+C, hear a ding sound, then open Notepad and Edit\Paste, and have it show a copy of the text that was in the messagebox?
  • Is Ctrl+C even your "Copy" hotkey combination?
I suspect the Helper Script is jamming up the "Finished !" messagebox somehow. Did it used to work correctly for you? I do occasionally try and improve the Helper Script and there were some changes made to it back when commandline support was added to the ZPS Patcher itself.
« Last Edit: November 14, 2020, 08:05:25 pm by Queue »

hmsong

  • Sr. Member
  • ****
  • Posts: 461
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1643 on: November 14, 2020, 07:42:30 pm »
Holy damn.  I knew that changing the Dark Lich underground movement would be complicated, but not as complicated as you described.  You initially tried the 4 new AI actions (didn't work out), then used a different logic to solve that, but it had the overshoot thing, so you shortened the distance.  There must have been a lot of testing.  Thank you so much for going through so much trouble.  I truly appreciate it.

As for ZPS Patcher issue, I didn't try any of the X, ESC, spacebar (Alt+F4 worked, so I just went along with it).  I didn't even try disabling the Helper Script.  I need to go out right now, so I'll edit this post and copy/post the msg box.

Queue

  • Sr. Member
  • ****
  • Posts: 455
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1644 on: November 14, 2020, 11:47:04 pm »
I realize I should clarify about Copying the messagebox to the clipboard. I don't actually need you to Copy&Paste it so I know what it says; I just want to make sure Ctrl+C works for you to copy it at all since the Helper Script actually does that to read the messagebox text: it sends the messagebox a Ctrl+C keypress, then reads the clipboard to verify the file name (if it can't find the file it was expecting, it's an emergency fallback).

hmsong

  • Sr. Member
  • ****
  • Posts: 461
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1645 on: November 15, 2020, 04:01:33 am »
Hmm.  For some reason, it's no longer doing that.  I'm not sure what changed (I certainly didn't change the setting).  Well, the problem is solved, but I don't know what caused the problem.  Weird.

Once I encounter the problem again, I'll test and see all the things you mentioned.  Thanks.

miaz

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1646 on: November 15, 2020, 11:13:52 am »
I just patched two different ROMS (one headered that i deheadered using tush i think its called, and one unheadered), and tried them both on my SNES classic.
The text is unfortunately completely unreadable. Re-patched one without the Font-change (chicago etc), did not help. Tried both ROMS on my mac with SNES9X, they both look fine.
Has anyone got this working on a SNES classic?

Pethronos

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1647 on: November 15, 2020, 12:12:13 pm »
Miaz, to deblur the Hi-Res text from the first menu, you have to change the preset ID. In hackchi, press Ctrl+Alt+E and change PRESET ID to 10B0

miaz

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1648 on: November 15, 2020, 10:55:07 pm »
Thanks, but sorry to report that, that did not work.
Ive seen 1610 been thrown around too (for SD3), would that possibly do it?
Is it a scale-thing? Or mor of an on-off switch?
1080 had no impact on the text whatsoever.

A question though, you refer to it as "the first menu", is that the only place the text is messed up? If so, i could live with that, but i just assumed it would be all dialogue.

Queue

  • Sr. Member
  • ****
  • Posts: 455
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1649 on: November 15, 2020, 11:50:30 pm »
0x10B0
That's a B, not an 8.
Without the correct Preset ID, all full-screen menus (the ones with the scrolling tree background) will have basically unreadable text.

Think of it like an on-off switch. 0x10B0 is specific to "Secret of Mana" and lets Canoe know to render the fullscreen menus correctly. Technical\VC_without_PCM is also necessary.

There are multiple approaches to correctly using ROM hacks with Canoe on an SNES Classic. In my experience, the least annoying method was:
- add a completely unmodified Secret of Mana ROM as an additional game (named to, say, "Secret of Mana, Turbo") so that Hakchi (et al.) sets up all the correct settings (especially Preset ID), release date, etc.
- turn on ROM compression, so that it puts the SFROM file into a compressed file (.7z 7-Zip if memory serves)
- then replace the SFROM file in the .7z file with one generated by ZPS_Helper.bat (in the patcher, at the very bottom, enable [Generate_SFROM_File])
- then turn off then back on ROM compression to make sure Hakchi uploads the replaced file

Unfortunately, I doubt ZPS_Helper.bat will work on a Mac. So instead you'll probably need to take the more manual approach of entering the Preset ID (and any other game info you care to be accurate) by hand.

A third approach is to patch SoM, then generate an IPS file that you can then feed to Hakchi along with the vanilla SoM ROM. There's the risk this approach will forcibly include a "compatibility patch" which will conflict with the Turbo IPS you made, so it's not ideal unless you're careful with how the SFROM generating process works and are sure the only IPS being applied is the one you generated from the Turbo-patched ROM.

Dzumeister

  • Full Member
  • ***
  • Posts: 162
  • Zaubermancer
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1650 on: November 16, 2020, 02:04:40 am »
0x10B0

Ive seen 1610 been thrown around too (for SD3), would that possibly do it?

I also thought it was 0x1016 (1610 in Hakchi).  :o


nvm, just checked the preset id list  ::)
« Last Edit: November 16, 2020, 02:18:53 am by Dzumeister »
free sluffy

miaz

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
Re: Secret of Mana, Turbo - Beta 201113
« Reply #1651 on: November 16, 2020, 02:59:08 am »
Thanks! I’m clearly blind. I’ll try it when I come home. I’ve got a shitty ol laptop running windows, solely for hakchi, but other than that I’m on Mac. The laptops so bad though, that any additional task might cause more problems than they would solve.

November 16, 2020, 10:35:18 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
It worked! Thanks!
Now i just need Treasure of The Rudra to work too.
« Last Edit: November 16, 2020, 10:35:18 pm by miaz »

Queue

  • Sr. Member
  • ****
  • Posts: 455
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1652 on: November 18, 2020, 12:42:32 am »
Version 2020-11-17:
https://filebin.net/7spaiz2xfys6b2i1/SoM_Turbo.201117.zip

Changes:
- Implemented Items\Chest_Rarity_Adjustment; On by default but with vanilla rarity specified in Advanced Options
- Rewrote Quality_of_Life\Remove_Barrels_On_Run to clear up some behavior issues in how it made the run button interact with attacking
- Fixed error in Equip_2nd_Weapon and Weapon_Upgrade_BugFix that made the girl and sprite's weapons end up with the wrong attack power and status procs (they were copying the boy's weapon's attack power and status proc on accident)
- Additional code added to Bug_Fixes\Defeat_Waits_For_Events; should rather heavy-handedly prevent tile events from blocking boss defeated events, hopefully no side effects
- Fixed graphical corruption that could affect thrown boomerangs due to Graphics\Polished_Weapons; was harmless but ugly
- Slight tweak to ZPS Helper Script to hopefully make it close the "Finished !" messagebox both more reliably and more quickly (and without sometimes making a second ding sound; one ding is intended though)
« Last Edit: November 18, 2020, 04:21:01 pm by Queue »

hmsong

  • Sr. Member
  • ****
  • Posts: 461
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1653 on: November 20, 2020, 02:53:41 am »
Hmm.  I've been trying to download the new file for the past two days, but I can't seem to download.  I activate the download, but it fails in the middle.  Is anyone else having the same problem?

Mr X

  • Full Member
  • ***
  • Posts: 169
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1654 on: November 20, 2020, 12:00:20 pm »
Hmm.  I've been trying to download the new file for the past two days, but I can't seem to download.  I activate the download, but it fails in the middle.  Is anyone else having the same problem?

I was able to download just fine.

Vanya

  • Hero Member
  • *****
  • Posts: 1821
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1655 on: November 20, 2020, 07:00:33 pm »
I had it fail on me, too. But I tried again just now and it downloaded just fine.

hmsong

  • Sr. Member
  • ****
  • Posts: 461
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1656 on: November 21, 2020, 04:20:53 am »
I guess it's just me then.  It must be my network.  Well, I'll figure it out.  Thanks everyone.

lexluthermiester

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 863
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1657 on: November 22, 2020, 10:01:21 am »
Hmm.  I've been trying to download the new file for the past two days, but I can't seem to download.  I activate the download, but it fails in the middle.  Is anyone else having the same problem?
I had the same problem, it wasn't just you. In fact, the download is still failing to finish.

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 530
  • I am the baldest romhacker
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1658 on: November 22, 2020, 12:46:03 pm »
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

lexluthermiester

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 863
    • View Profile
Re: Secret of Mana, Turbo - Beta 201117
« Reply #1659 on: November 22, 2020, 04:38:09 pm »