-
Notifications
You must be signed in to change notification settings - Fork 45
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
Is the negation of the sprite collision mask correct? #31
Comments
This is indeed different to the emulators currently work. The example below sets the palette offset for the moving sprite to the collision mask in the ISR. The moving sprite has a mask of $f, while the three blocks are $1, $2, $4. So when they collide in the emulators we get the or of those masks moved into the offset. In the hardware it looks like we get the inverse instead. Should the Emulators: |
I suppose it would depend on @fvdhoef 's intent for the meaning of "mask". By some definitions, such as netmask, setting a mask bit to 1 masks (excludes) those bits from consideration. That's what I see here in the Verilog and that's what I understand as a strict definition of the word mask. However, the X16 emulators have it the other way around, where a bit set to 0 excludes it from consideration in the collision, and while that might be more intuitive without explicit documentation saying otherwise, that's not what the hardware is doing. So I'm hoping to get a sense of the actual original intent, and if the VERA's current hardware behavior is what was intended, I'm going to push for a change in the emulators to match. |
Additionally, the sprite collision mask in the line buffer is written to without the inversion:
|
My intents are as follows: Imagine that you have a r-type style shoot 'm up game. You'd assign the sprites of your space ship mask 0001, the mask of enemy ships 0010. Bullets that you fire 0010 (the same as the enemy ships) and enemy bullets 0001. Now you can just move the sprites along the screen and when an enemy bullet hits your space ship the ISR contains 0001xxxx. When your bullet hits an enemy ship the ISR will be 0010xxxx. If both occur at the same time the ISR will be 0011xxxx. You could also have a bullet that hits both type of ships, for this the collision mask would be 0011. So basically the collision mask gives you the possibility to group your sprites into 4 categories of objects, for which the collision mask will indicate how they will collide with each other. |
Thanks, Frank. I think there's still some confusion, and I think the behavior is even more confused than I originally thought. So I wrote a simple BASIC program to demonstrate the output from the ISR register under certain sprite configurations. 10-25) We initialize two overlapping sprites (from the same memory location, very likely to contain overlapping pixels, but they're disabled at first. I double-checked the state of ISR and the two sprites by hand after the program finished, and I hope you're as confused as I am :) I'm certain this VERA is current with the current state of the |
Awesome, thats how I thought it should work. It does mean that the |
I don't have the means to test it out at the moment. So if one of you could actually modify this and test this on real hardware, that would be awesome. |
I can make the change and test. I think the inversion to
|
* Bump version to 0.47.0 in preparation for R47 * Update top.v Update major revision to 47 to match kernel.
I'm trying to understand how sprite collision works, and the negation of the mask on this line looks wrong.
I cant think of a reason why it would be there, but I don't really know the intent of how the collision is to be used either.
vera-module/fpga/source/graphics/sprite_renderer.v
Line 328 in 1a87b77
The text was updated successfully, but these errors were encountered: