Maybe this is a limitation of using RebelSDL, it would be a nice feature if #BRUSH-to-#BRUSH Collision can handle it pixel exact (on visible alpha-pixels for example).
Or this is a Limitation of Hollywood 9.1 (Linux). I didn't find informations in the readme of the Hollywood 10-Release, that this feature was improved/added.
Pixel exact collision brush to brush
Re: Pixel exact collision brush to brush
Add: With RebelSDL-Plugin 1.1
- airsoftsoftwair
- Posts: 5277
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Pixel exact collision brush to brush
Hmm, the Collision() function should support pixel-exact collision detection?! What exactly isn't working for you?
Re: Pixel exact collision brush to brush
Imagine a sidescroller like R-Type.
I use a giant wide-brush as prerendered game-level. The level has graphics on top and bottom and in between it is full alpha transparent.
When i put my player brush on it the #brush-collision gives me always true back, even if i don't touch the visible areas of the level (top and bottom).
An other example is, when an object touch the invisible alpha-border of another brush, collision is true immediately.
So in my case the collision will be true if at least one pixel (visible or not) of each BRUSH-BOX is overlapping.
Maybe this is a limitation of Hardware-Brushes in combination with DoubleBuffering and RebelSDL on Linux?
I use a giant wide-brush as prerendered game-level. The level has graphics on top and bottom and in between it is full alpha transparent.
When i put my player brush on it the #brush-collision gives me always true back, even if i don't touch the visible areas of the level (top and bottom).
An other example is, when an object touch the invisible alpha-border of another brush, collision is true immediately.
So in my case the collision will be true if at least one pixel (visible or not) of each BRUSH-BOX is overlapping.
Maybe this is a limitation of Hardware-Brushes in combination with DoubleBuffering and RebelSDL on Linux?
Re: Pixel exact collision brush to brush
@Andreas:
I send you an example (code + images).
I send you an example (code + images).
- airsoftsoftwair
- Posts: 5277
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Pixel exact collision brush to brush
Yes, it's a limitation of hardware brushes, not only on Linux but in general. For hardware brushes collision detection is never pixel exact because that would require reading from the hardware brush but that isn't easily possible because it's in GPU memory and reading from GPU memory is only possible with significant overhead. AmigaOS will also freeze the mouse pointer when reading from video memory but also on other platforms reading from VRAM is a real performance killer.
To work around this limitation you could use hardware brushes for drawing and software copies of the hardware brushes for collision detection. For software brushes collision detection will always be pixel-perfect. I'll add a note in the Collision() documentation that informs the user that hardware brushes don't support pixel-perfect collision detection.
Re: Pixel exact collision brush to brush
Hum...stupid question...but that method dont double the memory usage since you have to load an hardware copy and a non hardware copy of the same brush?airsoftsoftwair wrote: ↑Sun Sep 24, 2023 12:54 pm
Yes, it's a limitation of hardware brushes, not only on Linux but in general. For hardware brushes collision detection is never pixel exact because that would require reading from the hardware brush but that isn't easily possible because it's in GPU memory and reading from GPU memory is only possible with significant overhead. AmigaOS will also freeze the mouse pointer when reading from video memory but also on other platforms reading from VRAM is a real performance killer.
To work around this limitation you could use hardware brushes for drawing and software copies of the hardware brushes for collision detection. For software brushes collision detection will always be pixel-perfect. I'll add a note in the Collision() documentation that informs the user that hardware brushes don't support pixel-perfect collision detection.
Simone"Tuxedo"Monsignori, Perugia, ITALY.
Re: Pixel exact collision brush to brush
Yes is does, at least for all bitmaps that need pixel-exact collision. Normally only the Playfield and the small Player-/Enemy-/Bullet-Sprites which doesn't represent the majority of RAM-allocation in my game-project. There are also other big bitmaps like parallax-layer, background-/foreground-layer which didn´t need collision at all. So in times of Gigabytes of RAM/VRAM i can life with it.Tuxedo wrote: ↑Tue Sep 26, 2023 11:39 pmHum...stupid question...but that method dont double the memory usage since you have to load an hardware copy and a non hardware copy of the same brush?airsoftsoftwair wrote: ↑Sun Sep 24, 2023 12:54 pm
Yes, it's a limitation of hardware brushes, not only on Linux but in general. For hardware brushes collision detection is never pixel exact because that would require reading from the hardware brush but that isn't easily possible because it's in GPU memory and reading from GPU memory is only possible with significant overhead. AmigaOS will also freeze the mouse pointer when reading from video memory but also on other platforms reading from VRAM is a real performance killer.
To work around this limitation you could use hardware brushes for drawing and software copies of the hardware brushes for collision detection. For software brushes collision detection will always be pixel-perfect. I'll add a note in the Collision() documentation that informs the user that hardware brushes don't support pixel-perfect collision detection.
Last edited by fingus on Wed Sep 27, 2023 10:28 am, edited 3 times in total.
Re: Pixel exact collision brush to brush
Thank you for the hint, it does work, so i'm not forced to use an own collision-function which saves me a lot of work, thank you!airsoftsoftwair wrote: ↑Sun Sep 24, 2023 12:54 pmYes, it's a limitation of hardware brushes, not only on Linux but in general. For hardware brushes collision detection is never pixel exact because that would require reading from the hardware brush but that isn't easily possible because it's in GPU memory and reading from GPU memory is only possible with significant overhead. AmigaOS will also freeze the mouse pointer when reading from video memory but also on other platforms reading from VRAM is a real performance killer.
To work around this limitation you could use hardware brushes for drawing and software copies of the hardware brushes for collision detection. For software brushes collision detection will always be pixel-perfect. I'll add a note in the Collision() documentation that informs the user that hardware brushes don't support pixel-perfect collision detection.
Re: Pixel exact collision brush to brush
Yes I think same of you, but my Amiga-optimizer heart was still hererfingus wrote: ↑Wed Sep 27, 2023 10:23 am
Yes is does, at least for all bitmaps that need pixel-exact collision. Normally only the Playfield and the small Player-/Enemy-/Bullet-Sprites which doesn't represent the majority of RAM-allocation in my game-project. There are also other big bitmaps like parallax-layer, background-/foreground-layer which didn´t need collision at all. So in times of Gigabytes of RAM/VRAM i can life with it.

Simone"Tuxedo"Monsignori, Perugia, ITALY.