User Tag List

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

Thread: bug(?): Fusion sometimes ignores events with non-existent objects

  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,501
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)

    bug(?): Fusion sometimes ignores events with non-existent objects

    I've been hunting down some bugs in my enemy behaviour, and I've found that they're caused by objects that aren't present in the frame. For example, take this event, which decides whether an enemy should jump up to a ceiling:





    So, if an enemy has been flagged for testing the ceiling,
    and it's an enemy that is able to walk on ceiliing,
    and there's a clear path to the ceiling (the triangular detector doesn't overlap any collision objects),
    and there are no hazards (eg. spikes) waiting at that ceiling (neither red detector overlaps with a yellow exclamation mark qualifier),
    and there's a ceiling in the correct spot (the small green/blue detector overlaps a ceiliing)
    .....then the event will prepare the enemy to jump.

    This seemed to me like a reasonable way to do the event: is there a ceiling? check. Are there no obstacles? check. Are there no hazards? check. But there's a big problem. On this particular level, there are no hazards anywhere on the level. So there are no objects with the yellow exclamation mark qualifier present at all (they exist in the Frame Editor, but weren't created at runtime). And so Fusion completely ignores the entire event. As a result, the enemy never jumps to the ceiling, even though all the conditions for the event are true, because the event was never actually tested in the first place. If I place a hazard somewhere in the level, the event suddenly works.

    I did some quick tests, and it seems that this bug only pertains to objects in certain circumstances. For example, in an event with an overlap condition, only the absence of the second object prevents the event from firing. So, in the following example, the blue object spins, but doesn't scale (event #2 fires but #3 doesn't). So I guess that gives me a fix for my above problem - I can just switch the order of the objects in the conditions.




    I also found that if you put this event in global events, referring to an object that has "create at start" disabled (and therefore never exists in-frame), the event will fire if you run a frame that contains the object in the Frame Editor (even with "create at start" disabled), but won't fire if you run it from a frame that doesn't contain the object. This seems a bit different to my problem above, where an event doesn't fire even when the objects it references are all in the Frame Editor (albeit not all created at runtime).





    Is this sort of behaviour a bug or a feature? And if it's a bug, can it be fixed?

  2. #2
    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,501
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)
    On a semi-related note, can we have a way to search for negated events?

    Because of the above issue, I'm now going through all of my x is overlapping...events, and there doesn't seem to be a way to search for them directly. In the Find All window they appear as something like:

    ....Event line #3555, Condition #4: NOT det_ceilingDropE is overlapping....

    but if you search for "NOT" with Find All, it doesn't find those negated conditions

  3. #3
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,855
    Mentioned
    261 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Volnaiskra View Post
    Is this sort of behaviour a bug or a feature? And if it's a bug, can it be fixed?
    This is the way it works. When Fusion builds frame events, it removes or replaces the events that concerns objects that are not in the frame. Basically conditions are considered as FALSE so the entire event is removed, actions are removed, and expressions are replaced by 0. It does this either when it merges and builds global events in the frame, or even for normal frame events when for example you build an Android app and the frame contains an object that is not supported on Android.

    Yes this may seem to cause "illogical" issues for some conditions like "Compare number of objects" as "Number of XX == 0" should be replaced by an Always condition . The workarounds are: either copy the object to the frame (or an empty object with the same type and name) and unselect it's "create at start" option, or put the event in a group that you enable only for frames that contain this object.

    I don't know very well if we could "fix" this by adding fake internal objects at build time, I'll check when I find a bit of time, maybe this could be done for active objects at least, probably not for extension objects. In the TODO list I've noted to try to replace "Compare number of objects" by "Compare two general values" with 0 as first parameter, but there is a bit of work and I'm not sure I want to do it condition per condition.

  4. #4
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid 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
    655
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I'd generally steer away from negated overlapping conditions because (typically) Fusion shouldn't let an event execute if a condition selected no objects of a given type (Overlap has two given object types), but it's weird that it only safeguards one type.
    You should also take into account that the first object in the overlap is the only one that has an updated position in the overlap check, second objects use the position that they had at the beginning of the game frame (basically before any events are run for this game frame)

    "And so Fusion completely ignores the entire event... even though all the conditions for the event are true"
    The only way an event is stopped from executing actions is by its conditions stopping it (and inactive groups). Fusion reads the conditions from top to bottom and if one returns false, fusion moves onto the next event. Hence why it is best to order conditions from least computationally expensive to most as a condition will only be checked if all conditions above it were true.

    For a potential fix, you could try and "bake" the overlap results into a variable inside the objects so you can compare alt value to 0 for no overlap instead. But this will have to be redone every time an object moves. But that may or may not work depending on your project.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/7RNXFrC
    Dungeon Raiders! - Link soon™

  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,501
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Yves View Post
    This is the way it works. When Fusion builds frame events, it removes or replaces the events that concerns objects that are not in the frame. Basically conditions are considered as FALSE so the entire event is removed, actions are removed, and expressions are replaced by 0. It does this either when it merges and builds global events in the frame, or even for normal frame events when for example you build an Android app and the frame contains an object that is not supported on Android.

    Yes this may seem to cause "illogical" issues for some conditions like "Compare number of objects" as "Number of XX == 0" should be replaced by an Always condition . The workarounds are: either copy the object to the frame (or an empty object with the same type and name) and unselect it's "create at start" option, or put the event in a group that you enable only for frames that contain this object.
    This doesn't seem to be entirely correct, unless I'm misunderstanding you.

    Basically conditions are considered as FALSE so the entire event is removed, actions are removed, and expressions are replaced by 0. It does this either when it merges and builds global events in the frame, or even for normal frame events when for example you build an Android app and the frame contains an object that is not supported on Android.
    So do you mean that the event is removed/replaced at build-time, not at run-time? Which means that once an event is removed/replaced, it will be forever irretrievable at run-time? If so, that doesn't seem to be happening in this case. To test, I added this event:



    First, let me briefly explain my game's setup:

    • I make levels using special 'Editor' frames in the Frame Editor. When I run these frames, they save an array file (*.LVL).
    • My actual game takes place all on a single "Engine" frame, which contains my game's code and all of the game's objects (most of which have "create at start" unselected).
    • From this Engine frame, I load in the array files (.LVL) for the desired levels.
    • This Engine frame gets run only once, and remains running until you quit. When I load a new level, I don't reload the frame, or jump to a new frame. I simply destroy all level-specific objects, reset various altVals, read a new array .LVL file, and repopulate the frame with whatever objects are required of the new level.


    So, to test, I made 2 levels. Both are identical except level A contains a hazard (an object with a yellow exclamation qualifier) somewhere in the corner, and level B doesn't. When I load level A, the event screenshotted above plays the "klaxon" sound. When I load level B, the sound doesn't play. I can take turns loading level A, then B, A, B, etc. and whenever level A is loaded, the klaxon will play.

    Remember, this is all within the same frame - I'm not reloading the frame or jumping to a new frame. So, if Fusion removes/replaces this event, it must do so on-the-fly at runtime, and non-destructively. If there's a created hazard in the frame somewhere, that event will fire. If that hazard gets destroyed, that event will stop firing. If that hazard gets recreated, the event will fire again.

    The workarounds are: either copy the object to the frame (or an empty object with the same type and name) and unselect it's "create at start" option
    Like I wrote above, this is what I'm already doing. The frame already contains hazard objects (objects with the yellow exclamation mark qualifier), and every other type of object in my game. Their presence in the Frame at edit-time doesn't seem to make any difference. Only their created presence at run-time seems to matter. I can imagine other problems caused by this behaviour (eg. the player kills the last enemy, and suddenly all events which reference that enemy in one way or another stop firing).

  6. #6
    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,501
    Mentioned
    131 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BartekB View Post
    ...Hence why it is best to order conditions from least computationally expensive to most as a condition will only be checked if all conditions above it were true.
    Quote Originally Posted by BartekB View Post
    I'd generally steer away from negated overlapping conditions because (typically) Fusion shouldn't let an event execute if a condition selected no objects of a given type (Overlap has two given object types)
    Unfortunately, these two statements are at somewhat at odds with each other.

    I religiously order my conditions as you suggest, with the least computationally expensive (and/or least likely to be true) at the top. You can see this in my example event below. Flags will be tested first, followed by overlap checks. Of the overlap checks, the most likely to return false (green detector overlaps a platform) is at the top, so that it has a chance to abort the event before we need to test for the red detectors (which are most likely to return true, as hazards are rarer than platforms). This way, I encourage the event to 'fail early' - so it doesn't have to waste time testing for 2 overlaps (which will usually be true anyway) just to trip up on the 3rd (which will relatively often be false):



    But, if I am to steer away from negated overlapping conditions as you suggest, then I can't see a way to do it without significantly increasing the computational load. To achieve the same event without negated conditions, I would now have to do something like this:



    OK, so the number of overlap checks are the same (between 1 and 4, depending on situation), but now instead of executing the forEach condition once and flags twice, I have to execute the forEach condition 4 times and the flags 8 times. Aside from the performance impact, this also would make the code messier and harder to edit.

  7. #7
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCFirefly 3D Module
    Tek's Avatar
    Join Date
    Jul 2007
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is something I've run into while designing my game as well. You've actually already discovered the way that I've been using to solve it when you made your 2 test levels (level A and level B). Basically, I have a small number of dummy objects outside of the frame to the left. These dummy objects are created at runtime but are not visible, have no transparency, no fine detection, no events specifically related to them. Nothing. The only thing they do is contain a bunch of qualifiers inside of them, so that those qualifiers are always present inside of an existing object at runtime. If I delete them or uncheck create at start, things will stop working correctly in certain situations, but everything works like a charm when they exist in the frame at runtime.

  8. #8
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid 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
    655
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Not necessarily, there's two things you can try:

    1. (non F2.5+) Setting a value to 0 then running a fastloop 1 times
    The fastloop can contain events that has the overlaps which will set a value somewhere to 1.

    2. (F2.5+) Using child events and the break action
    If you have a setup like this:
    * Always
    Child: + Insert condition
    Special : Break
    Child: + Insert condition
    Special : Break
    Child: + Always
    Insert your action here

    The child "always" will only execute if all the child events above it weren't true, basically resembling the negation.
    True, not as ideal as it could be, but somewhat "cleaner" solutions to the one you posted above, depending on how much you mind fastloops or child events.
    Personally, I have always avoided negating the overlap because of this edge case (which has existed since and most likely before MMF2) and opt for "set flag to off, if is overlapping set flag to on", now, I would go for the F2.5+ solution.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/7RNXFrC
    Dungeon Raiders! - Link soon™

  9. #9
    Clicker Fusion 2.5Fusion 2.5 Mac
    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)
    zip2kx's Avatar
    Join Date
    Jun 2015
    Posts
    826
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    i had this issue too, took me a while to figure it out especially since i was using a qualifer which seemed to confuse it even more. For some events i could change them but for other more nested ones (which i deemed to be too much of a hassle to fix to be worth it) i create the needed objects in a dead zone on the level (usually a corner) and and then delete them.

  10. #10
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,855
    Mentioned
    261 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Volnaiskra View Post
    On a semi-related note, can we have a way to search for negated events?

    Because of the above issue, I'm now going through all of my x is overlapping...events, and there doesn't seem to be a way to search for them directly. In the Find All window they appear as something like:

    ....Event line #3555, Condition #4: NOT det_ceilingDropE is overlapping....

    but if you search for "NOT" with Find All, it doesn't find those negated conditions
    The "NOT" will be fixed in the next update. In the current version you can search for the '^' character, which is the internal code for NOT and is not replaced in the internal Find function (even if it's correctly displayed in the Find window).

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Crashes related to non-existent Arrays
    By Chrille in forum Fusion 2.5
    Replies: 5
    Last Post: 11th April 2015, 04:30 PM
  2. Replies: 2
    Last Post: 15th March 2015, 03:27 PM
  3. Event lines with non existent objects?
    By Outcast in forum Fusion 2.5
    Replies: 8
    Last Post: 21st March 2014, 11:57 PM
  4. Joystick 2/Joypad Objects detecting non-existent gamepad
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 17th January 2013, 02:56 PM
  5. Bug: If an object is shot, it ignores all actions
    By lsproc in forum The Games Factory 2 - Technical Support
    Replies: 7
    Last Post: 10th April 2007, 09:16 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
  •