3 Mobile Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 24 October 2013

How to add Xperia™ device support for the DUALSHOCK™3 wireless controller in your Android™ game

Posted on 01:08 by Unknown



A wide range of Xperia™ devices support the DUALSHOCK 3 wireless controller, bringing a console-like experience to PlayStation® Mobile games. You can also deliver the same functionality to Android™ games.  Read on to learn how to optimise your games for the DUALSHOCK™3 wireless controller for Android games – you’ll also find guidelines and recommendations, along with the key code mappings for the supported devices.

Develop & optimise your game for the DUALSHOCK™3 wireless controller for Android games
The DUALSHOCK 3 wireless controller provides an intuitive game play experience with gaming buttons and controls. Inputs include:
  • Left and right joysticks.
  • Directional buttons.
  • Digital buttons: triangle, circle, cross, square, L1, R1, L2, R2, Start, Select.
By adding support for the DUALSHOCK™3 wireless controller in your Android game, you’re adding a number of benefits for the end user:
  • An input experience that is more familiar to gamers.
  • Freeing up viewing space by removing onscreen controls.
  • Allowing the games to be controlled wirelessly and be displayed and played on larger screens.
If you’ve already designed your game with generic controller support, such as for a virtual game pad, it’ll be easy to add support for the DUALSHOCK™ 3 wireless controller. You just need to:
  1. Design and convert your existing game interactions to map to the DUALSHOCK™3 wireless controller, keeping in mind the tips mentioned below, and using DUALSHOCK™3 wireless controller keycode mapping table as a reference.
  2. Implement your controller design (see keycode mapping table below) and fine-tune the controls to make sure that it “feels right”, to give users the best controller experience possible.
DUALSHOCK™3 wireless controller (top view).
DUALSHOCK™3 wireless controller (top view).

Tips when adding DUALSHOCK™ 3 wireless controller support
When incorporating DUALSHOCK™3 wireless controller support into your development, you need to follow and keep the following tips in mind:

Tips to keep in mindNotes
A game should be fully playable using only touch screen controls.Most devices only have a touch screen as an input controller.
Hardware buttons should be used consistently throughout a game.Users should be allowed to configure the control settings.
In any menu, except for the main menu, the CIRCLE button should take the user back to the previous menu. In the main menu, the CIRCLE button should prompt the user with the option to exit out of the game.In North America and Europe, the CIRCLE button is used as cancel. In Asia, the CIRCLE button is used as confirm.  
In any menu, the X button should be used as the confirmation button.In North America and Europe, the X button is used as confirm. In Asia, the X button is used as cancel.
On screen buttons should not appear when the user is using the DUALSHOCK™3 wireless controller.There should be an option in the options menu to turn the on screen controls off or on.

Implementing the DUALSHOCK™3 wireless controller buttons and joysticks
The DUALSHOCK™3 wireless controller support can be implemented using standard Android APIs. You’ll also need to know the key code mappings when you’re adding support for the DUALSHOCK™ 3 wireless controller in your game. Any key press on the device is described by a sequence of key events. Each key event is generally accompanied by the keycode getKeyCode() and getScanCode().

Use the table below for the keycode and scancode mappings for Xperia™ devices.
Key code mappings for all Xperia™ devices that support the DUALSHOCK™3 wireless controller.

ButtonKeycodeScancode
UpKEYCODE_DPAD_UP0×124
DownKEYCODE_DPAD_DOWN0×126
LeftKEYCODE_DPAD_LEFT0×127
RightKEYCODE_DPAD_RIGHT0×125
Circle: ○ buttonKEYCODE_DPAD_BUTTON_Y0x12d
Cross: × buttonKEYCODE_DPAD_BUTTON_X0x12e
Triangle: △ buttonKEYCODE_DPAD_BUTTON_B0x12c
Square: □ buttonKEYCODE_DPAD_BUTTON_A0x12f
L1KEYCODE_DPAD_L10x12a
R1KEYCODE_DPAD_R10x12b
L2KEYCODE_DPAD_L20×0128
R2KEYCODE_DPAD_R20×0129
L3KEYCODE_DPAD_THUMBL0×0121
R3KEYCODE_DPAD_THUMBR0×0122
SELECTKEYCODE_DPAD_BUTTON_SELECT0×0120
STARTKEYCODE_DPAD_BUTTON_START0×0123
PSKEYCODE_DPAD_BUTTON_10x2d0

