Skip to main content
gamedev.net
🔒 Locked

Question about Collision Algorithm

Started by Arbel 2 replies 900+ views
Original Post
Arbel
Arbel
I'll admit, I'm a complete newbie when it comes to collision detection. The only thing I've done is make a crappy tile-based game. Beyond that, I've had little experience with collision. I'm helping out my artist friends in programming a platform adventure game. Right now it's set to be pixel-based collision detection, as in there is a copy of the map image in all black, and it checks each pixel for a black value. This works fairly well, but it feels pretty inefficient. I thought about doing tile collision, but I'm not sure how this would work with ramps, or look smooth. In simple, what are some approaches for 2D collision? What do some of the games (like Aquaria) do?
Kwizatz
Kwizatz
I'd use a Quadtree, split the map using a grid and use the squares to populate the Quadtree, that way you still can use pixel based collision detection.
Arbel
Arbel
Thanks for the reply. I'll definitely take a look into it. Is it used in some games, or just a really efficient algorithm? I'm also using C# and XNA if that makes any difference. Not sure if pointers are usable in C# (I'm assuming they are tho.)
Kwizatz
Kwizatz
I cant cite any games but the algorithm is widely used, I think Baldur's Gate used this or a variant of it.

The Octree (the 3D relative) is also very popular in video games.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.