Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Sprite collision is confusing and frustrating me.

Author
Message
floccipocci
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 17th Sep 2003 09:06
Ok. The more I try, the more confused I get.

I don't see the difference between Sprite Collision and Sprite Hit.

I've experimented various ways with different "configs", to see how sprite collision and hit behaves, such as:
1) Setting which sprite overlaps the other. Sprite Priorities
2) Offsetting sprites
etc.

I used 2 kinds of sprites. One is a solid square box (call this 'tester'), and the other is a small circle (call this 'target'), surrounded by black which will be my transparent color.

My condition is that, when a hit or collision occurs, I display a message to show if a hit or collision is occuring.

So i use the arrow keys and moved the box sprite slowly to see how the collision affects.

If i remember right, one of them tests to see if the colored pixels of the sprites overlap, and the other is to test to see if the sprites overlap, including the transparent color. BUT... It seems to me that there is not difference between collision and hit.

It makes things even more confusing when I try to see if probably the offsetinf of sprites might be playing a part, or maybe it's probably the priority, but I've gone nowhere. In fact, I'm even more confused THAN before.

At another point, getting down to the extremely basic testing, I used a solid colored box sprite (no transparent color) as 'target', to see how it REALLY works, but when i move the 'tester' sprite, it can move happily at this small region of the top of the 'target', without affecting anything at all.

I hope someone can please show me the light. Apologies for this rant. I'm getting nowhere and backwards.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Sep 2003 11:27
DB Classic had mask style collision, as in the pixels not coloured black would register a collision.

DBPro doesn't have this feature. The whole square box registers a collision. Sad but true!

Pincho.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Sep 2003 16:48
The built-in sprite collisions just test for overlapping boxes.

I have some code that does pixel-perfect testing for sprites (as long as you don't use rotations or scaling) that I will upload to Codebase tonight for everyone
floccipocci
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 17th Sep 2003 21:31
So in DBPro, the whole box registers as a collision then? How disappointing.

Hm, I guess that offsetting and rotating the sprites seem to affect the collisions. I offsetted a box sprite a little bit, and there is no collision at certain parts of the box. That is, it seems that the collision occurs at the place where the sprite originally was, i.e. with no offsetting. I'll try again tomorrow to see if this is true. This time i will offset the sprite a lot way off the original position.

IanM : Thanks, I hope to see the code and maybe get some more ideas on other ways to do collision, hopefully includes rotationg and scaling. How about offset? Does it affect?

I find it very disappointing and surprising (if it is true) that DBPro does not have collision testing on the colored pixel level.
floccipocci
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 17th Sep 2003 21:34
Hm, another thought :

If the collision system is just box based? Then wouldn't SPRITE COLLISION and SPRITE HIT be very redundant? A duplication of the same function?
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Sep 2003 21:37
Sorry to disappoint you, but ... oh, read the long description of what I've posted (It does handle offsets BTW).

Collision and hit are two different things. Collision will register each time you test for sprites that are in contact. Hit will only register when you move a sprite into collision. Once it's collided and if don't move it, it won't register a second time.
floccipocci
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 17th Sep 2003 22:37
Oh i see.. Finally found the Live Codebase.

I have a clue of what is going on in there. But for now I gotta see what I can do with memblocks.

Thanks a lot.
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 18th Sep 2003 05:33
wasn't this going to be fixed in patch 5, I havn't installed it so I don't have p5, but I thought it was on the fix list?

CTP
floccipocci
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 18th Sep 2003 13:53
Well, I had installed the patch 5 to see if it is 'fixed' or something before coming here to rant about it, but it seems to be the same to me., patch or no patch

Well yeah, anyway I also have some rants about certain 3D functions becoming 'broken' by patch 5, but I'll save that for maybe later, since I'm more interested in making 2D games
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 18th Sep 2003 19:16
ah yes...good memories. how long did we spend on that code, ian? hehehe.

for some background there, ian and i met when we decided to optimize pixel-perfect collision over in dbdn...probably about a year ago now, or close to it anyways. we were post-trading and sticking up optimizations that (no kidding) would save 2/1000's of a second.

the code is ultra-quick and you shouldn't have to dig into the memblocks portion if you just want pixel-perfect collision (although it makes a fun study...ian did some pretty good coding there in the memblocks with pointers etc.).

-= i only do what my rice krispies tell me to do =-
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Sep 2003 20:43
Um, we actually spent far too much time on that code mate

I've just looked back over it and we took 10 days or at least, I did. It looks like I just didn't want to let go

I wonder if it's worth converting it to a dll ...
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 19th Sep 2003 06:22
maybe it wasn't fixed, I thought it was on the fix or to be fix list maybe it was about something else. It's just that we hadn't seen anyone post about this for awhile now, used to be a weekly posting about it on here.

Sorry, CTP
Ads
20
Years of Service
User Offline
Joined: 13th Sep 2003
Location:
Posted: 22nd Sep 2003 23:53
You may have seen game like mario and metroid which are platformers and basically I was wondering how I would make platforms?

Login to post a reply

Server time is: 2024-05-05 12:05:25
Your offset time is: 2024-05-05 12:05:25