Week 27 Update: Fixing GameStick controls and assets!

The bulk of my time in the past week has been spent on getting THE MISSION working on the GameStick. I had put off working out these issues because there was a ton of other work to focus on in any case, but now is the time to dig in and break these problems down:

Joystick controls. In my input setup, the game listens for any change in keyboard and controller input. This worked fine for keyboard keys and controller buttons, but I noticed something weird with the controller joysticks – they would register as multiple events even when I was just holding the stick in one direction. This was very weird to me, but I finally figured it out. I wasn’t holding the stick consistently in one direction: I was moving it a little bit. And since it’s analog input, it registers as a new move. So now when any input is detected, I first check whether it’s a change of state of that specific button, before dispatching a message to the rest of the game that there’s some input to pay attention to. I should have implemented for buttons as well, but there was no need, since buttons are either on or off.

Assets. Performance on the GameStick itself had been really bad, about 18 FPS in the levels themselves. After asking around on the OpenFL forums, the answer was obvious: all of my sprites are in separate files. This means that the sprites have to be loaded to the GPU far too often, which means way too many draw calls. I had forgotten that I have to pack sprites into spritesheets for decent performance on such devices! So now I’m working on setting up the game to work with spritesheets. This will likely take the rest of the week, but I’m really looking forward to seeing the improved performance on the GameStick!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s