MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

shadowgangs
MAME Fan
Reged: 10/02/15
Posts: 85
Send PM


Shadow Gangs (NeoGeo), scrolling issue going right only.
#397375 - 11/10/23 11:22 AM


Hi;

I am trying to port my game Shadow Gangs to the NeoGeo, I got now to the point where I can start polishing and optimizing the game.
I get a glitch on the background scrolls, when the character is moving right, and not when he is moving left.

Video bellow shows the issue.

https://www.youtube.com/watch?v=ihFIA4oDINM

On Mame, the glitch is still there, but instead of a empty vertical line, it's like white or black small dots or rectangles all over the screen.

-It doesn't happen when moving left on both GNGEO and Mame.
+Doesn't happen also when the framerate is 60 fps.
-Doesn't happen when Idle, only when moving.
-Also, If wait for 2 or 3 Vsyncs or more, it doesn't happen. (But then the game is then very slow)

I am not using sticky, and I put the sprites on the correct X position.

The thing that I don't understand, is that it happens only when moving right, not left...

Do you guys have an idea what the issue might be?

Thank you for any insight and help.



Haze
Reged: 09/23/03
Posts: 5245
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: shadowgangs]
#397377 - 11/10/23 04:51 PM


> Hi;
>
> I am trying to port my game Shadow Gangs to the NeoGeo, I got now to the point where
> I can start polishing and optimizing the game.
> I get a glitch on the background scrolls, when the character is moving right, and not
> when he is moving left.
>
> Video bellow shows the issue.
>
> https://www.youtube.com/watch?v=ihFIA4oDINM
>
> On Mame, the glitch is still there, but instead of a empty vertical line, it's like
> white or black small dots or rectangles all over the screen.
>
> -It doesn't happen when moving left on both GNGEO and Mame.
> +Doesn't happen also when the framerate is 60 fps.
> -Doesn't happen when Idle, only when moving.
> -Also, If wait for 2 or 3 Vsyncs or more, it doesn't happen. (But then the game is
> then very slow)
>
> I am not using sticky, and I put the sprites on the correct X position.
>
> The thing that I don't understand, is that it happens only when moving right, not
> left...
>
> Do you guys have an idea what the issue might be?
>
> Thank you for any insight and help.

When are you updating your spritelist? it looks almost like you're doing it mid-frame and getting some sprites from one frame and some sprites from the next on certain lines

maybe there's more processing going on when moving right?

I might be able to find time to work with you and debug the issue if you need closer analysis.



shadowgangs
MAME Fan
Reged: 10/02/15
Posts: 85
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: Haze]
#397378 - 11/10/23 06:49 PM


Hi Haze;

Thank you for the reply.
Been fighting with this NeoGeo version for some 4 months now, going from doing in c to c++, then cpu and ram issue (64kb), but I have I think everything now in place for the game, apart the music, sound and the new graphics (they will be redrawn completly).

The two issues that still need addressing now is the framerate, and this weird scroll issue.

I had this issue from start, but didn't look at it until now, as I am moving to polish and optimization.

Been looking at it for 2 days, with no real solution, been going in tangents, and not getting to the real problem of this.

I saw Metal SLug 2 videos, it's a slow game at times 30 fps and didn't see this glitch on it, so I hope there is a solution for it, and always when moving right.

So far, what I found is that when I draw an identical tile all over the screen (for testing), some tiles are more prone to this issue that others (also the palette plays a role)

That's what I found up to now, but still even with "good" tiles, the glitch is there on Mame, but not on GNGEO.

- There is no different processing from left or right, the same cpu time.
- I tried a test program with minimal code, and I can see the issue on it too...

Do you have a discord or any screen share program, I could share my screen and you can see the whole thing.

Can also make a zip with minimal example, but I think a screen share would be great if possible?

(have some other questions related to the NeoGeo, some I don't understand, although I followed the NeoDev wiki on it, examples are some zoom that acts weird on startup).



shadowgangs
MAME Fan
Reged: 10/02/15
Posts: 85
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: Haze]
#397379 - 11/10/23 08:59 PM


> When are you updating your spritelist? it looks almost like you're doing it mid-frame
> and getting some sprites from one frame and some sprites from the next on certain
> lines
>
> maybe there's more processing going on when moving right?

Update on the issue, as I think I am getting something with my tests:

I wait for vsync signal to start setting value in VRAM.
What I was doing is update the position of around 20 * 3 = 60 background sprites + some char sprites 10 enemies that are 4 sprites width ( around 40 sprites).
In total let's say 100 sprites position updates.

When the game is running at 60 fps, I didn't notice the issue, but when it goes under I can see it.

But during my test, I still simulated under 60 fps, but this time for the draw updates after the sync signal, I chained the sprites, and used the sticky bit.
This lead to very few position updates, (3 for the backgrounds, and 10 for the enemies)
Doing this, I didn't see this issue anymore, even if the game is very slow.
(I guess because now writing to VRAM after the sync signal is very fast?)

That means, I need to rewrite how I draw the backgrounds and sprites, and be mindful of this small leeway between the Vsync signal and when the electron beam is back at top left of the screen again?

