Multidirectional scrolling

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

In [url=http://nesdev.com/bbs/viewtopic.php?p=77821#77821]this post[/url], Banshaku wrote:And instead of talking about mappers we should focus on making simpler game with less hardware
And "lose [your] interest right away", as you put it :P
so we can have some code base to work on more ambitious projects. I guess that was people in the past did indirectly anyway.
And that's what I continue to do, despite strong suggestions from someone to make something that scrolls already.
Last edited by tepples on Mon May 09, 2011 11:34 am, edited 1 time in total.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

tepples wrote:And that's what I continue to do, despite strong suggestions from someone to make something that scrolls already.
That would be me, right? =)
User avatar
qbradq
Posts: 952
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq »

I found scrolling to be needed for the project I want to do, unfortunately.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Scrolling is easier than most people think, specially if it's just in one axis. Horizontal scrolling is particularly easy, due to the fact that nametables are 256 pixels wide.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

Yeah scrolling one direction at a time is easy but scrolling both at the same time (free-directional scrolling) is a nightmare, I got weird bugs every time I tried to do that because the update logic for one axis would interfere with the logic of the other axis.
Useless, lumbering half-wits don't scare us.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tokumaru wrote:Scrolling is easier than most people think
Efficiently organizing data for scrolling, on the other hand, isn't necessarily trivial. Nor is creating several km worth of map data to be scrolled over.
User avatar
Banshaku
Posts: 2404
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku »

tepples wrote:And "lose [your] interest right away", as you put it :P
Making a game with less complicated hardware doesn't mean that it's a single screen game. And with a mmc1 like from retrousb you could make something similar to Ninja Gaiden.

I don't know how you got back that post and what was the purpose in the first place to digg it up. It doesn't bring much to what I said about "let focus on games instead of making a new mapper".
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Bregalad wrote:Yeah scrolling one direction at a time is easy but scrolling both at the same time (free-directional scrolling) is a nightmare, I got weird bugs every time I tried to do that because the update logic for one axis would interfere with the logic of the other axis.
I'm sure you would eventually get it right if you hadn't given up. I too have found weird bugs while trying to implement free scrolling, but once I stopped and planned everything beforehand I only needed minor tweaks to get it working.
tepples wrote:Efficiently organizing data for scrolling, on the other hand, isn't necessarily trivial. Nor is creating several km worth of map data to be scrolled over.
Even simple puzzle games can benefit from rooms slightly larger than a single screen... No being able to see everything that's going on might even add to the fun. Not all levels must be several kilometers long.
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

I've gotten free scrolling to work fine. Should I write a tutorial?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

I think free scrolling isn't that hard. I think it's combining it with compression (the "efficiently organizing" that tepples talks about) that's difficult, at least I feel like it would be.
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

3gengames wrote:I think free scrolling isn't that hard. I think it's combining it with compression (the "efficiently organizing" that tepples talks about) that's difficult, at least I feel like it would be.
So you probably haven't written an 8-way scroller yourself, have you? :) It IS hard, there are so many chances to be "off by one" that you really have to be very careful when designing how you're going to go about it. I'm of course talking about "real" limitless scrolling with variable scrolling speeds, not the SMB3 way (vertical scroll is limited to 2 screen heights, it only needs to update columns) or the Gauntlet way (4-screen mirroring, screen limited to 512x480).

That said, if you are systematic about it's not too bad. But it is hard in my book as far as NESDev goes.
3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

I haven't, but I've been thinking about it. [And sadly, came to the conclusion I'd probably just do it the SMB3 way to save the headach.] but I think I should rephrase. Doing it with compression and not using a ton of RAM would be hard. And to add to it, I also was thinking of a way to also update a 60 byte table to also keep track of walkable spaces. That seemed easy, but yet it uses 60 bytes of RAM. I'm not sure if anyone else has better methods, but with low CPU costs. Does anyone use a RAM table for collision on the background so you don't have to read the PPU?
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

3gengames wrote:Doing it with compression and not using a ton of RAM would be hard.
Map decompression and nametable updates should, in theory, be 2 different systems. Anyway, if you use fixed-size compression (i.e. not RLE, LZ and the like), decoding it in real time isn't so hard.
I'm not sure if anyone else has better methods, but with low CPU costs. Does anyone use a RAM table for collision on the background so you don't have to read the PPU?
I doubt anyone reads the PPU for collision. If they do, they certainly shouldn't. VBlank time is already too short if you're only writing to VRAM, imagine if you also had to read it in order to make game decisions...

I'm not sure if RAM tables are the best option either, because they wouldn't work well with slopes and blocks more complex than solid/empty unless they used much more than 60 bytes of RAM.

For collision decisions I just read directly from the level map. Once I have a metatile's index I have access to all of its collision information.

Now I really really think it's time for a split!
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

What always bugged me is that the vertical scroll and horizontal scroll routines would work fine on their own, but they would randomly interfere eachother when working at the same time.

Doing 4-way scrolling like Final Fantasy or Dragon Warrior is easy for example, as the horizontal scrolling can assume the vertical scrolling is at an integer number of metatile and vice-versa.

When you want true free-directional scrolling, the problem is that if the scrolling of the "other direction" (that is, vertical axis for the horizontal scrolling routine and vice-versa) might not be an integer number of metatiles so you don't know how you are supposed to do your updates, because it depends on what the "other" routine is doing at the moment. (I hope my english wording of the problem makes sense).

I've tried this with both metatile based maps, and maps directly stored as spearate NES screens (raw name and attribute tables) and I encountered a similar problem on both attemps.

I'm pretty sure there is a fix available but it would probably mean use a more complex algorithm where there is a signle routine doing the scroll into all directions instead of two horizontal and vertical scrolling routines called one after eachother.

There is no reason to implement compression first, you need to make it work with uncompressed maps, then adding comperssion is as simple as replace all data load from map (which should be something like a lda [Map],Y) by a subroutine that will load data from the compressed map (for this reason it's important that the compession data is randomly acessible, pseudo-randomly acessible, or that the map is entierely decompressed in RAM).

I finally lost interest in this when I figured that all NES project I'll do in the near future would anyways scroll only one direction at a time.
Useless, lumbering half-wits don't scare us.
User avatar
clueless
Posts: 496
Joined: Sun Sep 07, 2008 7:27 am
Location: Seatlle, WA, USA

Post by clueless »

Dwedit wrote:I've gotten free scrolling to work fine. Should I write a tutorial?
Yes please.
Post Reply