User Tag List

Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 29

Thread: Tearing hear out over Order. Proper way to do it?

  1. #11
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Konidias View Post
    Outcast... you'll need to post an example or a screenshot or something. Without us knowing what your game looks like, we can't advise you any more on how to set up the layering.
    This is not specific for a game, but I have always had problem with this. So far none of the suggestions here work (except my own with foreach, which is kind of long and clumsy)
    Here is an example of Shabadage latest suggestion (does not work either)
    Attached files Attached files

  2. #12
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Okay... fixed it with Layer Object. Let me know if you have questions.

    Order-LayerObject.mfa

  3. #13
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Konidias View Post
    Okay... fixed it with Layer Object. Let me know if you have questions.

    Order-LayerObject.mfa
    Thank you Kondidias I must ask, why is the value multiplied by the bottom of the frame?

  4. #14
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Glad you asked! The reason behind this is so that you can assign "layers" to each object while also allowing them to sort by their Y position. Since we are sorting by descending, that means the bottom most objects will draw to the front. We would run into lots of layering issues if we just let it sort the objects only by the Y position...

    For example, if you have a Background object at Y position 300 and a Foreground object at Y position 295, then the Background object would be drawing in front of the Foreground object. (which we don't want)

    But if we use the alterable value for the "layer" (foreground being 2) and multiply that by the bottom most Y position, then it effectively sorts all objects by their "layer" category. Basically the method I posted allows you to sort by the value of the layer number you set, PLUS the y position of the objects.

    If you just sort by the value (and not the Y position) then you're going to get sort issues with the same layer objects drawing oddly on each other. (like 2 foreground objects not sorting to the proper layers, since they are both just told to draw above the other layers, but not sort themselves out)

    What is happening is if you have a window that is 480 pixels high:

    Objects with value 0 are sorted by their y positions from 0 to 480.
    Objects with value 2 are sorted by their y positions from 0 to 480 PLUS 2*480. This ensures that objects marked with value 2 will ALWAYS sort over objects at value 0, since the final range is 960 to 1440.

    So the layer object sees all these value 0 objects and sorts them from 0 to 480, and then it sees all these value 2 objects and sorts them from 960 to 1440.

    Since 960 to 1440 is greater than 0 to 480, it will ALWAYS draw any value 2 object above value 0 objects... Even if the value 2 object's y position is much lower.

  5. #15
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Oct 2006
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, what you wanted was far more complicated than your example text made it seem. Glad a solution was found.

  6. #16
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Konidias View Post
    Glad you asked! The reason behind this is so that you can assign "layers" to each object while also allowing them to sort by their Y position. Since we are sorting by descending, that means the bottom most objects will draw to the front. We would run into lots of layering issues if we just let it sort the objects only by the Y position...

    For example, if you have a Background object at Y position 300 and a Foreground object at Y position 295, then the Background object would be drawing in front of the Foreground object. (which we don't want)

    But if we use the alterable value for the "layer" (foreground being 2) and multiply that by the bottom most Y position, then it effectively sorts all objects by their "layer" category. Basically the method I posted allows you to sort by the value of the layer number you set, PLUS the y position of the objects.

    If you just sort by the value (and not the Y position) then you're going to get sort issues with the same layer objects drawing oddly on each other. (like 2 foreground objects not sorting to the proper layers, since they are both just told to draw above the other layers, but not sort themselves out)

    What is happening is if you have a window that is 480 pixels high:

    Objects with value 0 are sorted by their y positions from 0 to 480.
    Objects with value 2 are sorted by their y positions from 0 to 480 PLUS 2*480. This ensures that objects marked with value 2 will ALWAYS sort over objects at value 0, since the final range is 960 to 1440.

    So the layer object sees all these value 0 objects and sorts them from 0 to 480, and then it sees all these value 2 objects and sorts them from 960 to 1440.

    Since 960 to 1440 is greater than 0 to 480, it will ALWAYS draw any value 2 object above value 0 objects... Even if the value 2 object's y position is much lower.
    Oh that is really smart Seems like a very failsafe method! But I must ask, theoretically it could break if you would have like 10000 of a middleground object vs just 2 of a foreground object? I don't think that will ever be the case but just to know

    Another related question, I would probably want to have this sort value to be the same across all objects, I am thinking alterable value Z. That is really far down in the list, if I use that value will that take up more "space" if I have that value used on all objects instead of using like alterable value A? I am thinking the system somehow have to create all the above values first or something, i am not really sure how that works.

  7. #17
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    It won't break since it's not looking at number of objects but just their value and what their y position is.

    Also I don't think it will take up more "space" to use Alterable Value Z but I'm not totally sure. Either way I think the amount would be not worth worrying about. I'm pretty sure active objects already set aside memory for A-Z variables...

  8. #18
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    nv....

  9. #19
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Ok so I have a new problem now, how can I make a new object sort itself to the right order? I tried to make the layer sort everything through again once a new object is created, and while that works very good in regular runtime, in flash it makes the game freeze for about half a second..

  10. #20
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Is it possible to somehow only do the ordering bit on some objects, (like the new created one) It is really annoying that something so "simple" as object ordering is always causing so much trouble :/

Page 2 of 3 FirstFirst 1 2 3 LastLast

Similar Threads

  1. Check for Tearing?
    By FinalSpecimen in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 27th February 2013, 11:28 AM
  2. [bug] Texture tearing
    By colej_uk in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 14th March 2012, 05:36 PM
  3. Unable to hear music in runtime
    By Apex in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 26th November 2011, 06:50 PM
  4. Can't hear samples - Win7
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 21st January 2010, 03:44 PM
  5. Serious tearing
    By RayMarble in forum Hardware Accelerated Runtime
    Replies: 8
    Last Post: 27th October 2009, 08:22 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
  •