The following code snippet shows how buttons are detected from a DUALSHOCK™3 wireless controller.
public boolean onKeyDown(int keyCode, KeyEvent event)
{
switch(keyCode)
      {
       case KeyEvent.KEYCODE_DPAD_BUTTON_X:
                   // CROSS button pressed
         break;
                case KeyEvent.KEYCODE_DPAD_BUTTON_Y:
                   // CIRCLE button pressed
         break;       
            ...           
      }
      return super.onKeyDown(keyCode, event);
}

The left and right analog sticks on the DUALSHOCK™3 wireless controller returns keycodes (UP, DOWN, LEFT, RIGHT for each direction) and can be used as joysticks. Each joystick has two axes (one for vertical and one for horizontal) and the range value can be obtained by calling the getMotionRange(int).  Please keep in mind joystick implementation usually takes more effort and iterations to make the control “feel right”.
For more information and references on the Android gamepad APIs, refer to the InputDevice and MotionRange topics on the Android Developer website.  You can also check out this Android and game controller video from the Android Developers for more tips on how to make your game controller compatible on Android.

How to setup the DUALSHOCK™ 3 wireless controller on your device
Currently, a number of Sony devices offer a setting that will allow you to connect a DUALSHOCK™3 wireless controller via Bluetooth™ to play games wirelessly, and the initial setup of the DUALSHOCK™3 wireless controller is quite easy.
The following Sony smartphones and tablets support the DUALSHOCK®3 wireless controller:
  • Sony Tablet S
  • Sony Xperia SP (C5302/C5303/C5306)
  • Sony Xperia Z* (C6602/C6603)
  • Sony Xperia Z1 (C6902/L39h/C6903/C6906/C6943)
  • Sony Xperia Z Ultra (C6806/C6833)
  • Sony Xperia ZL* (C6502/C6503)
  • Sony Xperia Tablet S
  • Sony Xperia Tablet Z (SO-03E/SGP311/SGP312/SGP321/SGP331)

*DUALSHOCK®3 wireless controller can be used when the software is updated to Android 4.2.
DUALSHOCK setup
DUALSHOCK™3 wireless controller setup menu on an Xperia™ tablet.

In the settings menu of the supported devices, there is an option for “DUALSHOCK™3 wireless controller”. In addition to the DUALSHOCK™3 wireless controller and USB cable, the only other extra item you’ll need to setup your DUALSHOCK™3 wireless controller is a USB on the go adapter. Once the DUALSHOCK™3 wireless controller is connected, it can be used to navigate through menus to select, start and play games.

PlayStation is a registered trademark of Sony Computer Entertainment Inc. SIXAXIS is a trademark of Sony Computer Entertainment Inc.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in How to | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • KITKAT 4.4 AOSP for Cherry Mobile Flare S100
    KITKAT 4.4 has arrived for the Cherry Mobile Flare S100 (Only for Jelly Bean 4.1.2) Features: Modded SystemUI with Quick Panel Lidroid toggl...
  • CM Flare S100 Stock Recoveries + Tutorial in Flashing using AIO Flasher
    Stock recovery for CM Flare S100 is used in wiping data/factory reset, wiping cache partition, and for backing up and restoring our ROM. Yo...
  • Neos all-in-one Android PC looks modern, acts old
    The Neos all-in-one ships with Android 4.1.1 and comes pre-loaded with various apps. (Credit: Xiomara Blanco)   The Astak Neos all-in-one...
  • Clever adapter connects USB accessories to your Android device
    With an inexpensive USB OTG adapter, you can connect things like keyboards, USB hard drives, and even gaming controllers to your Android p...
  • Why next-gen consoles won't run games at 4K
    Just because some say they can, doesn't mean they should. Based on the latest graphics hardware no one should expect great 4K gaming i...
  • Experience the Galaxy Note 3 on nearly any Android device
    Samsung offers a free app to show you what it's like to use the Note 3.                              (Credit: Jason Cipriani)    Do yo...
  • Google Chromecast review: A daringly priced streamer that doesn't do much
    The good: The Google Chromecast is a dirt-cheap wireless video dongle that streams Netflix and YouTube to your TV using Android ...
  • Rooting Cherry Mobile Flare S100 via Recovery (ICS and JB)
    1. Download below. a. Root for ICS b. Root for Jelly Bean   2. Copy the zip file inside your SD Card. 3. Reboot your phone in Recovery Mode...
  • New processors and faster Wi-Fi for Apple's slim desktop
    The good: With the addition of Intel's Haswell chips, plus 802.11ac wireless, faster SSD hard drives, and new Nvidia GPUs, the ...
  • PS4 launch date confirmed for November 15
    Today Sony announced the official launch date of the new PlayStation 4 game console as November 15 in North America and November 29 in Europ...

