-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OBJ Window interaction with objects is inaccurate #275
Comments
That's an interesting find. I will definitely look into this, but please allow a little bit of time, since I'm in the middle of rewriting my PPU emulation at the moment. |
No hurry! The improved PPU emulation is surely more important than a small bug not being emulated. |
This looks like another instance of the sprite priority bug. Window OBJs seem to update the priority in the sprite line buffer, even if the pixel is transparent. This means the window sprite, since it is rendered after the test sprite, can force the test sprite to become visible outside the sprite window where the two sprites overlap. |
@Vulcalien this bug should be fixed in the latest development build |
I can confirm that the newest version [^1] of NBA runs the test ROM exactly like hardware! However, it isn't fully accurate yet. I tried running the game in which I originally found the bug and now NBA is showing "too much". I've included another test ROM: this time it's a modified version of that game showing the exact situation where the inaccuracy occurs. What worksIn the demo, the player is holding a lantern, causing four sprites in OBJ window mode (the lantern's light) to make the area visible. Unlike all other sprites that have priority 2, the lantern light's sprites have priority 0 (which causes the weird behavior). The newest version of NBA correctly shows the zombies "on top" of the dark area. What doesn't workBut if the inventory is opened (by pressing The second inaccuracy can be seen after closing the menu ( Sorry for the long text, and thanks for caring so much about accuracy! ROM: minicraft_debug.zip [^1] I tested both the nightly build and a compiled version of the master branch. |
Intuition: maybe the pixel priority is updated only if that pixel is outside of the window? That would make sense, because the menu has BG priority 0 and the pixels drawn on top of it appear to have OBJ priority 0. |
Yes, I was actually testing exactly that in this moment, lol! That seems to fix this issue. This is so cursed haha. |
@Vulcalien this should be fixed in the latest dev build now. |
It works! Exactly the same behavior as on hardware. All the pixels are in the right place. |
In GBATEK documentation, in describing the OBJ Window, there is this line:
The color, palette, and display priority of these OBJs are ignored.
NBA seems to have this behavior, but on hardware it doesn't seem to be true.
I made a test ROM that shows the difference in behavior.
The Test object (OBJ 0) is a red square.
The Mask object (OBJ 1) is in OBJ Window mode.
The Background is BG0.
By pressing any button, the priority of them will change.
For example, the behavior is different for BG: 0, Test: 1, Mask: 0
This might be some sort of "garbage" result on hardware that isn't emulated.
It may have to do with Test being OBJ 0 and Mask being OBJ 1. I haven't tried the opposite order.
ROM: test.zip
Source Code: source.zip
The text was updated successfully, but these errors were encountered: