User Tag List

Results 1 to 6 of 6

Thread: Specific, reproducible bug for Direct3D 9 collision detection

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Oct 2010
    Location
    Riverside, CA
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Specific, reproducible bug for Direct3D 9 collision detection

    I'm running R256.34 and I'm attaching a .mfa file illustrating the issue. LOS_woes.mfa

    I'm attempting to construct a sort of line-of-sight algorithm using a detector object. The detector is a single pixel. In a fast loop, the X scale of the pixel is set to the distance from the seeing object to the target (mouse, or player object.) Its angle is set to the angle from the seeing object to the target. Then it tests for overlaps with walls. If the detector object overlaps a wall, then the player should be safe from being seen.

    There is slightly more to it: the walls all have their animation directions changed to a "footprint" mode and then changed back after the line-of-sight calculation. It's easy enough for me to see if the detector overlaps any part of any wall, but I need to detect overlap with the walls' footprints specifically.

    Now, in the attached .mfa file, the collision detection behaves exactly as it should if you just load it up and run. However, if you change the display mode to Direct 3D 9, you will see that it breaks the behavior. Also note that while in Direct 3D 9 mode, if you position the seeing object and the mouse just right so that the mouse has the same y coordinate as the object and is to the right of the object, it *will* detect collisions with the walls.


    Anyway it would be nice if this technique still worked in Direct3D 9. It would mean the difference of 10-20 FPS for me in normal gameplay, and that's not an exaggeration.

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,295
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    It sounds like just the usual thing with how MMF2 handles collision detection...
    It basically saves the position, animation frame, angle, etc of all the objects at the start of the frame. Then when you test for a collision, it uses the current state of the object you specify (which is why embedded collision detectors work), but compares that against the saved state of other objects as they were at the start of the frame (which is why collisions between two embedded collision detectors don't work). In your case, you can either rotate & resize the detector OR you can switch to the footprint mode and back - but you can't do both.
    It's all explained more thoroughly in other threads.

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Oct 2010
    Location
    Riverside, CA
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    It sounds like just the usual thing with how MMF2 handles collision detection...
    It basically saves the position, animation frame, angle, etc of all the objects at the start of the frame. Then when you test for a collision, it uses the current state of the object you specify (which is why embedded collision detectors work), but compares that against the saved state of other objects as they were at the start of the frame (which is why collisions between two embedded collision detectors don't work). In your case, you can either rotate & resize the detector OR you can switch to the footprint mode and back - but you can't do both.
    It's all explained more thoroughly in other threads.
    But what I'm doing works perfectly fine in standard display mode, it just breaks in Direct3D 9. You can test it yourself.

  4. #4
    Clicker Multimedia Fusion 2
    GreenOnion's Avatar
    Join Date
    Oct 2012
    Location
    Sweden
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I gave it a shot - It seems like the line is checking if it's overlapping with the walls being in the right direction (the graphics) rather than the left direction (the collision mask of sorts) - Since that's the last picture/frame it has to work with. IE: In software mode, active's animations can be changed dynamically and be immediately updated for events; instead as in Direct 9 mode where active's animations only update at the end of the frame.

    Work-around-time!

    ... I suggest this:
    LOS_woes (fix).mfa

    It pastes/adds backdrops (as obstacles) in the first two frames with the collision images (at each active), and then checks for obstacle overlapping instead.
    You could then delete a backdrop at a certain X and Y position if you wish*. (I very much believe so at least, there's an action for that - but I've never used it.)

    (*which you do, "breaking-wall-behavior dude")
    Attached files Attached files

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Oct 2010
    Location
    Riverside, CA
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by GreenOnion View Post
    It pastes/adds backdrops (as obstacles) in the first two frames with the collision images (at each active), and then checks for obstacle overlapping instead.
    You could then delete a backdrop at a certain X and Y position if you wish*. (I very much believe so at least, there's an action for that - but I've never used it.)
    (*which you do, "breaking-wall-behavior dude")
    Thanks so much! This technique should work fine in my larger game since I don't use the backdrop on this layer for anything. You are the hero of the day!

  6. #6
    Clicker Multimedia Fusion 2
    GreenOnion's Avatar
    Join Date
    Oct 2012
    Location
    Sweden
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Rickshaw View Post
    Thanks so much! ... You are the hero of the day!
    Glad to help

Similar Threads

  1. Possible bug in PMO collision detection
    By K1kk0z90 in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 4th August 2011, 01:56 PM
  2. détection collision
    By graboide in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 12th December 2010, 05:24 AM
  3. Testing the collision of a specific pixel
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 27th August 2009, 09:17 PM
  4. Collision detection problem...
    By fawfulfan in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 26th June 2009, 12:40 AM
  5. Collision detection
    By Crash86 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 1st April 2007, 04:50 PM

Tags for this Thread

Posting Permissions

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