Categories

  • aio flasher
  • Android
  • android kitkat
  • android kitkat 4.4
  • Apple Byte
  • Battle
  • changing flashboot
  • cherry mobile
  • cherry mobile 2.0
  • cherry mobile flare
  • cherry mobile flare kitkat
  • cherry mobile jelly bean
  • clockworkmod
  • clockworkmod recovery
  • cm flare ics to jelly bean
  • cm flare jelly bean
  • cm flare kitkat
  • cm flare s100
  • cm flare stock recovery
  • cwm
  • distorting graphics
  • Don't Miss
  • enable init.d support
  • factory reset cm flare
  • fix playstore no connection
  • flashboot mode
  • ghosting
  • How to
  • ice cream sandwich to jelly bean
  • ics to jelly bean
  • init.d
  • jellybean upgrade
  • kitkat aosp
  • playstore
  • playstore no connection
  • Recapitulation
  • recovery image
  • root via recovery
  • rooting android
  • rooting cherry mobile
  • sd card
  • sd card partition
  • sd card partitioning
  • splash image maker
  • stock recovery
  • too many pattern attempts
  • universal init.d

Blog Archive

  • ▼  2013 (229)
    • ►  November (42)
    • ▼  October (54)
      • Apple's Mavericks already on 5.5 percent of Macs, ...
      • Nokia Lumia 2520 vs. Microsoft Surface 2: Do we ne...
      • Apple's new iPad pricing: A head scratcher or bril...
      • New iPad Air: Lighter, thinner 9.7-inch tablet wei...
      • Android 4.4 KitKat: What we expect about the annou...
      • When, where, and how to buy Apple's new iPads
      • Create a file manager desktop background image in ...
      • Free, familiar, and feature-filled
      • Get hired with these five Windows Phone apps
      • How to add Xperia™ device support for the DUALSHOC...
      • GTA V PC torrent scam hits thousands
      • PlayStation 4 mobile app to launch for PS Vita owners
      • Nvidia's Gamestream initiative to bring PC titles ...
      • Slim Nokia Lumia 1520 has 6-inch HD screen, 20MP c...
      • Nokia announces 6-inch Lumia 'phablets' and Window...
      • The Nokia Lumia 2520 is bright, light, and feels g...
      • AT&T rolls out Android 4.3 for HTC One
      • Google's Schmidt: Android 'more secure than the iP...
      • The Lenovo A10 is an Android laptop-tablet hybrid ...
      • Unique photo tools, if you can find them
      • How to easily root an Android device
      • High-resolution, small-footprint premium laptop
      • Smartphones with long battery life (roundup)
      • Assassin’s Creed 4: 80 hrs long, new mechanics & h...
      • iPhone 5S, 5C to land in dozens more countries on ...
      • Dell takes on the world with Android and Windows t...
      • Jelly Bean sprouts up on almost half of all Androi...
      • Portable gaming laptop deathmatch
      • HP Chromebook 11: A prettier $279 Chromebook
      • Powerful new Note wields mightier pen skills
      • iPad 5 rumor roundup
      • Dell's new XPS 13 packs power, the 15 gets an incr...
      • How to get more battery life from your Nokia Lumia
      • A better Beats
      • A fitness tracker tour de force
      • Don't buy these phones (roundup)
      • HTC's One Max to be unveiled next week -- report
      • Six Sweet Things You Can Do With NFC
      • Mozilla fills feature gaps with Firefox OS 1.1 rel...
      • GTA V smashes several Guinness World Records
      • Rock-a-bye Samsung Galaxy Round has something to p...
      • Budget AMD-powered plastic letdown
      • Samsung's smartwatch is style over substance
      • New processors and faster Wi-Fi for Apple's slim d...
      • Google posts six tips and tricks for Google Maps o...
      • 2013 Paperwhite is subtly better, faster
      • Windows Phone gains ground in Europe
      • Four features you didn't know existed in iOS 7
      • Looking For A Way To Test Your App Or Game For Vul...
      • Take, edit screenshots on Galaxy Note devices with...
      • Neatly For Twitter Is Now Free On The Google Play ...
      • BitTorrent experiments with secure chat
      • Take control of your iPhone's Camera Roll with Pho...
      • Nexus 5 log tips wireless charging, Miracast, themes
    • ►  September (42)
    • ►  August (27)
    • ►  July (26)
    • ►  June (14)
    • ►  May (24)
Powered by Blogger.

About Me

Unknown
View my complete profile