User Tag List

Results 1 to 8 of 8

Thread: Question about fine collision detection

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about fine collision detection

    I have some questions about fine collision detection.
    My understanding is that it is a lot more CPU heavy to use 'fine collision detection' than it is to use box detection, but I'm a bit vague as to the reasons why.

    It would be nice if someone could explain in detail:
    1. what's going on when you have 'fine collision detection' turned on
    2. why it's more CPU heavy
    3. if you need to turn it off for every object, or if there are times when it doesn't matter if it's on or off



    Thank you very much
    Simflare

  2. #2
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2016
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my answer for question 1. and 2
    for fine collision cpu has to calculate position of every outline pixel of your object
    and check for coliding for each of them ,
    If You turned it off it only has 4 calculations one for ich border of your player

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply. So I guess the question is when does it calculate those things, during an event or outside of an event at run time. That would help to know if it matters if it's left on for every object or not

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,081
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    Just to expand on #1, I don't think it actually looks at every single pixel, but rather a crude shape outline of the whole thing, like this:



    This image is taken from the in-Fusion help section. It's actually about the physics collision, but I think the regular fine collision works the same way. As Quadrat said, without it, it'll just treat each sprite like a rectangle.

    #3: I suspect there are times when Fusion is smart enough to not bother testing for fine collision on an object (eg. something that's off-screen). But just to be sure, I always turn it off wherever I don't need it, just in case.

  5. #5
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    There's also times when having a box collision won't be the right idea. For example a 32 x 32 active object with a small enemy sprite in the middle that's maybe half that size. Your hero would be constantly getting hit by those famous 'invisible hitboxes' from far away and it'd look bad.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is some very useful information, thank you.
    I'm coming at this from the point of view from optimization. I am wondering about a case where an active object exists on the screen, and fine collision detection is set to on, yet there is no code that checks for collisions with that object. I wonder if, in that case, that object is using up extra memory because of 'fine collision detection' to generate that collision mask, or if the collision mask only gets generated when there is actually a box overlap.

    My assumption up until now is that if 'fine collision detection' is on for any object on screen, that it takes up extra memory to generate that collision mask. But I am not sure if this is so.

  7. #7
    Clickteam Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    621
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Let's assume your object is this:

    Pixels in blue is the image, in red is the collision mask, in purple are both.

    When ticked off, Fusion will generate this collision box:

    It will create easy collisions, and check whether another collision mask is overlapping this mask in a area-like style. (If a corner or a pixel from a collision mask is inside the collision box's area, they are overlapping.)
    I'm pretty sure this only takes a couple variables, so it does not use much memory (And those variables are already used in an Active). (Probably just width and height)

    When ticked on, Fusion will generate this collision mask:

    As you can see, this is more accurate, and for collision detection, it will loop through each pixel in the mask to check if another mask is colliding it.
    I'm pretty sure this method uses the alpha channel of the object, where > 0 or RGB is not 0,0,0 will be a collision. Therefore using already taken memory and adding extra functionality from it.

    Therefore, I don't think any of these methods use extra memory, just that the fine detection option uses more CPU / GPU power to check overlaps (Since it needs to check each and every pixel in the image that isn't black or fully transparent).

    You don't need to turn it off for every object, since it only starts up when a collision / overlap event is attached.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/7RNXFrC
    Dungeon Raiders! - Link soon™

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect summation, thank you! I was worried you might have to manually turn it off for every object. Thank you very much!

Similar Threads

  1. Collisions between "fine detection" and non "fine detection" objects on IOS
    By Ramses in forum iOS Export Module Version 2.0
    Replies: 5
    Last Post: 5th April 2012, 09:07 AM
  2. Question: Collision detection for overlapping objects
    By ardo in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 11th February 2012, 06:08 PM
  3. Use Fine Detection [checked] VS Use Fine Detection [unchecked]
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 26th January 2012, 08:32 PM
  4. [BUG] Fine collision detection
    By Sphax in forum File Archive
    Replies: 1
    Last Post: 6th August 2007, 09:54 PM
  5. re: Fine detection question
    By ClickerGuy in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 12th June 2007, 08:46 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
  •