Tips For Bringing Your BlackBerry Z10 Game To The BlackBerry Q10

Game Development

TITLE_IMAGE

With the upcoming release of BlackBerry Q10, there’s never been a better time to bring over your BlackBerry Z10 game and start monetizing on the new form factor. In this post, I will be talking about various porting considerations and best practices to help you get started and ensure that your game runs the best on Q10.

Let’s start off with the hardware differences:

specs

The BlackBerry Q10 uses the same chipset and GPU as BlackBerry Z10 variant B with Qualcomm Snapdragon MSM8960 and Adreno 225. The main differences that you need to consider are aspect ratio, screen size, orientation and physical keyboard.

Aspect Ratio

If you have designed your game around the 16:9 or 15:9 aspect ratio, you will need to evaluate how to layout your game content to adapt to the 1:1 aspect ratio. There are various approaches you can take to accomplish this. You might be tempted to take the easy approach of simply scaling your game screen to 1:1 aspect ratio by using letter boxing. This approach is not recommend as it could negatively impact user experience of your game.  Since The BlackBerry Q10 has a smaller screen compared to the BlackBerry Z10, you will significantly reduce the game interaction area and waste precious screen space that could otherwise be utilized for game content such as HUD or controls. For a landscape game, one approach you could take to solve this is to use a comprise aspect ratio such as 16:11.  For the BlackBerry Z10, display more content on the sides and for the BlackBerry Q10 display more content at the top and bottom.

Similarly for a portrait game (9:15 or 9:16), you can display more content at top and bottom on the BlackBerry Z10 and more content at the sides on the BlackBerry Q10. In the below example, Bejeweled 2 displays the time progress bar at the bottom on the BlackBerry Z10 and on the side on the BlackBerry Q10.

compare

If you are using any aspect ratio specific static assets such as backgrounds, images and splash screen, they will need to be scaled accordingly. For the standard splash screen, the BlackBerry Native SDK allows you to manage multiple device specific splash screens in the same bar-descriptor. For the BlackBerry Q10 you can add a 720×720 splash screen by editing the bar-descriptor using the IDE or a text editor. Here’s an example:

<splashScreens>
        <image>splash_1280_768.png</image>
        <image>splash_720_720.png</image>
</splashScreens>
      <asset path="assets">assets</asset>
      <asset path="icon.png">icon.png</asset>
      <asset path="/Users/pratiksapra/assets/splash_1280_768.png">splash_1280_768.png</asset>
      <asset path="/Users/pratiksapra/assets/splash_720_720.png">splash_720_720.png</asset>

Once you do this, correct splash screen will be automatically chosen depending on the device your game is launched on.

Next, if your game uses overlay controls such as virtual joysticks, UI elements and menus, you will need to reposition them as needed. The best approach is to lay them out relative to screen width and height thus making them aspect ratio independent. Below is an example of a flexible UI layout used in Bard’s Tale that works on both aspect ratios.

bards

Screen Size

The BlackBerry Q10 features a 3.1” screen surrounded by a gesture sensitive bezel. If your game uses on-screen controls, it’s important to place them away from the bottom edge of the screen to prevent accidental swipes. An accidental swipe-up gesture during game play will thumbnail your game and cause unnecessary interruption for the user.

Optimizing your game controls is also really important. For example, If your game uses dual virtual joystick control scheme, I would recommend reducing this to just one on-screen joystick.  Due to smaller screen size, the user might end up covering most of the screen when controlling both joysticks using two fingers. We will talk about a solution to this in the later part of this post.

Orientation

The BlackBerry Z10 supports portrait as the default orientation. If you are setting the orientation in the bar-descriptor for your game, you might be wondering whether this would work on the BlackBerry Q10 without the overhead of creating a separate binary with a different bar-descriptor. To make your life easy, we have made sure that both portrait and landscape orientation settings map to portrait orientation on the BlackBerry Q10. The below example shows how your game would be oriented on the BlackBerry Z10 and the BlackBerry Q10 based on the bar-descriptor orientation setting.

orientation

Input

The BlackBerry Q10 features a physical keyboard so your game needs to be aware of this. If your game contains any buttons to activate the virtual keyboard, you should make sure they are removed or disabled when the game is running on the BlackBerry Q10. Unlike the virtual keyboard, the physical keyboard is always there and can be utilized as an input mechanism.    You can combine keyboard input with touch screen to offer an intuitive and robust input scheme for your game. For example if you want to optimize the dual virtual joystick input mechanism for the BlackBerry Q10, you can substitute one of the joysticks with keyboard input. Or if your game only requires gamepad style input you can use the keyboard as a gamepad.

Q10Keyboard

Integrating keyboard input in your game is super easy. To accomplish this, in your main event loop simply handle the SCREEN_EVENT_KEYBOARD event and check for the keydown value. Here’s a code snippet on how to do this:

if (screen_get_domain() == domain) {

        screen_event_t screen_event = screen_event_get_event(event);

        int screen_val;
        screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val);
        switch (screen_val) {
        case SCREEN_EVENT_MTOUCH_TOUCH:
                    //handle touch events

        case SCREEN_EVENT_KEYBOARD:
            screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_FLAGS, &screen_val);

            if (screen_val & KEY_DOWN) {
                screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SYM,&screen_val);

                fprintf(stderr, "The '%c' key was pressed\n", (char)screen_val);

                switch (screen_val) {

                case KEYCODE_W:
                    // DPAD Up
                    break;

                case KEYCODE_A:
                    // DPAD Left
                    break;

                case KEYCODE_S:
                case KEYCODE_Z:
                    // DPAD Down
                    break;

                case KEYCODE_D:
                    // DPAD Right 
                    break;

                case KEYCODE_L:
                    // Button A
                    break;

                case KEYCODE_BACKSPACE:
                    // Button B
                    break;

                case KEYCODE_O: 
                    // Button X
                    break;

                case KEYCODE_P:
                    // Button Y
                    break;

                default:
                    break;
                }
            }
            break;
        }

Tools & Deployment

To get started, you will need the latest BlackBerry Native SDK 10.1, which includes BlackBerry Q10 support. If you are running an older version please upgrade by visiting http://developer.blackberry.com/native.

To deploy your game on BlackBerry World, follow the regular process for creating a new release in the Vendor Portal. In the supported devices screen, make sure you select BlackBerry Q10.

Known Issues

There are two known issues with earlier versions of 10.1 device software that you need to be aware of.

  • Audio – In-game audio playback results in complete loss of device audio and a reboot is required to restore audio.
  • Orientation – If the orientation is set to landscape in the bar-descriptor, the app splash screen and system dialogs such as volume are incorrectly oriented.

Both of these issues have been fixed in the latest 10.1 device software posted at the below link so if you are running an older build please upgrade.

https://developer.blackberry.com/blackberry10devalpha/devalpha_update.html

I hope you found the information included in this post useful.  If you have any questions or feedback please leave a comment below or reach out to me directly on Twitter @pratiksapra.

About Pratik Sapra

As an Application Development Consultant on the Developer Relations team I work with developers across the globe to bring their games and apps to the BlackBerry platform. My expertise includes native C++ development and gaming.

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus