Thoughts on SpritePixelCollision
Thoughts on SpritePixelCollision
While checking for collisions, would it be best to check for SpriteCollision instead of SpritePixelCollision, and if there is a SpriteCollision, then check for SpritePixelCollision? Would this make a huge difference speed wise?
While I'm on the subject of SpritePixelCollision, has Linux PB been updated to support it? I haven't got a PC set up with Linux at the moment so I can't test it. I found this routine programmed in PB: http://www.purebasic.fr/english/viewtopic.php?t=13377 but it's pretty slow.
While I'm on the subject of SpritePixelCollision, has Linux PB been updated to support it? I haven't got a PC set up with Linux at the moment so I can't test it. I found this routine programmed in PB: http://www.purebasic.fr/english/viewtopic.php?t=13377 but it's pretty slow.
Should be part of the documentation too.Fred wrote:SpritePixelCollision() already do a SpriteCollision() internally before doing the pixel comparison.
In my past I used
SpriteCollision and SpritePixelCollision() behind.
As I read now.
That is not really a performant way because SpritePixelCollision() does it too.
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
-
BriceManuel
- Enthusiast

- Posts: 195
- Joined: Thu Nov 29, 2007 8:23 am
No, it would be MUCH, MUCH slower if it didn't do box collision before checking for pixel collision.IceSoft wrote:Maybe one of the reasons why it is slower as DX9?Fred wrote:SpritePixelCollision() already do a SpriteCollision() internally before doing the pixel comparison.
I am pretty sure that DX9 does box collision before doing pixel collision, it would be a lot slower if it didn't.
If you are using PB's native commands, for speed you can try using the regular box collision and then doing shrunken rectangle collision instead of using the pixelperfect collision. It should be much faster if you need to test against a lot of sprites.
It will be usefull if this info:
... SpritePixelCollision() using SpriteCollision() before it check with pixel perfect algorithmus....
In some of my games I use SpriteCollision() before I use SpritePixelCollision().
Of course it is a novice problem...but not all PB user can be a PB insider...
Online help can be a help in this case to optimize a game.
... SpritePixelCollision() using SpriteCollision() before it check with pixel perfect algorithmus....
In some of my games I use SpriteCollision() before I use SpritePixelCollision().
Of course it is a novice problem...but not all PB user can be a PB insider...
Online help can be a help in this case to optimize a game.
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
-
BriceManuel
- Enthusiast

- Posts: 195
- Joined: Thu Nov 29, 2007 8:23 am
I think most who knew this, knew it because it has become a "standard" among gaming languages as to how the "pixel collision" function works.
Yes, it should be in the docs, but I cut them some slack since the docs are a bit rough around the edges due to English not being the first language of whoever wrote them.
Yes, it should be in the docs, but I cut them some slack since the docs are a bit rough around the edges due to English not being the first language of whoever wrote them.

