It is currently Tue Nov 21, 2017 3:21 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject:
PostPosted: Tue Jan 19, 2010 11:59 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7272
Location: Chexbres, VD, Switzerland
tokumaru wrote:
I assumed it was copying because if you look at the NT viewer in FCEUXD when going up ladders in MM! you can see that the next screen is quickly loaded to the hidden NT horizontally (that's the pause before the vertical scroll), then the exact same data is written to the visible NT as the vertical scroll happens.

Then, when the vertical scroll finishes, the scroll is set to display the previously hidden NT and the one that was used during the vertical scroll is loaded with the next screen (that's the second pause).

Now, if it's actually copying from one NT to the other I don't know. I set up a breakpoint for $2007 reads and in fact it does happen during the vertical scroll, but it seems to be reading just 2 bytes per frame, not a lot of data, so maybe it's just doing it for the attributes or something.

Well, it seems MM1 only read attribute table, not the name table. I haven't tried MM2, but very likely it's exactly the same scrolling engine (and MM3-6 uses another engine).

It's actually quite weird how MM1&2 scrolling works, I admit I don't quite understand how it works ! Anyway, tokumaru's solution seems a good one for banshaku's problem in my opinion - altough I don't think it's exactly what MM1&2 does (they don't shift the screen one row lower or anything). Also tokumarus animation is only for the case of scrolling up, it would have to be adapted when scrolling down.

The following algorithm could work for Banshaku :
- Before scrolling up or down, decode the next map and write it into the invisible nametable
- While scrolling, "copy" data in real time from the invisible nametable to the visible one : Going upwards and shifting one row down when climbing up, and going downwards and shifting one row up when clibming down
- Once all scrolling is done ($e8 -> $d8 when doing down, or $e8->$08 when going up), exchange which nametable is active, and decode the next screen on the inactive nametable
- Gameplay can resume

As far I see it there is 2 ways the "copying" could be done, either by decoding the level data rows and write them to the nametable (as it would normally be done), or by reading the nametable via $2007, and write data back.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 19, 2010 12:19 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10116
Location: Rio de Janeiro - Brazil
You are right, I didn't think of how to scroll down. Shifting one row up, like you said, will work, but this means that the topmost row of the new screen will have to be copied over the black bar in the visible NT, and the copying continues downwards, wrapping to the top.

IMO it works perfectly both ways. I think that the original games scroll slower than 8 scanlines per frame, but if you want to keep it glitch free I think you should use 8 anyway, even if you scroll 8 scanlines every 2 frames, to make it slower. In fact, if timing is a problem, you could use 1 frame for reading the data from the hidden NT, and the next frame for writing it to the visible NT.

This is the easiest solution I can think of, that doesn't require modifications to your current BG rendering engine and that doesn't need special PPU tricks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 19, 2010 3:57 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 1518
Location: Fukuoka, Japan
I didn't "put the dots together" and realized that once the scrolling is finished, you just switch to the normal NT.

Another possibility is to just decode the next map in the "scrolling" position first in the hidden NT then once the scrolling is finished, re-decode again the proper way in the hidden NT then switch but that seems over complicated. But, hmmm... this way may not work for scrolling down because of the black bar hmmm..

Many good ideas I will try to test them once I find time. Thanks guys.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 19, 2010 4:02 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10116
Location: Rio de Janeiro - Brazil
Banshaku wrote:
Another possibility is to just decode the next map in the "scrolling" position first in the hidden NT then once the scrolling is finished, re-decode again the proper way in the hidden NT then switch but that seems over complicated.

Yeah, you'd have to mess with your map decoding routines, something I tried to avoid when coming up with a solution.

Quote:
this way may not work for scrolling down because of the black bar hmmm..

It works with my method, you just have to copy the rows from the hidden NT from top to bottom, and on the visible side you have to start by overwriting the black bar at the bottom and wrapping back to the top. Like, rows 0 and 1 from the hidden NT will overwrite the black bar, and row 3 will replace row 0 of the visible NT.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group