Hi guys I am wondering what the best (fastest) way to horizontally scroll through a tile map is?
I did this once before : I had 21 sprites side by side and every time one went off the left-side of the screen I would move it to the right side of the screen. It worked fine but it wasn't very efficient because I would move each individual sprite to the left one by one.
I have thought about joining sprites (using the sticky bit) together in 2 groups and managing these. Seems a little complicated though having to unstick and re-stick them. I want to know if there is a simpler way I am missing?
I also had an idea of using the fact that the display area automatically wraps round after 512 pixels (I'm sure it does this). But it seems like I would have to use extra sprites to fill up the 512 width to do this or would I?
Thank you I appreciate any help. I am not asking for code Just for the best way to do it
Hi
It depends on the design and complexity of your background.
But I would choose an intermediate solution. Having 6 groups of 4 sticked sprites. When a group appears completly offscreen after a scrolling step, it would go to the other side of the screen. This offscreen group could also have his tiles changed comfortably during multiple frames.
Thank you for that idea - that is not one I would have thought of myself! It seems like a simpler solution although I guess the disavantage is that it does use more of the horizontal sprite limit up. Especially if you have 2 layer parallax
Do you know how the official Neo Geo games do this kind of horizontal scroll?
That's really interesting info. Thanks blastar.
I can see there could be an advantage using 32 unlinked sprites because you can turn the sprites off that aren't on the visible display (with height=0) Will be interesting to see how that compares speedwise with having 21 or 24 linked sprites in group(s)
Is there any way to use 32 linked sprites and have the non-visible sprites NOT count towards the horizontal sprite limit? (probably a dumb question but I'll ask it anyway!)
One thing I have always wondered was why Blazing Star has flicker on the first boss when you fire your weapon in line with it?. Because just at a glance it doesn't look like there are enough sprites on screen to make flicker happen.
I never used 32 linked sprites group, but I would not be surprised if the LSPC simply ignores the sprites outside screen and they don't count in the 96 sprite per line limit.
Did you try to have 4 x 32linked sprites to see what happens ?
I'm sure I have tested that - just with a ton of sprites in the past and any sprites outside the display area *DO* count towards the limit. It really bugged me because seems like a bit of a design flaw. I think the Neo Geo just puts the first 96 sprites into the display list based solely on Y position and sprite height. I did only test it in MAME and it was an older version. Maybe its different on real hardware?
My input on this one is that DATLib supports 'scrollers' I believe the documentation indicates that the 'scroller' manages 21 sprites automatically. The updating of the tile gfx is managed under the hood. They are very straight forward to use and there are examples for declaring and incrementing the position of your large map. This is an ideal solution if you want to skip manually programming your own scrolling map.
I have also played around with programming my own managed sprites aka 21 or more free floating strips. I do this still using DATLib and I don't notice tearing. I believe DATLib 0.3 specifically improved tearing (I think that's in the notes from what I remember)
The trick to managing off screen sprites exceeding 21 is to hide / clear the invisible sprites to my knowledge if the sprites are cleared and not redrawn the next frame that allows for more sprites to be drawn. We are always managing 96 sprites turning off/clearing the ones we don't need.
In DATLib 'sprites' are chained aka when you use the animator tool. So I guess you could make 'sprites' that are 4 tiles wide by 512 pixels high. This would mean the act of chaining the sprites is done under the hood via DATLib solely due to the process you are creating sprites via the method DATLib requires. Then you could use the 'Sprite Pool' method to make animating / hiding and showing sprites much easier. DATLib's Sprite Pools are great because they automatically manage sprite widths that fluctuate but in your case all strips will be 64 pixels wide so that is less important but the hiding/showing could be helpful. What I mean is that the pool manages sprites in the list. I belive when they are hidden via DATLibs function call they are not counted toward the 96 sprite limit.
The issue would be updating your strips if you used this method as you would have to iterate the gfx data manually and apply it to the applicable strip.
Then of course if you don't intend on using DATLib this sugestion is not relevant. I must say I love this forum and you guys. I worry my feedback might not be ideal but it is a joy to participate in the madness that is NeoDev!
I like datlib very much. This is really great.
Engines like ngdevkit are also cool. But making sprites and backgrounds is not as easy as datlib. I have little development time.
Usually after I write the code. Next time I look at the last code, I can't remember what I wrote.
It's hard for me to master difficult development tools.
Datlib allows me to make some simple games. I will never forget this tool
tcdev 2023-02-09 at 04:36am I'm scrolling horizontally in Xevious. I use two lots of linked sprites.
Each frame (when scrolling) worst case is that you just need to reposition 2 sprites, unlink one and link another. Although the logic is a bit tricky it's still only 4 SCB accesses, which is the key here. I keep track of the left-most sprite in a variable to make things a bit quicker. I also have coded two distinct cases; scrolling that does not require the sprites to change (7/8), and scrolling that does (1/8) in my case (I'm using 50% scaled sprites on the background).
Worst case is when resetting the scroll position to an arbitrary value. Instead of trying to optimise the SCB accesses, I simply unlink and re-link/re-position everything. It's only done very infrequently, and not done during active gameplay.
Also I can confirm that any sprite with height > 0 will be placed in the sprite buffer, regardless of position (on MAME at least, but that is what the MVSTECH doc says too). Not ideal, but that's how it works.
How can you do with only two sprites?
Yeah. But you need to update the last one each time and relink them right? Because if you display them as a block, the ones going past the boundaries of the screen will eat in the horizontal sprite limit 🤔