Stweve's Recent Forum Activity

  • If I have a two dimensional array like this:

    0,1

    0,2

    0,3

    0,4

    0,5

    0,6

    0,7

    0,8

    0,9

    0,10

    and then I sort x, I get this:

    That's unfortunate, as I would like Y1 to still be ordered. I know the sort is just looking at Y0, but If the sort encounters 10 or so of the same value in Y0, then the Y1 sorting will be weird like above (it seems to swap X0 with the X row in the middle of whatever array I use).

    If I use this method of sorting multiple columns (to sort by Y0 then Y1), I get the same result. The methods I can find for sorting by multiple columns don't seem to work if there are too many matching values in Y.

    The array I'm working with is actually about 200x14 size (using the CSV to Array plugin) but I can reproduce the dillema using the above, simpler example. In my array I'm using Y0 as an active flag/bit. I need to reverse sort by the active flag and then secondarily sort by another Y column (which denotes a category). Should I bypass the standard sort method in favor of another logic? I think I'm about to abandon the idea of sorting by active flag and just have the program traverse the active row scattered throughout the array.. and sort only one column using a swap method. It's just so much easier to debug when its sorted. Thanks for any ideas! -Steve

  • There are no "overlapping" events. But, you led me to the solution!

    **It's the "mouse is over" conditions causing those 30k checks.

    So, even with collisions disabled on all applicable objects, those mouse conditions alone give me 30k checks/sec. If I disable my "Hover" group, which contains all these "mouse is over" events, I get 0 checks.

    Thanks fellas. Also, I'll assume now that there is no global disable, but I was barking up the wrong tree there anyhow.

  • I'm getting about 30k/sec collision checks and do not require these checks as the app is more trivia/educational.

    I went through piecemeal and disabled collisions on every applicable object and still see the same amount of checks on debug. Can these be stopped? Thanks, -Steve

  • I've found more about the problem and have a workaround, but this is still strange behavior.

    More about the problem

    What's really happening on Mac is that when the CMD modifier is used on Mac, it is causing the modified key to become stuck "down". For example, If I press CMD+T, it will register but then the T key will be stuck in a down status. the T key wont regsitry again until I release the command key and press T alone to clear the stuck "down". Then, "T" or "CMD +T" will register again (but will again cause T to become "stuck").

    Workaround

    My program has an onscreen keyboard in nwjs that tests the user on keyboard shortcuts. As soon as a non-modifier key has been pressed, I use Rex's rex_simulate_keyevent plugin to fire an "up" for that key after the code has parsed it. That seems to clear the apparent issue. Thanks for saving the day, rexrainbow !

  • Please also read the follow up post. I have a workaround but it still seems there is a potential bug.

    Problem Description

    Keyboard entry using the CMD key modifier on Mac will cause the keyboard to become stuck after 2 or 3 keypresses.

    Attach a Capx

    The capx is rudimentary: here.

    It's basically this:

    Description of Capx

    Displays keycodes pressed as reported by Construct 2 (Keyboard.LastKeyCode) in one text object and the Java (browser.execjs("event.code")) in another text box. Both methods of displaying the keycode are affected by this issue.

    Steps to Reproduce Bug

    • Go to this C2 Example on a Mac in Safari or Chrome.
    • Press CMD + " then CMD+ \ without letting go of the command key. After doing this once or twice, you will then have to release all keys and press a random key once or twice to get a response again.

    Observed Result

    Keyboard input will become "stuck" after typing a couple of combos. "Stuck" meaning it will require the user to release all keys and type 1 or 2 random keystrokes until there is keyboard response again.

    This Mac-specific issue does not occur when doing the same test with the Shift, Alt/Option or Control keys.

    Expected Result

    The CMD modifier shouldn't cause keyboard input to "stick". It should behave as the other modifier keys do. I was thinking that this may be occurring at the OS level, but if you go to keycode.info, you can type CMD + " and CMD + \ back and forth all day and it won't "get stuck". This little app listens with .onkeydown.

    Why am I so worried about this? The overall purpose is for an app (currently in beta) that tests user knowledge of keyboard shortcuts for a popular audio program.

    Web demo is here, it's currently in beta in the Apple and Google Play stores. I need to have an nw.js version that accepts keyboard input, though, wherein this issue makes the app rather unusable.

    Affected Browsers

    This happens on Mac in Safari, Chrome or nw.js. I have not found a browser/version where this does not occur on Mac. I only care about Chromium/nw.js

    Operating System and Service Pack

    MacOS High Sierra.

    Construct 2 Version ID

    It happens in either C2 (R250) or C3 (the free version).

    Thanks!

    -Steve

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Updated Web Preview:

    http://www.xensori.com/builds/PT_RC2

    In the off-off chance that someone here is interested in an iOS or Android version, I have them in beta on those stores while its being approved to publish, so you can PM me your email and I'll send a beta invite.

  • Love the loading screen. Enjoyed the visual style and layout. Would love to see some of the non-sprite fonts replaced with sprite fonts. This is the first C2 chat implementation I've seen, which is inspiring.

  • Thank you. Yes, that's one good thing about the MacOs Platform. Things seem ok there except for the issue mentioned.

    iOS hardware keyboards are bust, though.

  • http://www.xensori.com/builds/PT_RC1d

    This C2 program tests users' knowledge of keyboard shortcuts on the Pro Tools audio application. It may be greek to those that don't use Pro Tools but you can still mess about with it. Its running well Android and iOS.. testing an RC now. It's targeted for mobile devices first. Keyboard input is functional in the code but I need to resolve the issue in this post first to release it as an nwjs app with keyboard input. Are there any other things like this out there in any of the stores? I love weird indie games and though this isn't one, it still interesting to see what C2 can accommodate.

    Play with it here: http://www.xensori.com/builds/PT_RC1d (or click a thumbnail)

    Thanks for reading! -Steve

  • If typing CMD-key combinations on a Mac, the keyboard input will become "stuck" after typing a couple of combos. "Stuck" meaning it will require the user to release all keys and type 1 or 2 random keystrokes until there is keyboard response again.

    The issue happens in Mac on Chrome or Safari or nw.js. The Shift, Option/Alt or Control keys do not experience this.. just the CMD key. This doesn't happen when doing the some test with the Shift, Alt/Option or Control keys. And, it happens in multiple browsers. The real kicker is that a page like keycode.info, which uses JS for keyboard monitoring, does NOT experience the issue.. So, what possibly points the finger at C2 but I can't be sure yet. It happens in either C2 or C3, or also Chromium/nw.js.

    The issue is not a conflict with pre-existing shortcuts. The ultimate goal is to have an app that tests keyboard shortcut knowledge in nw.js only (so as not to compete with browser shortcuts), but the issue just doesn't require nw.js to reproduce.. just a Mac (i've tried multiple MacOs versions) and any browser.

    To recreate:

      Go to this C2 Example on a Mac in Safari or Chrome, keep pressing press CMD + ] then CMD+ [/b] without letting go of the command key. After doing this once or twice, you will then have to release all keys and press a random key once or twice to get a response again. If you go to keycode.info, you can type CMD + ] and CMD + [/b] back and forth all day and it won't "get stuck".. remember this is just the CMD key that does this.

    What do you reckon? Possibly something with the keyboard object? I tried looking at the keyboard on every tick instead of using the "on any key pressed" and there still appears to be an issue. The capx is rudimentary but available here.

    Thanks for any ideas. I'm just looking at other possible factors before filing a bug. -Steve

  • Thanks for the reply, Ashley! Yes, after a lot of self investigation I'd found that event.keyCode was also incorrect and the issue is reproducible without Construct.

    Since event.code does not exhibit this issue on Chrome or Chromium on MacOs, I agree that adding event.code into the keyboard object in Construct might be useful. That way there is an option to get a string from the keypress directly without relying on the keycode. StringFromKeyCode would provide the string for the incorrect key in this case, due to the overall issue (which is a essentially an event.keyCode Chrome/Chromium bug on MacOS).

  • Here's an update in case someone happens across this thread on a search.

    This is what is observed (on Mac nw.js) alltogether:

      C2's Keyboard.LastKeyCode is incorrect for numpad keys browser.execjs("event.code") is correct for numpad keys browser.execjs("event.keyCode") is incorrect for numpad keys.

    Example: LastKey2.zip

    Therefore, it seems that a workaround to properly detect numkeys on Mac nw.js is to leverage event.code from JavaScript and manually derive a keycode from that.

    Lastly, I can also reproduce this on Mac outside of nw.js using the latest version of Chrome (62.0.3202.75)

Stweve's avatar

Stweve

Member since 14 Feb, 2014

None one is following Stweve yet!

Connect with Stweve