Multiple key presses at once don't seem to work

LokitoesLokitoes Member, PRO Posts: 171

Hi all,

Quick question: I have a game where key presses reveal animated actors, then when the key stops being pressed, the animated actor fades away again. There are 8 different animations connected each to their own key press. So key A brings up actor 1, key B brings up actor 2, etc. They're all separate actors, because they need to be able to work individually (eg. key A is pressed so actor 1 shows) and/or together (eg. keys A, B, C, D, E are pressed so actor 1, 2, 3, 4, 5 are all on screen, etc). It will run as an .app on a Mac Mini, and each 'key press' will be connected to a big button for kids to stand on.

For ease, and so that the user can't press the same key over and over again and generate multiple of the same actor on screen (because kids will totally do that and it will break the game), I've got all the animations happening all the time, and all the key press actually does is interpolate the alpha of the actor from 0 to 1 when key press is down, then back to 0 when the key is up. Each animated actor is made up of multiple animated parts so unfortunately there is a lot going on on the screen at any one time. The assets are also very big so I am already aware that this is a strain for a Mac Mini.

Technically this means that if all 8 keys are held down at once, all 8 actors should go from alpha 0 to alpha 1. When I only had 3 animated actors made, all three worked fine, both when key pressed separately and when keys pressed at the same time as each other. Now I have 5 made, I notice that when I try to press all 5 together, only 2 or sometimes 3 ever show up on the screen (depending on which one is pressed first) - after 2-3, the next keys that I press do not appear. All of them definitely work separately, just not together when multiple keys are held down at once.

I recognise that you can make rules for multiple key presses together (eg press A and B and C to get blah blah), but that's not what I'm trying to do - I just want each key press to do it's own thing that it is meant to do when pressed together.

Could it be:

a) there is too much going on on the screen at once for GS to be able to handle it.

b) there is a max number of key presses that can work at once in GS games that I'm not aware of.

c) interpolating the alpha was just a really dumb way to do this and there needs to be a better way.

d) something else?


Cheers!

Comments

  • LokitoesLokitoes Member, PRO Posts: 171

    Also a small other point: when I press all keys at EXACTLY the same time, none of them work. Which sucks but I don't really know what to do about that...

  • UltraLionBluUltraLionBlu Member, PRO Posts: 157

    I did some tests, it seems that the maximum number of keys that can be pressed together is 4.

    I have no idea why there is this limit, probably if there wasn't a limit and you could do an action for each key on the keyboard it would be too much, but I think a number of presses equal to those of a classic joypad (8) would be more quite right

    I don't know if there is already a way to do it.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 2,187

    I'll need to look at the code, but I'm pretty sure we just used the system keyboard events for this sort of thing, so I'm hoping we can blame them :) If not, we'll let you know.

  • LokitoesLokitoes Member, PRO Posts: 171

    Thanks adent42. What do you mean by 'system keyboard events'? Is it to do with the computer I am on? Are there any steps I can take to fix it? Should I send through an example? :)

Sign In or Register to comment.