Hey all! I am back again with yet another iteration of my adventure game demo. I started over from scratch writing a two-way scrolling engine that supports both horizontal and vertical maps (one or the other, like Metroid).
Right now all it does is load a map and let you scroll around it. But I'll tell you, that was a big challenge! Had it not been for TheFox's debugging extensions for Nintendulator I'd still be at it
The next step is to implement a proper object system. Unfortunately I can't reuse most of the code from the NES Adventure Game demo because I need real 16-bit positioning.
A couple technical points:
The scrolling engine breaks up the name table updates over four frames, and updates a 16-pixel wide area during that time. That means this engine cannot handle scrolling faster than 4 pixels per frame (it actually can, and even sustain the speed for several seconds, but I digress).
The same code path is used for both horizontal and vertical maps. Branches are taken to handle the differences. I am not sure if this is the best approach, but it has worked out for me
The thing I am most excited about is that the worst-case execution time for the scroll handler is 1569 cycles (not including the PPU updates in VBlank). That's only 5% of my frame! I think that will leave me plenty of head room for the object system.
About the demo:
The project page is here
Screenshot:
Download Link: iNES Format ROM
Switch maps with the Start button.
Scroll with the Left and Right buttons (even on the vertical map).
Hold down B to scroll 4 pixels per frame.
Hold down A to scroll 6 pixels per frame and watch it break
The thing that surprised me most about the scroller is how it handles scrolling too fast. Because it updates the extreme edges of the name tables, and due to how the "need to scroll" detection works, if you scroll too fast it will still handle things gracefully. You will eventually catch up to the scroll seam, but if you then slow down you can watch the updates progress off-screen. It's kinda neat to watch
Right now all it does is load a map and let you scroll around it. But I'll tell you, that was a big challenge! Had it not been for TheFox's debugging extensions for Nintendulator I'd still be at it
The next step is to implement a proper object system. Unfortunately I can't reuse most of the code from the NES Adventure Game demo because I need real 16-bit positioning.
A couple technical points:
The scrolling engine breaks up the name table updates over four frames, and updates a 16-pixel wide area during that time. That means this engine cannot handle scrolling faster than 4 pixels per frame (it actually can, and even sustain the speed for several seconds, but I digress).
The same code path is used for both horizontal and vertical maps. Branches are taken to handle the differences. I am not sure if this is the best approach, but it has worked out for me
The thing I am most excited about is that the worst-case execution time for the scroll handler is 1569 cycles (not including the PPU updates in VBlank). That's only 5% of my frame! I think that will leave me plenty of head room for the object system.
About the demo:
The project page is here
Screenshot:
Download Link: iNES Format ROM
Switch maps with the Start button.
Scroll with the Left and Right buttons (even on the vertical map).
Hold down B to scroll 4 pixels per frame.
Hold down A to scroll 6 pixels per frame and watch it break
The thing that surprised me most about the scroller is how it handles scrolling too fast. Because it updates the extreme edges of the name tables, and due to how the "need to scroll" detection works, if you scroll too fast it will still handle things gracefully. You will eventually catch up to the scroll seam, but if you then slow down you can watch the updates progress off-screen. It's kinda neat to watch