Some phones and collision detection

Previous topic - Next topic

MrPlow

Hi

I had a user contact about their phone wont allow for collision detection - has this happened on other phones too.
Is there a fix for it? I think both use Sprcoll.

The Phone in question is a Samsung Galaxy Express Go Phone.

I got them to try my other games and its the same...so it must be problem with those samsungs?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

#1
Im did heard about the same for few years ago, im do uses ANIMCOLL for karmamiwa as well. Howover im do uses a special collision map using two colors (using a color and a transparency), not doing that on the normal image. You could try do the same which such of a map:
http://www.dropbox.com/s/utskqxpc2t78hg5/tilesset_2.png

the image its touch with is just a 1x1 "mouse col" image (which is how im could mirror and flipping the tiles. Im just calculate the mouse col pos before checking).

This is what im did when im using landscape collision in Karma Miwa. All enimies collision with the bird is just using a BOX collision.

im have a Samsung tab2 and seen the game on a Samsung s4 to, which im have not see the ANIMCOLL issue in Karma Miwa (using the above image). Howover you can not cover all Androids phones if they have a bad opengl implentation.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Thanks SF,

If the issue is not a boxcoll problem I could do a smaller boxcoll (within sprite bounds) to fix the sprcoll issue.
That way sprcoll will work for majority and other problem phones will have slightly less accurate hitboxes.

If boxcoll is also the problem, I will prob have to use the x,y,w,h of the items and do a manual if x>xx and x<xx to replicate the boxcoll. Maybe within a function?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

erico

That replicant (tyrel corp?) of box coll is what I´m using in my game from the very start, since the collisions needed are quite simple.
I think I also tested the game on that phone without trouble IIRC.

spacefractal

Boxcol is just a simple if math, nothing checking on the images it's self.

Some devices might been fuzzy, but have not seen that in my game. In my case I'm just used a 1x1 pixel check against a special sprite coll sheet when I'm do pixel check on the game landscape.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

Also alternative, you could do command test rutine with sprite col for checking it's works correctly or not. If its not, you could revert to a lesser precision boxcol or warn the user.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hmmm, thats good idea - I could flag at the start if sprcoll is working or not?

Draw 2 sprites that overlap then run

sprcoll = true then usesprcoll = true
else
use sprcoll = false

Then use usesprcoll in collision code.
if usesprcoll = true
sprcoll stuff
else
boxcoll stuff
endif

Something like that...
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

you could impose a function to handle that. So its automatic revert to boxcol in that functions. This is why im uses functions so much as im do.

Also you could also change the col image used to something like that one im did, using 2 colors (one purple, the other transparency, and this was used against a 1x1px source image).

You also dont need to draw the graphics first directly for collision checking. You just need to make sure they are loaded first.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

#8
Thanks SF,

Another good idea - I will do that custom function for reverting to boxcoll - sounds good!

I am not sure of the benefits for the 2 colour thing and the 1x1 image? is that for pixel perfect sprite collisions?
Or just your way of testing sprcoll is working for the device? 

my collision function:
Code (glbasic) Select
FUNCTION newcoll:id1%,x1%,y1%,w1%,h1%,id2%,x2%,y2%,w2%,h2%
IF usesprcoll=TRUE //set on startup test for sprcoll
IF BOXCOLL(x1,y1,w1,h1,x2,y2,w2,h2) //reduce number of sprcoll checks
IF SPRCOLL(id1,x1,y1,id2,x2,y2) THEN RETURN TRUE
ENDIF
ELSE
IF BOXCOLL(x1,y1,w1,h1,x2,y2,w2,h2) THEN RETURN TRUE
ENDIF
RETURN FALSE
ENDFUNCTION
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

Yes. Howover im did used ANIMCOLL (if that does some different).

For my case im used used a 1x1 pixel check against the purple image tileset for collisions. Im not sure its works on all devices, but did on those tested. Im did that because im diddent trust the command on the colorful images.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

SPRCOLL does the BOXCOLL internally.

spacefractal

its just been more controlable when the game could checks if its possible to do a pixel check or not. Hence this was a idea for checking. This is something you cannot fix and can been limits on some phones.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/