Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 747525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:12:54+00:00 2026-05-14T14:12:54+00:00

How exactly do you implement collision detection? What are the costs involved? Do different

  • 0

How exactly do you implement collision detection? What are the costs involved? Do different platforms(c/c++, java, cocoa/iphone, flash, directX) have different optimizations for calculating collisions. And lastly are there libraries available to do this for me, or some that I can just interpret for my platform of choice?

As I understand it you would need to loop through the collision map and find the area in question and then compair the input thing(e.g. a sprite) to the type of pixel that is in the questioned area. I understand the very basic idea, but I don’t understand the underlying implementation or even a higher level one for that matter. It would seem that this type of detection, or any for that matter, is very costly. Tile map? Bit array? How are these created from an image(I would guess looping and doing stuff)?

The reason I ask this question is to get a better understanding of the efficiency behind the scenes and to understand exactly what is going on. Links, references, or examples would be very helpful. I know this question is a bit longwinded so any help or references would be very welcome. Thanks SO!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:12:55+00:00Added an answer on May 14, 2026 at 2:12 pm

    Check this answer of mine regarding simple bounding box collision detection.

    Collision detection is a huge topic, but there are primiarly two areas. Broad phase, and narrow phase detection. Broad phase is quick and dirty, if this passes you move onto narrow phase detection. Narrow phase in turn is more complex, in depth detection. Even if a collision is detected in broad phase detection, the object may not have collided with anything.

    The key to being efficient within games is to not do work if you don’t have to. In other words, if you don’t have to perform collision detection, don’t. What I mean by this is imagine a game like GTA4. It would be madness, plus the game would run like a slideshow if you were to check each object against each other object in the world. A variety of methods can be used, but the best method is to limit the amount of checks. Here the world is split via the use of quad/oct/binary/ trees or some other spatial indexing algorithm. This means only nearby objects are checked, and thus the game will run much faster as only possible objects are checked for collisions.

    “How are these created from an image(I would guess looping and doing stuff)?”

    Yes and no. Per pixel collision detection falls into narrow phase detection, and is costly. In the majority of games it is simply not needed. Take a generic FPS. If you shoot an enemy between the legs say, it sometimes is classed as a hit, this is not pixel perfect, yet it works good enough.

    For 2D games, you’d know the size of the sprite, so any calculation would use a bounding volume. The same goes for 3D games, except this bounding volume is now in three dimensions. You can break complex shapes/models down into further bounding volumes. This process is then much, much quicker than checking pixels. Sometimes however, per pixel detection is required. It all depends on the type of game.

    As for good links, I’ll point you to Gamedev.net. It’s an excellent site to get started, should cover a broad variety of topics. A nice tutorial, showing you what further concepts can be applied is based around the development of a game called N and N+. To conclude, a game is an experience and illusion. At anytime if game programmers can make a simplification to speed up development or the game, we take it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 409k
  • Answers 409k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Put the database outside the website directory, then refer to… May 15, 2026 at 7:08 am
  • Editorial Team
    Editorial Team added an answer I couldn't find a sensible way of dealing with this… May 15, 2026 at 7:08 am
  • Editorial Team
    Editorial Team added an answer Why not use a facade? class RegistrationManager { public function… May 15, 2026 at 7:08 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.