That's what I think is happening, so then this sticky bit on the NeoGeo is of huge importance then?
How does the Genesis manages the drawing (I think it has no sticky)

Edited by shadowgangs (11/10/23 08:59 PM)



shadowgangs
MAME Fan
Reged: 10/02/15
Posts: 85
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: shadowgangs]
#397382 - 11/13/23 11:46 AM


Update on this issue.

I changed the way I was scrolling the backgrounds.

I now use the chained sprites functionality of the NeoGeo, and also take advantage of the rolling of the sprites at 512 pixels boundary of the NeoGeo, both vertically and horizontally.

This issue then disappeared, and I didn't see this glitch again.
(The question of why it showed up only moving right is still unknown, but I don't care about it now).

(I saw on Mame that after using 3 backgrounds, the characters weren't showing up on screen, found out it was due to the sprite limits, and added a way to turn off sprites off screen, while still having the rolling the backgrounds at 512 pixel boundary).
Really enjoying programming the NeoGeo, as a simple thing like a scrolling which is very easy and straightforward on modern machine, is not on the old hardware.
And Mame is a big help on this, gngeo still show sprites even if it hits the limit.

Now the last hurdle is the get the 60 fps performance...



Haze
Reged: 09/23/03
Posts: 5245
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: shadowgangs]
#397387 - 11/15/23 10:41 PM


Glad to hear you're making progress

and yes, if you want smooth sprite updates then you absolutely need to only update the spritelist in the period after the final scanline, before the first line is being drawn again.

The NeoGeo doesn't have "tilemap" backgrounds, so yes, you definitely want to use sprite strips, ideally only keeping what should currently be visible in spriteram, and nothing more (this is why a lot of NeoGeo games have bad clipping issues outside of the 304 pixel wide region in the center of the 320 visible area - they were TOO aggressive in optimizing this, assuming people wouldn't see that area)

The 68000 really isn't that fast (it's often a bottleneck in Neo games)

of course there are times when you might want to update some parts of the spritelist midframe, and you'd typically use the raster interrupt for that - triggering it on a programmed scanline and updating a few values in the spritelist at that point (unless you're mad and time the display manually like Master of Syougi does for the title screen animation) in those cases you'd only want to be changing the absolute minimum number of sprite positional registers and nothing else though, otherwise you'll end up with the same issue - anything beyond a rowscroll effect on a floor, or the pseudo 3d of the pitch in Super Sidekicks 2 (and higher) is probably asking too much in terms of what you can safely change during the display area.

I'm still not sure why it was only causing you an issue in a single direction (although there would be a logical reason) but it sounds like you're on the right track.

Even a lot of commercial NeoGeo games struggle to keep things both within the per-line sprite limit, and keep sprite updates within the desirable non-display period, often resulting in ugly tearing or sprite dropout even on real hardware.




> Update on this issue.
>
> I changed the way I was scrolling the backgrounds.
>
> I now use the chained sprites functionality of the NeoGeo, and also take advantage of
> the rolling of the sprites at 512 pixels boundary of the NeoGeo, both vertically and
> horizontally.
>
> This issue then disappeared, and I didn't see this glitch again.
> (The question of why it showed up only moving right is still unknown, but I don't
> care about it now).
>
> (I saw on Mame that after using 3 backgrounds, the characters weren't showing up on
> screen, found out it was due to the sprite limits, and added a way to turn off
> sprites off screen, while still having the rolling the backgrounds at 512 pixel
> boundary).
> Really enjoying programming the NeoGeo, as a simple thing like a scrolling which is
> very easy and straightforward on modern machine, is not on the old hardware.
> And Mame is a big help on this, gngeo still show sprites even if it hits the limit.
>
> Now the last hurdle is the get the 60 fps performance...



shadowgangs
MAME Fan
Reged: 10/02/15
Posts: 85
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: Haze]
#397388 - 11/16/23 11:39 AM


Hi Haze;

Thank you for your reply and your amazing Mame work.
Was always reading your blog about emulation updates

68000 is the main issue for me now.
Will keep you updates, need to have 60 fps most of the time, and that would Shadow Gangs on the NeoGeo



ICEknight
MAME Fan
Reged: 07/06/15
Posts: 166
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: shadowgangs]
#397389 - 11/16/23 08:35 PM


Can't help with the problems presented here but wishing you the best of luck on this super interesting backport!



shadowgangs
MAME Fan
Reged: 10/02/15
Posts: 85
Send PM


Re: Shadow Gangs (NeoGeo), scrolling issue going right only. new [Re: ICEknight]
#397394 - 11/17/23 10:25 PM


> Can't help with the problems presented here but wishing you the best of luck on this
> super interesting backport!

Thank you for your support.
If all goes well, I am planning a Kickstater to act as preorders and also for the whole game art to be redrawn in pixel art.
(Very important, as it's not possible to reuse the art of the modern versions as they high res).
I have an art studio working with me, and they are ready to redraw the game.
We'll see...

Edited by shadowgangs (11/17/23 10:25 PM)


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
1 registered and 127 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 422