"every x sec" stop firing after load game

0 favourites
  • 7 posts
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • Problem Description

    There are 2 issues here:

    1. Major concern: after loading the game, "Every x sec" event may stop firing after a long random interval before it fire normally again . ( I have tested this throughly and have provided explanation below )

    2. Tracking values for "every x sec" are not reset in layout restart and layout switching.

    Attach a Capx

    https://www.mediafire.com/?kegmpd3hy85ns4j

    For the 1st issue:

    I am facing a bug in the game I am making: every x sec stops firing. In my game, the issue arises when the game re-loaded the saved checkpoint. (the player returned to checkpoint layout) After I proceed to some other layouts, I see that some "every x sec" stop firing entirely.

    Steps to Reproduce Bug

    To replicate this issue with capx above, please proceed with "debug layout". Please take a look at system time, wall clock time, etc. for this, while following the steps below:

    • 1. Starting in 1st layout. At 5th second of system time, hit "S" to save, and you should see "save complete" text as a confirmation.
    • 2. Now hit "2" to go to the 2nd layout. The 2nd layout has a blue square that will shoot some objects every 0.2 second. Wait until system time is 15th second, hit "L" to load. Your save should now be loaded and you should be back at the 1st layout and see "load complete" text. All the times should now be back when they were saved.
    • 3. Now, hit "2" to go to the 2nd layout. You will see the blue square does not fire every 0.2 sec at all. However, if you wait until the time you load (15th second in this case), the blue square will start firing again.

    I suspect that the value of time used for checking in "every x sec" still uses the old value before loading. However, what is strange is that the red square still fires its object as usual. So I dived in further to assist you in this case:

    There are 3 layouts: Layout 1, 2, and 3.

    There are 4 event sheets:

    • Ev_BoxCtrl is the one with code for spawning the blue balls from the red square.
    • Ev_KeyboardMouse contains all the keyboard codes and save/load.
    • Ev_main simply "includes" Ev_BoxCtrl and Ev_KeyboardMouse above.
    • Ev_Layout2 includes "Ev_main" and contains the code spawning blue balls from blue box every 0.2 sec.

    Layout 1 and 3 uses Ev_main event sheet, while Layout 2 uses Ev_Layout2 event sheet.

    Furthermore, I see that this issue will not occur if I move the code for spawning blue balls from blue box every 0.2 sec to Ev_main event sheet. In the game we are making however, we once see "every x sec" in the "included" event sheets have this issue as well after loading the game.

    This issue is our primary concern right now, and we would like it to be fixed. Could you please investigate?

    For the 2nd issue:

    Observed Result

    The first time you load the layout, the blue ball will be spawned from the red box after 1st sec. Then again in the next second and so on. Now, hit "R" to reset the layout rapidly. You will see that even though the layout got reset, "every 1 sec" will fire in a way like without having the value reset. For example, if you reset the layout at 0.75 seconds after the layout start, "every 1 sec" will fire at 0.25 seconds after the restart.

    Expected Result

    For small values in every x sec, this could be negligible, however, suppose we have something that fires every 60 sec, imagine if you reset the layout, and this time you reset, it fires before the first 60th second of this layout being played.

    I've also tested this by changing layout around. In capx, hit 1, 2, 3 to change to the layout 1, 2, 3 around, you will see that this issue also applies to layout switching.

    Operating System and Service Pack

    Win 7 64 bits

    Platforms

    We have only tried with NodeWebkit and Chrome Version 34.0.1847.116 m.

    Construct 2 Version ID

    R163 64 bits (this issue also occured with R152)

  • The second issue is the way Every X seconds work, it does not reset between layout (it is every X seconds taking the start of the game for reference).

    I'll admit you are not the only one to think it should restart between layouts

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The second issue is the way Every X seconds work, it does not reset between layout (it is every X seconds taking the start of the game for reference).

    I'll admit you are not the only one to think it should restart between layouts

    I agree, I think it should be reset between layouts. I also would like to see a global timer that starts at zero when the layout starts, and counts up. I also want it to be possible to set this timer (and have it count up from the position you set it to). The difference between this and the timer behavior is that it should keep rising even after the event for it goes off. so like you could do an event when it reaches two seconds, and then another event when it reaches 5 seconds, etc. People may be tired of hearing me mention MMF, but MMF has this feature.

  • > The second issue is the way Every X seconds work, it does not reset between layout (it is every X seconds taking the start of the game for reference).

    >

    > I'll admit you are not the only one to think it should restart between layouts

    >

    I agree, I think it should be reset between layouts. I also would like to see a global timer that starts at zero when the layout starts, and counts up. I also want it to be possible to set this timer (and have it count up from the position you set it to). The difference between this and the timer behavior is that it should keep rising even after the event for it goes off. so like you could do an event when it reaches two seconds, and then another event when it reaches 5 seconds, etc. People may be tired of hearing me mention MMF, but MMF has this feature.

    There might be already a plugin in plugin section that does that. If not, just create a variable, to which you will add 1 every second, and then in game refer to it. Literally one variable and one event.

    As for Every X not resetting - it should, I agree. Makes no sense otherwise. Here's a quick fix, which I haven't tried ( cause I'm working on single layout ) but it might work: add condition to those events, something like varTime = True, and on end of layout set it to False, and to True at beginning of the next one. Alternatively use TImer behavior.

  • >

    > > The second issue is the way Every X seconds work, it does not reset between layout (it is every X seconds taking the start of the game for reference).

    > >

    > > I'll admit you are not the only one to think it should restart between layouts

    > >

    >

    > I agree, I think it should be reset between layouts. I also would like to see a global timer that starts at zero when the layout starts, and counts up. I also want it to be possible to set this timer (and have it count up from the position you set it to). The difference between this and the timer behavior is that it should keep rising even after the event for it goes off. so like you could do an event when it reaches two seconds, and then another event when it reaches 5 seconds, etc. People may be tired of hearing me mention MMF, but MMF has this feature.

    >

    There might be already a plugin in plugin section that does that. If not, just create a variable, to which you will add 1 every second, and then in game refer to it. Literally one variable and one event.

    As for Every X not resetting - it should, I agree. Makes no sense otherwise. Here's a quick fix, which I haven't tried ( cause I'm working on single layout ) but it might work: add condition to those events, something like varTime = True, and on end of layout set it to False, and to True at beginning of the next one. Alternatively use TImer behavior.

    The more I think about it, its kinda starting to seem to me like MMF's features are useless and redundant. Still a little helpful shortcut, but its not much though.

  • > The more I think about it, its kinda starting to seem to me like MMF's features are useless and redundant. Still a little helpful shortcut, but its not much though.

    >

    I don't know. I can't even remember the workflow of GF and MMF.

  • Thanks, issue 1 should be fixed in the next build. Issue 2 is by design.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)