Results 1 to 2 of 2
  1. #1
    Farscience is offline Farscience
    Join Date
    Sep 2012
    Posts
    8
    Rep Power
    0

    Question Efficient/fast collision detection system help.

    I know how to do the simple kind of collision detection (making rectangles around my sprites and checking to see if they intersect), but now I'm working on a scrolling game (the kind with tiles). To have any kind of details, I need to generate a couple to generate a couple thousand tiles, but when I loop it, it tests every single tile to see if it collided with my camera entity, to check if it should be drawn. Checking a couple thousand tiles against a couple thousand tiles give me 0.001(my estimate) FPS.

    The problem: Could anybody show me a small example of a more efficient way to check collisions, or maybe an idea to change my strategies?
    Thanks.



    Note: I googled it but every page I checked on collision detection told me to do it my way.

    P.S. I didn't post any code, but if you need it, I can.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,843
    Rep Power
    8

    Default Re: Efficient/fast collision detection system help.

    If you have a 2D tile system, I'm going to assume you have something like a 2D array. From there it should be pretty trivial to figure out which indices of the 2D array are on the screen. No real "detection" necessary.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Collision detection
    By mwr1976 in forum Java 2D
    Replies: 2
    Last Post: 04-14-2012, 12:45 PM
  2. Collision Detection
    By Äppelpaj in forum Java 2D
    Replies: 1
    Last Post: 10-13-2011, 03:29 PM
  3. Collision Detection
    By sunde887 in forum Java 2D
    Replies: 2
    Last Post: 10-07-2011, 11:40 PM
  4. Really Need help with some collision detection
    By Harwad in forum New To Java
    Replies: 1
    Last Post: 01-23-2011, 12:38 AM
  5. Collision Detection
    By dotabyss in forum Java Gaming
    Replies: 0
    Last Post: 03-14-2010, 06:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •