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

Author Topic: In-game map in Final Fantasy  (Read 2735 times)

NPCtendo

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
In-game map in Final Fantasy
« on: January 12, 2015, 08:08:28 pm »
Hello!

I'm having an issue with the in-game map in the original Final Fantasy for NES.  Basically, some areas always show as water, even though they're land.  This corresponds with areas that are water in the original game. 

Picture here: http://imgur.com/tnNUK4B

The top left should be one continuous continent. 

Any suggestions?

Seihen

  • Sr. Member
  • ****
  • Posts: 405
    • View Profile
Re: In-game map in Final Fantasy
« Reply #1 on: January 12, 2015, 09:20:11 pm »
What is this from? A romhack you're working on, or some other type of project?

I'd say the first answer that comes to mind is that some of the tiles which made up the continent have been overwritten or the tilemap has been somehow corrupted. But without further info, that's just a best-guess.

NPCtendo

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: In-game map in Final Fantasy
« Reply #2 on: January 12, 2015, 10:32:10 pm »
Thanks for the reply.  It's a project I'm working on.  I'm pretty sure it's not corrupted - in fact, I'm pretty sure I know exactly what's going on:

The in-game map in FF is not a graphic stored in the rom - you won't find it in tile layer pro.  If you change the world map, the in-game map automatically updates.  So the map is somehow rendered by the NES (I have no idea how).    The problem is, the game doesn't render the whole map.  It "skips" areas which the dev "knows" are water and simply places a blue tile.  So if your land configuration varies significantly from the original, you end up with "water" where land should be.

The good news is I've got a workaround figured out.  I wasn't going to leave the text at the top, so I can use those tiles to manually fill in the missing parts of the map.  Only problem with this method, apart from the extra work, is that it screws up the animation when you go to the map screen.  It'd be nice if there was a way to make the entire map render (or choose which tiles are skipped). 

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: In-game map in Final Fantasy
« Reply #3 on: January 15, 2015, 11:12:02 am »
There has to be a map then. One that only stores one bit per sector of the overall map.

STARWIN

  • Sr. Member
  • ****
  • Posts: 449
    • View Profile
Re: In-game map in Final Fantasy
« Reply #4 on: January 15, 2015, 04:55:37 pm »
Well, can you read asm? If yes, go catch that code which draws the map. Read breakpoint at map data of a tile that affects the drawn map should find that routine. I imagine there is a constant water area check nearby.

NPCtendo

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: In-game map in Final Fantasy
« Reply #5 on: January 17, 2015, 10:07:57 am »
There has to be a map then. One that only stores one bit per sector of the overall map.

I suppose this is possible, but I'm not sure it helps.  If you watch the PPU viewer while entering the map screen, you'll see the entire map enter memory then parts of it get overwritten by the text and decorative graphic used around the map.  I want to stop that or change which areas get overwritten.


Well, can you read asm? If yes, go catch that code which draws the map. Read breakpoint at map data of a tile that affects the drawn map should find that routine. I imagine there is a constant water area check nearby.

This is probably what I need to do, but I know very little about assembly.  Can you suggest a good learning resource?

STARWIN

  • Sr. Member
  • ****
  • Posts: 449
    • View Profile
Re: In-game map in Final Fantasy
« Reply #6 on: January 18, 2015, 08:34:02 am »
http://www.obelisk.demon.co.uk/6502/ - the language
http://wiki.nesdev.com/w/index.php/CPU_memory_map - what memory locations mean in NES
http://wiki.nesdev.com/w/index.php/MMC1 - details about how it swaps content of memory blocks after addresses 8000 and C000, shallow knowledge sufficient
http://www.fceux.com/web/download.html - debugger
http://www.fceux.com/web/help/fceux.html - what buttons mean in it
http://www.romhacking.net/documents/671/ - a high level description of the game contents
maybe there is a well-commented disassembly somewhere that covers this, maybe not.. uncommented disassembly is worthless in this case.
http://datacrystal.romhacking.net/wiki/Final_Fantasy:World_map_data - a low level description of map data

Set exec breakpoint at BC00 and open the map, it then pauses at the first instruction (LDA 9) of the procedure that does all world map drawing. This routine or something that it calls does what you don't like. Well, that is just an example to show what this is about. What you really want to do to find the place where something interesting happens is either to set a read breakpoint at map data that works/doesn't work as intended and compare, or figure out at as small scale as possible where what is interesting happens, and then do two trace logs that cover good/bad cases.

Actually solving the problem is probably easier than finding where it is (in this case). Hopefully there is some check (branch instruction) that you can either remove (turn into NOPs) or make always happen (change to whatever works) that solves it. Alternatively it uses a table of some kind to decide when to go blue mode, and then you could fix the data instead of changing the code.

The constant 17 (#$17 formally - # meaning constant instead of reference and $ meaning hex instead of decimal) in various places in the code most likely refers to ocean tile, and it perhaps uses that to set the screen pixels blue when needed.

It may also be too much work if you don't intend to use these skills anywhere else or elsewhere within this project. If you will, though, this is pretty perfect as a learning task.
« Last Edit: January 18, 2015, 08:49:48 am by STARWIN »

NPCtendo

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: In-game map in Final Fantasy
« Reply #7 on: January 18, 2015, 10:05:11 am »
Thank you so much!  Looks like I've got some reading to do.   :)