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! / Collision

Author
Message
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 26th Jul 2004 22:27
I was wondering if theres any way at all to create accurate collision checking using DirectX 9. With sprites being 3d, theres no chance of true per-pixel collision, but it would be nice if there was some kind of fast workaround. Does anybody know anything?

I was thinking that if the game engine was tile based, you could keep an array of background tiles, this array would use a structured typr to store a vector or 2 points which formed an invisible straight line that calculations could be made from. Just an idea, probably pointless. Would only work on tiles requiring straight-line collision aswell.

Any ideas anyone?

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 27th Jul 2004 00:12
An idea came to me that I hadnt really thought about... sin/cos maths to do curved surfaces. Although its just an idea, can anyone elaborate?

Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 27th Jul 2004 00:19
I think there's a Dll for perfect sprite collision. Dunno where it is though.

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 28th Jul 2004 09:07
Ive had a snoop around TCA's site but found nothing. Cant think where it might be. To be honmest rather thatn a DLL, Id like to know HOW it is done.

MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 29th Jul 2004 00:10
IanM has posted code in the code base. Look for pixel perfect collision using alfa. I´ve haven´t been able to try it out yet.


Jam on mother f**ker.
Libera tu mente y te liberaras.
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 29th Jul 2004 02:20
Cheers MIR I'll have a look

the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 29th Jul 2004 12:58
There are a couple of examples floating about, either in the codebase or codesnippits board.

Both times I needed pixel perfect collision I used an arrays. It would be just as possible to make a memblocks. It's pretty simple to write a point function that works on memblock images. Then you just need to check the areas of the sprites that are overlapping and check if any pixels are overlapping.

down at fraggle rock
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 2nd Aug 2004 09:27 Edited at: 2nd Aug 2004 09:43
I am Using a very simple collision detection for my 2d shoot em up game. So Far its working great (Just like my old shoot em up game in DBC with sprite hit commands)

As I said above its really simple collision for beginners so dont critisize me. Okay all ya have to do is create a box that would fit inside your char. Color it black or pink or whatever color you are using for your transparent areas so you cant see it. Then in your sprite hit(1,2) or whatever replace the char or object # with the box # that fits in it.
If anyone needs me to explain it better post below.

And dont make fun of my bad sprites

Char. that you need collision for.


Create a Box in the area you need Collision for.


Copy the Box area and color it your transparent color



http://www.angelfire.com/games5/db_games/
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2004 03:40
Actually, that's not a bad idea.

Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 3rd Aug 2004 07:26 Edited at: 3rd Aug 2004 07:27
lol ya its not really that bad... it works fine in my case. I just couldnt understand anyone elses methods. Guess Im still a noob.


http://www.angelfire.com/games5/db_games/
the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Aug 2004 09:27 Edited at: 4th Aug 2004 09:29
You could even add extra boxes to make it even more accurite.
If everything is moving fairly quickly you proberly wouldn't be able to tell the difference.



it's cool to hate
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 4th Aug 2004 11:57 Edited at: 4th Aug 2004 11:59
Yep Exactly

Also it would just be a couple more lines of code you can understand easily than some of the other methods I have seen.

Now the question is, Why hasnt anyone else mentioned this method before? I mean it does seem to work good right? Or are there flaws that occur with more complicated games.


http://www.angelfire.com/games5/db_games/
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th Aug 2004 23:14
Well, I wouldn't mention it because I don't have DBPro, and DBClassic collision is perfect anyway. Then there are a lot of newbies who wouldn't mention it. Then a lot of people are using 3D most of the time. Then, you have to think of the idea.

MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 7th Aug 2004 02:59
Quote: "Why hasnt anyone else mentioned this method before?"

Actually that´s the method I use in Dark Fighter. It´s good, fast and easy but sometimes it´s too inacurate or not suited to a constantly changing sprite.


Jam on mother f**ker.
Libera tu mente y te liberaras.
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 7th Aug 2004 09:18
@ Mir,
heh you must have had to draw a crap load of boxes.


http://www.angelfire.com/games5/db_games/

Login to post a reply

Server time is: 2025-05-15 22:14:12
Your offset time is: 2025-05-15 22:14:12