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

Author Topic: FF1 MMC5 Disassembly Updates  (Read 77454 times)

Disch

  • Hero Member
  • *****
  • Posts: 2728
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #320 on: May 17, 2019, 10:47:37 am »
Don't know if I really have the spare time to set up the work environment for that

Though, correct me if I'm wrong, but the syntax in Python isn't super different from GML / C++?

Python is both absurdly simple to set up and absurdly simple to learn and use.  There's a reason why it is so popular for cranking out quick little scripts.

All you need is a text editor like Notepad++ (which you presumably have already), and just download/install the Python runtime.

And yes, syntax is very similar to C-style languages.  The biggest "gotcha" for newbies is the fact that indentation and whitespace matters (it's highly recommended that you configure your text editor to replace tabs with spaces).  But if you have ANY familiarity with C-style languages, you already know 80% of Python.

For an example of some code, here's a quick little script I made to load .tbl files.  You should be able to read and understand pretty much all of it:
Code: [Select]

# Simple table file loading
#  Allows for DTE and MTE (multiple characters per byte) but does not
#  allow for multiple byte groups.


# loadTable returns an array with 0x100 elements, each entry is the string representation of that
#   byte (or empty string if the byte has no entry in the table)

def loadTable( filename ):
    output = ['?' for i in range(0x100)]    # initialize all output bytes to '?'
       
    with open(filename, 'r') as file:
        rawfile = file.read()
    lines = rawfile.split('\n')     # split table file into individual lines
   
    for line in lines:
        x = line.split('=',1)           # split on first '='
        if len(x) != 2:     continue    # skip empty lines or lines that are poorly structured
        # everything before the '=' is the byte
        byteVal = int(x[0], 16)
        if 0 <= byteVal <= 0xFF:    # we only care about single bytes
            output[byteVal] = x[1]
       
    return output


Really the only reason I'm bringing this up is because having game maker as your go-to for making quick scripts seems like a very strange choice to me, and Python is so ubiquitous that you're almost doing a disservice to yourself by not knowing it.

But ultimately it's up to you.  If you don't want to do it, you don't have to.  I just saw an opportunity to bring this up and I jumped on it.  I'll leave you alone now.   ;D

Quote
plus I'm working off a laptop cause my desktop's power supply seems to have finally died after nearly 12 years of faithful service.

 :'(  Bummer.  At least it's just the PSU and not the HD.  HD failures are the absolute worst.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #321 on: May 17, 2019, 02:34:52 pm »
But ultimately it's up to you.  If you don't want to do it, you don't have to.  I just saw an opportunity to bring this up and I jumped on it.  I'll leave you alone now.   ;D

I appreciate the suggestion!


Quote
:'(  Bummer.  At least it's just the PSU and not the HD.  HD failures are the absolute worst.

o.0 yes they are.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #322 on: May 19, 2019, 02:55:15 pm »
I dunno, I kinda think we should not worry about balancing the game until after all the new features you want to do are finished.

I think it'll cut down on the amount of testing that has to be done and prevent redundant work.
Makes sense?

Yeah... Just kinda feel like I'm running out of things to change that I feel up to changing. Its getting really close to finished! I might even take a few things out (like pressing Start to auto-battle...)

Having more ideas now: Making inns and clinics based on party and character level. That way people don't bother flying back to Coneria for it, but it still gets more expensive the further you go through the game.

I keep mixing up Coneria and Corneria from Star Fox. Or are they both Coneria? Is there an 8-bit version of the theme I can put in, or would I have to de-make it myself? No, that's not fitting for a starting town... IS IT?

Remember -- https://docs.google.com/document/d/1vXa_OLn408BxQ2GpIRRnGNPRJliOv_YBiP21ARdnhxo/edit?usp=sharing -- is editable by anyone, so add in the things you'd like to see!

Also, put a spreadsheet of (some) enemy stats up in the GitHub. ODS format. HP, damage, accuracy, defense, magic defense, then added them all up in further columns, then stripped out certain stats in other columns. So there's one column of damage+accuracy+defense, one with that + HP, one with all that + magic defense, etc. I dunno if that will help your idea of doing it with GameMaker but I wanted to see what it would look like anyway.
« Last Edit: May 19, 2019, 04:24:10 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #323 on: May 19, 2019, 04:22:44 pm »
I think they are both Corneria/Cornelia depending on how they happen to be romanized at any given time.

I've been meaning to add to that list, but have been too busy with RL.
I'll add some of my ideas to it as soon as I get a chance.

Scaling Inn / Clinic costs sounds great!
I kinda think that the clinic needs to have more to it than just being a substitute phoenix down/golden needle.
Maybe have clinics be able to get rid of all ailments and the cost depends on which ailments the character has.
This could maybe be done in such a way to allow for later hacks to have more ailments that persist after battle.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #324 on: May 19, 2019, 09:28:42 pm »
Some tweaks in the works:

Hiding bonuses is adjusted to:
-40 hit chance for defending characters
-80 hit chance if Thief/Ninja

Double hit rate for attacking characters (same as before)
x1.5 crit rate (lowered from x2)

For thieves:
x1.5 damage (same as before)
x2 crit rate (lowered from x3)

And instead of stealing gold when doing a critical hit, it will now be +4 crit rate, with the message "Feeling lucky!"

Skill check is in place for all bonus critical hit stuff. Instead of a roll between 1-100 and needing to be over 50, its now between character speed (old luck; same thing!) and 100, and has to be over 75. So it still favours faster/luckier classes and characters.

I was gonna have darkness and maybe mute stay after battle, too. Make eyedrops work out of battle and add in something for the mute cure? At least darkness.



Update: Feeling confident, but haven't tested it... so I bet nothing works.

Apart from the earlier tweaks mentioned, there are these:

Hiding and Class added to attacker and defender stats for future use.
Added elemental weakness to armor; ice and fire armor and ice and fire shield use it
Attacking player characters lose hit rate when under the darkness ailment again (oops; I took it out because I was like, why load attacker ailments??? I forgot about this one)
Characters should no longer be woken up from sleep only to get the sleep ailment again
« Last Edit: May 19, 2019, 11:16:03 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #325 on: May 21, 2019, 06:55:17 am »
Sounds good to me. I'll try these out as soon as i can.

I have a question, tho.
How difficult would it be to change the Hide command into a skill? Or any command for that matter?

Also, is the skill command set up to be able to display multiple skills?

I'm thinking about the possibility that someone may want to make Hide exclusive to Thieves, make Magic appear in Skills as a sub-menu, or have a pool of common commands under skills.

Perhaps making it so only spellcasters can use Gear.

Any number of alternate variations like that.

I guess what I'm asking is if the command window can be more flexible?

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #326 on: May 21, 2019, 01:58:13 pm »
I'm sure it can be flexible. It won't be exactly easy for just anyone to do; I don't know if I know how to set it up to be like the main command window where you just change the jump table and the order of the text...

Once I figure out how to turn the Skill from a submenu to display new things in the command box, I think I could be able to make each command box set up different for each class. Tricky part would be knowing what class is next to draw for with all the box undrawing/re-drawing that happens between turns!

Moving this week, so don't know how much time I have to work on things. I also want to do VWF for description boxes in menus and dialogue in maps if there's enough tilespace in VRAM.

And I've been kicking around ideas for how I could double dialogue and battle formations...

And magic still, gotta do that!

I think the next thing I should be doing is spreading out the banks more to make room for new enemy graphics and maps, though!

Why do I do this to myself.
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #327 on: May 21, 2019, 08:56:58 pm »
Because, like me, you are a sick bastard who get off on twisting a games code to do your bidding!!!
Mwahahaha haha ha hahahaha ha ha!!!!!!!!!!!!!!!!!!!!!

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #328 on: May 21, 2019, 10:33:25 pm »
Okay--you're creepin' me out!

So Bank 2 and 3 are graphics, but I kinda hate Tile Layer Pro and that's the only thing that will open the .dat files. What I would like to do is split up the graphics into .chr, one for every map NPC and dungeon tileset, and turn Bank 2 and 3 into .asm files that just .incbin the graphics.

I need a program that will help me figure out the cut off points for the graphics so I can slice and dice in a hex editor... Figure I should ask if anyone's got a recommendation before I download 20 new random programs that don't work in a 64 bit OS... (Windows 7 by the way. Also have 32 bit XP if the best program for the job only runs on that.)
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2728
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #329 on: May 21, 2019, 11:04:46 pm »
So Bank 2 and 3 are graphics, but I kinda hate Tile Layer Pro and that's the only thing that will open the .dat files. What I would like to do is split up the graphics into .chr, one for every map NPC and dungeon tileset, and turn Bank 2 and 3 into .asm files that just .incbin the graphics.

.dat is just a file extension.  It shouldn't matter.  Any tile editor should be able to open any file.  Maybe in other editors' file selection dialog, just turn off the filter?  (select it to show "all files" and not just extensions it recognizes).

Changing to .chr is another option (again, the extension is meaningless).  But then you'll have to tweak the build script to cobble together those banks as .chr files instead of .dat files.

A separate .asm file to incbin the chr is probably unnecessary, as the resulting "assembled" file would be identical to the chr file.  Though I guess it would make it easier to separate the chr files and/or add padding.

That said I am also woefully unimpressed by all the tile editors I've used, though I haven't really tried more than three.  TLP and YY-CHR are clunky as all get-out and Tile Molester is flat out broken and virtually unusable on modern versions of Java.  (Or at least I assume it's a Java versioning thing, and the program wasn't so broken when originally released).  If you find something better, I'd love to know about it.

... in fact, I vaguely remember a thread on these boards about a new tile editor?  But I can't find it now and it doesn't seem to be hosted on RHDN.  Shrug.

Quote
I need a program that will help me figure out the cut off points for the graphics so I can slice and dice in a hex editor...

Each 8x8 tile is exactly $10 bytes.  If nothing else you can just count the tiles and multiply by $10.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #330 on: May 21, 2019, 11:25:57 pm »
Whups! Sorry to make you type all that; I just realized the extension shouldn't matter, renamed one to .bin, and YY-CHR opens it up FINE now suddenly.  :P

I really like YY-CHR (apart from thinking .dat is some mystical forgotten language)! I haven't really found any issues with it in using it to do the things I do, but I haven't really had to do anything super specific that it does wonkily yet. Think I maybe had some troubles making the intro screen for my own game, but it could have just been a learning curve...

Spoiler:

Still so proud of this!

A separate .asm file to incbin the chr is probably unnecessary, as the resulting "assembled" file would be identical to the chr file.  Though I guess it would make it easier to separate the chr files and/or add padding.

Getting rid of blank space (if necessary) and just knowing exactly where to set pointers is the main reason for it. Being able to input more tilesets and whatnot... figure out new ways to organize the data for loading... That's why I want to cut 'em up as much as possible.



So here's my plan:

Current set up is this:

0 = Object info
1 = Overworld map
2 = map sprites and chr
3 = tile sets
4, 5, 6 = standard maps
7, 8 = enemy graphics
9 = Battle chr/Shop chr/ mini map code
A = Item names, prices, battle strings
B = Battle prep/End
C = Battle
D = Music
E = Shops/Menus
F = Intro, save/load, sound test, Enemy/weapon/armor stats, extras
10 = Dialogue
11 = Puzzle and Bridge scenes
____________________

New order would be this:

0-1 = Object Info
2-3 = map sprites and chr
4-5 = tile sets
7-8 = battle chr/shop chr
9 = Puzzle and Bridge scenes + mini map code
A/10 = remain the same
11-14 = enemy graphics
15 - ?? = standard maps
Whatever's last = Overworld map
« Last Edit: May 22, 2019, 12:17:35 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6907
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #331 on: May 22, 2019, 11:32:49 am »
Moving this week, so don't know how much time I have to work on things. I also want to do VWF for description boxes in menus and dialogue in maps if there's enough tilespace in VRAM.

Not only would tile space be an issue, but VWF is also kind of slow to process.

Though the only example I have seen is a Chinese bootleg translation (hacking game to use kanji, conceptually similar hacking-wise to a VWF) which grinds the game to a halt every time a text box is opened, that it makes the music stutter as well.
"My watch says 30 chickens" Google, 2018

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #332 on: May 22, 2019, 07:49:48 pm »
Okay--you're creepin' me out!

Nothing makes me feel more fulfilled than creeping people out.
My Halloween parties are legendary.

And I have nothing more to add at this time.

I might be delirious from a long day of working Uber.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #333 on: May 25, 2019, 03:30:43 pm »
Not only would tile space be an issue, but VWF is also kind of slow to process.

Though the only example I have seen is a Chinese bootleg translation (hacking game to use kanji, conceptually similar hacking-wise to a VWF) which grinds the game to a halt every time a text box is opened, that it makes the music stutter as well.

I worked out the tile space necessary. For description boxes in menus, its 3 lines of 28 tiles, so 84 of 127 available tiles. Dialogue boxes will have to lose 2 lines to fit, but--I also want to figure out a way to have a character say more than 1 box of dialogue. And if the font is squished enough, those 2 lines of original game dialogue might just fit anyway? Also, dropping just one line makes the box not have to weirdly cover the sprite you're talking to if its 1 tile above! So I'm feeling good about this still.

Tepples on NesDev has said his code can do a line in 1 frame... and I think I might try to have text print tile by tile (also, somehow, interruptible to cancel out of it), so 1-2 tiles a frame should be enough. XD

That's still a ways in the future, though!

I've stretched out the ROM to a full 32 banks, and am just one bank of enemy graphics away from having all the graphics chopped up. Only 10 files left in the /bin folder, too.

So there are TWO RNG tables that take up 256 bytes each in the fixed bank and I want those gone. But one needs to be able to scroll through every value for Chaos, unless I can change how Chaos's death works.

Have more to talk about later, but I'll get back to the sorting first, and upload it when I've tested it works as normal still.

Edit: I was being dumb. It happens after taking a break from things!

Anyway, I think I can simplify map loading a bit by just making another pointer table and having each map's byte point to the correct bank its data is in. It might take up more space, but it will be easier for editing and adding new maps? If that makes sense; I'll give it a try soon either way.

Oh, @Disch -- do you have the source code for FFHackster or anything? Wanna see if I can ask a friend to update the map editor to work with .bin files instead of the original game's structure... I still gotta figure out all the different map data systems. Sprites, battle domains, tilesets, teleports, coordinates, palettes.
« Last Edit: May 25, 2019, 07:23:28 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2728
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #334 on: May 25, 2019, 08:36:41 pm »
Sure, I have the source, but first.... a few notes:

- It was made with an ANCIENT version of MSVS (I think MSVS 6... like I said... ancient).  There's no makefile.  This is not going to be the easiest thing to build.  Best hope is to open the project file in a newer version of MSVS and hope it up-converts properly, but I make no guarantees.  I personally haven't tried to build this in at least 13 years.

- Dunno if this is actually the 1.0 source or not, it's just the version I had on my local HD.  I may or may not have made changes to it since official release... or maybe this is an older version of the source before official release.  Who knows.  For your purposes it should be close enough, though.

- I'm not convinced retrofitting Hackster is the best option, especially if you have any intention on making changes to the map format or anything like that.  It might be worth using a general purpose editor like Tiled and writing some python scripts to convert the raw data to/from Tiled's format (which I think is just XML)

- This code is old.  Very old.  Embarrassingly old.  I think I wrote it in high school.  I'm almost ashamed of it now.  Tell your friend to brace themselves for bad code.  And believe me, however bad they think the code is, I think it's worse ;P



If I haven't scared you away... here you go:   :beer:

https://www.dropbox.com/s/g805gn94rt37n8e/FFHackster_src.zip?dl=0

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #335 on: May 25, 2019, 11:39:19 pm »
I'm too dumb about code to be scared by it! Just confused. Thanks!

I have a github question now... I want to make a backup branch of the current master build, then kind of... like... start over? Or--how do I delete files from the master? All the stuff in the bin folder. Some of it is moved, some of it is put into the .asm files, and I want it to be organized and not re-download all the files I deleted when I switch branches.
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2728
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #336 on: May 25, 2019, 11:48:17 pm »
Deleting files is a pretty basic operation, but how to do it depends on the client you're using.  In SmartGit, all you have to do is delete the files normally from your computer and it'll automatically recognize they're missing and add their deletion to the list of changes when you do a commit.  I assume other clients would do it similarly.


Ideally, your git client should be automatically recognizing ALL changes you've made to ALL files in your root project directory (including moves and deletions).  If your client isn't doing this, I'm going to one again recommend SmartGit.


EDIT:  Or if you're using command line git (which I doubt but just in case)... "git rm <filename>" will remove a file, "git add <filename>" will add a file, and moves are just a delete+add.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #337 on: May 26, 2019, 07:10:42 pm »
Well I hope that works!

Big ol' update for everyone to try out. While I haven't moved any banks around yet, they're pretty much ready for that.

Each Standard Map bank has its own pointer table now, instead of the one in the first bank. LoadStandardMap: just does some comparing of numbers (set in constants.inc) instead of trying to figure out what bank to load based on the map's pointer numbers.

The One thing I can think of that my way is worse, is that maps can't cross over banks (the start of each bank has to be pointer table data!) Buuut... I really don't think that's going to be an issue. Deleting two thirds of the pointer table in the first map bank freed up room for the last map there to not cross over, and the last map of the second bank is now the first map of the third bank, and the third bank has SO MUCH ROOM still.

Weird little thing that might be a bug or a mess up on my part in splitting the map data up: there's $3C maps, Titan's Tunnel being the last. But there were $3D null terminator bytes. Just a random 67-byte big map between the final floor of the Temple of Fiends and Titan's Tunnel...?

So far all the maps I'm testing are working fine.
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #338 on: May 26, 2019, 08:36:38 pm »
So, how much more map space are we talking?

Like, could I add all the extra content from the Dawn of Souls version and not bat an eyelash?

Could I add a bunch of random villages to the overworld?
A slew of mini dungeons in out of the way spots a'la Breath of the wild?

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #339 on: May 26, 2019, 09:59:51 pm »
While I haven't done much to sort out the other map stuff, like sprites and teleport coordinates, and I still want to find a way to add more treasure chests (even though many are unused currently...)

67. You can add 67 more maps.

That's not a space limit, that's a "double the map ID for the pointer" limit... which... actually? Since the pointer gets reset to 0 for each new bank...

195 maps. Theoretically.

Or whatever you can cram into... 10 banks?, whichever comes first. This is my bank layout plan right now:
0-3   - Enemy graphics (double)
4-5   - Shop/Text graphics, Battle sprites
6-7   - Map sprites and tileset graphics
8     - free space?
9     - Minigame, Bridge scene animations, maybe mini map code
A-10  - remain the same as current banks
11    - free space?
12-14 - Map Sprites/Teleports data
15-1D - Maps (8 banks)
1E    - World map
1F    - Fixed bank
I know exactly what I'm doing. I just don't know what effect it's going to have.