User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: X Left sometimes gets read from the wrong frame

  1. #1
    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,491
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)

    X Left sometimes gets read from the wrong frame

    I've found a strange bug. It caused me lots of headaches this week until I isolated it. Or at least kind of isolated. I managed to make an MFA that reproduces it, but how/why/when exactly the bug happens still makes little sense to me. It started when I noticed a very disconcerting bug in my game where certain enemies would behave differently on 2 different computers, despite using the exact same MFA. I even found situations where the problem would reproduce on the same computer, under specific circumstances - for example when running edrtex.exe vs 'Build & Run'. You can see the problem in the GIF below - the blue object is supposed to move identically in both cases, but in the bottom example it starts climbing the wall about 50 pixels too early.



    Over the course of various tests and experiments, I found a whole bunch of factors that seemed to affect this bug. For example, turning machine independent speed off, doing 'build & run', or just running the MFA on my laptop, all increased the chance of the bug occurring. On the other hand, turning machine independent speed on, increasing vsync back buffers to 3, or even just making small unrelated changes to the MFA (thereby perhaps forcing some refresh of a cache?) all seemed to help prevent it.

    I finally identified the culprit of the problem, though not necessarily the cause (that is, I know what goes wrong, but not why). Please patiently bare with me as I try to explain the issue, as this seems to be a very elusive and inexplicable bug, and the steps required to reproduce it seem almost nonsensical.

    The problem is related to a particular detector object that I use to help the blue object (seen in the GIF) navigate the environment. This detector object has 2 frames. The first is a 50x50px square (which serves as an icon that is easy to see in the Frame and Event List editors), while the second is the actual detector that gets used at runtime - a flat rectangle shape:



    Now, the first frame has its hotspot in the top-left:



    ...while the second frame has its hotspot in the centre (at x=31):



    Now, here's the line of code that is causing the bug. When the detector hits a wall, I record the X position of the detector's left edge, and I store this as the altVal turnCornerPoint. The enemy will then start climbing when its X position reaches the value of turnCornerPoint:



    It's the left edge part that goes wrong. Sometimes, in certain circumstances, for some weird reason, Fusion reads the X Left information from the first frame of the active, not from its current frame.

    I stripped down my MFA until I could isolate the problem in a 100% reproducible way (at least for me, tested on both desktop and laptop). The resulting MFA shows the problem clearly, but also reveals the enigmatic and seemingly nonsensical nature of the bug. Let me explain:

    In the test MFA (attached: Attachment 29306 - required), there are 3 near-identical rectangles:



    Two are just like my detector, and contain two frames, like this:



    While one just contains a single frame:



    All three rectangles have their hotspot at X=31. When you run the MFA and open the debugger, the output window displays the same equation for each rectangle: X left - X (in other words, the X difference between the left edge and the hotspot). In each case, the true answer is -31.

    As you can see, the answer for the white object (the one with only one frame) is given correctly, while the answers for the others are wrong. They are evidently based on the information of the rectangles' first frames (the hotspot in the first frame of the black rectangle is at X = -99):



    Now, here's where it gets weird. There's a Time X object sitting in the frame doing nothing. It has no referenced events, it's just sitting in the Frame Editor:



    Now, if we delete this Time X object and run the frame again, suddenly the problem vanishes!:



    This is what I discovered when I stripped and stripped my MFA until the bug went away. Eventually I had deleted everything until I had just one single event left, which happened to reference the Time X object. Once I deleted that event (and the object), the problem was gone.

    Well, that's problem solved, right? The Time X object is causing some sort of conflict - end of story? Well, not quite. I went back to my main game MFA and deleted every Time X object and every event that references it. Then I quit Fusion and reloaded it....and the X Left bug is still there! So while removing Time X very clearly resolves the problem in my example MFA, it actually doesn't do anything in my main game, which is where I found the bug in the first place.

    In fact, let's return to the demo MFA. We'll reinstate the Time X object, which again produces the bug (as we can see by the debugger not showing -31 for all objects):



    And now, let's add in a simple, empty Static Text object. Now, the problem magically goes away, even though the Time X object is still present:



    Hopefully the MFA I attached above can help Clickteam fix it. But keep in mind that the bug seems more elusive than that MFA alone suggests. As mentioned, it seems to interact (either positively or negatively) with machine independent speed, vsync, triple buffering, building the EXE (vs running edrtex.exe), and even just making unrelated changes in the MFA (eg. adding a line of code or changing some pixels in a graphic). There's a clear interaction with the Time X object at some times, but an ambiguous and/or non-existent one at other times. It's even affected by a Static Text object, so who knows how many other objects/factors might come into play. Oh, and I haven't tested X Right, Y Top etc. but I assume they have similar problems. Thankfully, XActionPoint seems to be ok, though I only tested it briefly.

    For now, I guess I'll just avoid using X Left (and X Right, Y Top, etc.). Though a fix for (or at least some insight into) this bug would be greatly appreciated. Thanks.

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator
    SirEatAlot's Avatar
    Join Date
    Oct 2010
    Location
    Stockholm, Sweden
    Posts
    396
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    wow really detailed and strange problem.. let's hope clickteam can track this one down

  3. #3
    Clicker

    Fusion 2.5Android Export Module

    Join Date
    Jan 2007
    Posts
    278
    Mentioned
    8 Post(s)
    Tagged
    1 Thread(s)
    This sounds just like "Corrupted code" that has been plaguing click products for ages. Making arbitrary changes may correct or make issues worse and moving event lines around may do the same. I know you probably have a ton of code, but is it possible to copy everything over to a new frame and see if the problem persists?

  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,491
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)
    I just tried copying the objects and events from the example MFA (not my main game, but the MFA I attached above) into a new MFA, and the problem persisted. Same behaviour: deleting Time X makes it work properly, as does adding a Static Text object.

    EDIT: Just to be safe, I recreated a brand new MFA from scratch just now. Just like the previous example MFA, but all new objects and code (nothing copied and pasted). The behaviour remains the same.

  5. #5
    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,491
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)
    I'm bumping this, as I don't know if anyone at Clickteam saw it.

    EDIT: I've always had a natural gift for involuntarily finding weird and obscure bugs. But I must say, reading this thread again, I'm particularly proud of this one! it's one of the weirdest bugs I've ever found

  6. #6
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,784
    Mentioned
    257 Post(s)
    Tagged
    3 Thread(s)
    Could you attach a MFA please? (the current attachment doesn't seem valid anymore)

  7. #7
    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,491
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)
    I'll try attaching again:
    Attached files Attached files

  8. #8
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,784
    Mentioned
    257 Post(s)
    Tagged
    3 Thread(s)
    Quick update: it's due to the TimeX object requesting joystick messages to be sent to the app window for its pause/resume features. Removing joystick button tests in TimeX fixes the issue, but I can't do that. Still trying to understand what happens in the Fusion runtime, I'm puzzled...

  9. #9
    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,491
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)
    I ended up removing TimeX in my game and still got the bug. Though I'm still using TimeString and Microtimer objects (and Joystick 2 and XBOX Gamepad) so perhaps it's a similar interaction with one of those?

    Also, any idea why adding a static text object in my example MFA 'solves' the issue?

  10. #10
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,784
    Mentioned
    257 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Volnaiskra View Post
    I ended up removing TimeX in my game and still got the bug. Though I'm still using TimeString and Microtimer objects (and Joystick 2 and XBOX Gamepad) so perhaps it's a similar interaction with one of those?

    Also, any idea why adding a static text object in my example MFA 'solves' the issue?
    No idea yet, I had to switch to something else yesterday, I'm going to take another look today.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. When no lives left it doesn't go to next frame.
    By GrampaSwood in forum Fusion 2.5
    Replies: 9
    Last Post: 3rd March 2016, 12:34 PM
  2. Right Side of Frame merge left
    By Shadeve in forum Fusion 2.5
    Replies: 5
    Last Post: 25th February 2014, 05:17 PM
  3. Have a frame remain as you left it
    By SuperDisk in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 15th February 2013, 04:46 PM
  4. [BUG] X Right Frame expression return X Left Frame position
    By mobichan in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 18th October 2012, 02:08 PM
  5. Leaving frame 1 to right, enter frame 2 from left
    By Martin in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 16th May 2010, 08:29 AM

Posting Permissions

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