Colludium's Forum Posts

  • Ashley - that sounds excellent .

  • Presently the Browser object will return triggers On Suspended and On Resumed when the game tab comes back into focus when switching back from a new tab or if the game was minified into the task bar. For very sensible security reasons, a blurred or out of focus game is unable to register key down and key up triggers during the time is is blurred - which means that the c2 key is down will incorrectly register a key position as down if it misses the key up trigger. If you code your events only using key down/up triggers then you also cannot detect key triggers when the game is out of focus. Using the browser On Suspended and Resumed triggers allows you to code your events to manage the possibility of missing key triggers.

    However, it is not possible for c2 developers to set events to detect if the player has returned to a running game after they have clicked on something else on their desktop - although the game loses focus and becomes blurred, the triggers will not fire when focus is regained. For example, if the game is not minified and another program is opened over the top of it then these triggers will not fire, and if the game was in a stand alone browser window and the player just clicks on something else then the triggers will not fire on returning as well.

    If you're exporting in nw then these can make your game look rather amateur when the player clicks on something else accidentally or just opens another program momentarily - and then, when they return to the fruits of your hard work, they discover (for example) that they are stuck in a run-right-to-suicide loop until they press the Right key again (the right key release trigger being missed by the game logic).

    Now, the debug "pause on unfocus" option clearly uses a more complete not in focus / blur detection system than the aforementioned browser triggers - because it will pause the game in the above 2 situations during preview. This feature request is to give us access to this same blurred / out of focus condition information.

    Anyone any thoughts / ideas / comments / work-arounds?

  • Thanks mattb - really appreciated! And thanks for the bug report and observations. I can see how re-doing the log would be frustrating - I'll move the next checkpoint up so you don't need to keep on doing it when you get to the ropes. I'm trying to make the learning progressive - I want to avoid popup instructions or diagrams, but I also want to avoid having the player find the whole experience rather dissatisfying. Hopefully with the checkpoint in a different place that would improve things.

    The rotating player must be caused by a bug in the on ground sensor and animation logic (the physics object for the player is on the ground but the player FSM is stuck in falling mode...). That could be caused by Firefox - I'm only testing in Chrome / NW because NW is my ultimate export target and I've found that the different browsers seem to perform differently, and low fps could be the problem here. Anyway, I'll take a look into it just to see if it's an issue that I can negate.. Would you be able to give the demo a try in Chrome or NW 12.x for me and see if you can duplicate the problem there (for me, Firefox gives about 57 fps but I can't replicate the problem)? If you can then knowing that would be gold because I'll have to re-do the logic (again... ).

    Cheers.

  • Thanks Ashley, all understood - is there any way to detect when the window is blurred / out of focus but still maximized on the desktop? I would be happy for this to be an option to not just be a debug feature... Rather than continue discussing in a closed bug section I'll open up a new thread to request this as a feature if it's possible.

  • Could you create a new project with it? I first saw this bug 2 years ago but it's intermittent and only happens in a large project with 3rd party plugins. If you could reproduce it and share the capx then we might be able to identify the cause. It could be a graphics driver problem....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Level 3 now contains more stuff. That's right - stuff - that I am not going to describe in too much detail. Except to say that there's a hidden chamber in there somewhere... Is that giving too much away? I have to say that I would never want to work in a factory like this one, lol. Now to bug test to the max!

  • It's almost impossible to offer advice without a capx to show what you have actually done. Aside from saying: try something different? How big is the object - width / height v pixels per tick? How far does it travel on screen? Is it a black bullet or is it a glowing plasma ball with sparks? What resolution is your game window? What's the background behind it like? And so on....

  • You need to post a capx for this bug or your bug report will be dismissed. This bug is difficult to reproduce and may well be caused by a third party plugin.

  • That was Fast!

    ...and thanks!

  • I have a feeling that this is some sort of bug - I've been doing battle with it as well. In fact, I thought I had it fixed until you posted that these triggers don't work on export!! I've submitted a bug report about these triggers not always firing here.

  • I guess I misunderstood your opening question. The capx just shows that there are ways to move and control physics objects in ways that don't cause physics glitches by using the physics properties.

  • Problem Description

    If a stand-alone browser window loses focus into the desktop background (not minimized or in an adjacent tab) then the On Suspended / On Resumed triggers do not fire in the Browser object (with pause on unfocus = false). If Project Properties pause on unfocus is set True then the feature works correctly - but only in preview and not on export.

    Attach a Capx

    link to capx

    Description of Capx

    The capx displays 2 text objects to list Browser Triggers and Keyboard KeyDown and KeyUp Triggers.

    Steps to Reproduce Bug

    • Run layout (Properties Pause On Unfocus set False) in stand-alone browser / NW window on one side of the desktop, with another application visible such that when you click on the 2nd window, the test browser window will remain visible
    • With the layout running, click on something to unfocus the test browser window, then click back on the test browser window
    • Observe that no Triggers are recorded in the Browser trigger text list when it comes back into focus
    • Then run the layout again, but with Properties Pause On Unfocus set True
    • Observe that the triggers fire correctly.

    Observed Result

    As described above. It appears that the Pause on Unfocus is able to detect all unfocus/blur conditions, but the browser triggers do not always register these. You can confirm that the browser is going out of focus by holding a key down when you click on another window and then releasing the key when it's out of focus - the key up trigger does not get recorded in this case. Additionally, if you do minimize the window, the Browser Page Is Visible boolean never becomes false.

    Expected Result

    The On Suspended / On Resumed triggers should fire when the window becomes back in focus when it is not in preview and they should fire with Pause on Unfocus set to false when running in preview. Without these triggers firing there is no way to detect if a key up trigger could have been missed by the unfocus / blur event. I apologize if I am misunderstanding the purpose of these triggers. If that is the case, could we have a On Focus and On Blur trigger to cover this?

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES - Pause on Unfocus makes no difference and the test does not pause on unfocus...)

    Operating System and Service Pack

    W8.1 x64

    Construct 2 Version ID

    r208 64 bit

  • korbaach, thanks! That question got me searching Google last night and I found the answer on github. Copy the first 2 lines of code (not the comments) from nw shell github and use Browser execute JavaScript action. And viola!

  • This doesn't work for me.... If I export my project using NW.js (with default browser in game settings) and use the Browser object to open a link in a new window, I just get a new NW window... Danwood, did you find a way to get this to work by any chance?

  • VIKINGS, you need to cheat the physics behavior / think rather laterally - to get the results you want. Here's an example of using sine behavior to set the physics velocity of an object: capx.

    Edit to add that if your physics object sleeps then any movement will not be detected by the physics engine and all chaos will ensue (and to express continued dismay that kinematic bodies are not enabled....).