Game On! – Android and Game Controllers
Articles Blog

Game On! – Android and Game Controllers

September 17, 2019

welcome to episode five of Game On. I am your host, Todd
Kerpelman. And with me today– KRISTAN UCCELLO: Krispy,
developer relations. TODD KERPELMAN: It’s
Krispy Uccello. And we are here to talk to you
today about game controllers. But firstly, with some news
and updates from the google-play-game-services
side of things. First off, we have an official
Stack Overflow tag. So yea! If you’ve got questions about
achievements, leader board, cloud save, multi-player, any
of that, you can go to Stack Overflow and find us under the google-play-games-services tag. Hopefully by the time this video
comes up this tag will be available. They’re working on it. And you can start asking
us questions there. We’ve got guys much smarter
than me that are monitoring that tag. And they answer a lot
of your questions. So go there if you’ve got a
question about support on a specific platform. You pair it with an Android
or iOS tag. And we’ll try and answer
your questions. Also, there is a great new
feature on the play games developer console. It’s the greatest feature that
you’ve probably overlooked because it’s this tiny little
link at the bottom. But it’s the new “Get
Resources” feature. So you’ve got to
check this out. This is from our sample game,
the Typer-Number-Challenge. You’ll notice I’ve got six
achievements here. And I’ve got a couple
leader boards. And in the past I had to
copy and paste all of those random strings. And half the time when I clicked
on something to try and copy the string it would
take me into the details page and it was really annoying. Well, now I can click
on this little link here at the bottom. And this will bring up a dialog
box where I have all the text I need ready to copy
and paste into my Android application or my iOS
application or my JavaScript application. And if none of these code
samples exactly matches the way you’re implementing your
achievement in leader board strings we also just have plain
old text version that you can copy and paste and run
through a Python script or what have you. So for all of you that are
implementing 200 achievements all at once, this should be
a really big time saver. And we’re really excited
to have this out there. So check it out. If you haven’t seen
it yet, it’s the greatest new feature ever. Well, maybe not ever. But it’s close. And so with that out of the
way, let’s get into game controllers on Android. I’m going to hand the clicker
off to Krispy here. KRISTAN UCCELLO: Thank
you very much. TODD KERPELMAN: Sure thing. Because he’s the expert. KRISTAN UCCELLO: I don’t know
if I’m an expert yet. I’m hoping to become one. And this is sort of the
first Foray into that. So I spent a lot of time with
game controllers, working of the stuff that I work on. And I’ve had a slew of
them cross my desk. And with that, this is
the first thing. What does it mean to support a
game controller on Android? Because there’s so many
different devices. And they all choose slightly
different ways of connecting to Android itself. A lot of them are either
Bluetooth or USB. Those are typically the
only options that you’re going to have. But one interesting thing is,
when you’re building an application that utilizes game
controllers, you have to factor in that you’re taking the
user’s ability to really touch a screen away from them. And this is a good thing
and a bag thing. It’s a good thing in that it
gives you that tactile feedback when you’re
manipulating the controls, pressing buttons. It’s something that doesn’t
require you to focus your attention on what
you’re touching. You could, instead, look
somewhere else. So this is great for Google TV,
Android TV, anything that is far away from you that
you can’t really touch. But on the opposite side,
you can’t really input text that easily. So if there’s a lot of input
controls that would require keyboard input that’s
not always there. So the plus points, I’ll
just summarize again. Physical feedback, some
kind of [INAUDIBLE] feedback with vibrators. The negative side, harder to
input text and there’s a little bit more design work that
has to go into your UI. But we’re going to cover some
more later on in the slides. So let’s talk about where
the APIs came from. API level 12 we saw the
introduction of a lot of the constants that were available
for dipping into game controllers, understanding
whether an input device is actually a joystick or whether
it has joysticks, whether it’s a game pad, whether it
supports buttons. And this has all that available
in the documentation since API level 12. There’s a link on the
slide right now. If you’re new to game
controllers this is the place to start. There’s a summary section that
really details things like what to do with source-class
joystick and source-class buttons and game pads. It’s a good primer. It’s not going to tell you
everything you need to do. But it’s a good place
to start to get ramped up on that material. Now, with API level 16 we saw
even more game controller support added. And this is where you can,
actually, tap into listening to connection and disconnection
events. Previous to API level 16, you
had to write your own broadcast listeners to tap into
when a USB devices was connected or disconnected. And you would also have to
implement a Bluetooth event listener that would tell you
whether a Bluetooth device had connected or not. You didn’t have to write a lot
of boilerplate code for all these applications. Now with API level 16, there is
the input listener that you can take advantage of. And it’s definitely a big one. So there’s a lot of support
already there for game controllers. So the two places you’re going
to want to look, API level 12, the link is on the screen,
and API level 16. Check those out. TODD KERPELMAN: I notice the
slide here says something about querying. What’s that? KRISTAN UCCELLO: Querying is
pulling of a sort to find out what devices are actually
game pads. One of the things that we’ll
talk about later on in the slides is how to identify an
input device, whether it’s a keyboard or a pointer, or a
stylus, or an actual game pad. And querying is kind of an easy
way to just getting the subset of input devices that you
care about in that case. We’ll cover some of the methods
of detecting input devices without using
a query right now. I don’t want to go too
much into that. All right? So moving along here. Oh, I’m scrolling
the wrong thing. There we go. So connecting controllers,
this is the first step in being able to use them. Phones and tablets, you’re
typically going to rely on a Bluetooth connection. Because it’s really hard to plug
a fat USB port into your Nexus device, I found anyway. But on Android TV devices like
Google TV, you can typically plug right into the USB port
and take advantage of that. And you can leverage
Bluetooth. So I think I’m kind of
recommending Bluetooth here. But you shouldn’t feel that
you’re limited to only using Bluetooth, especially if
you want to target a living-room-console style game
play for your users. So just quick, short facts about
where USB came from. It was from 1994. There was a collaboration
of a bunch of companies that got involved. And they created the
USB standard. And that’s evolved over the
years to our micro standard that we see now. You’re not going to find any
game controllers that really connect with the
micro USB spec. I haven’t found any yet. I’d be interested if
there were any. But we’ll see. I’ll just mention, again, API
level 16 introduced the ability to easily search and
listen for connected and disconnected devices. And actually, before I forget,
the button mappings, when you connect your game controllers,
button mappings are a little weird if it’s non-hid or
hid device sometimes. You can press the A button or
the B button on your remote or on your game pad. And it will act as
the back button. So we’ll talk about how
you can fix that a little later on. But just be aware that when you
first connect, even though you can navigate the home
launcher with it, it might not have the expected behavior
right out of the box. So it’s good for applications,
maybe not so good for home-screen navigation. TODD KERPELMAN: OK, KRISTAN UCCELLO: So let’s talk
about querying for game controllers. This might be a little
small on the screen. I say that because even
I’m having trouble reading this slide now. But I’ll cover the
basics here. What you want to do, is
you want to take the input device class. And you’re going to basically,
say, get all my device IDs. And you’ll get back an integer
array of all the devices that are currently connected to the
Android system, whether they’re virtual or real. What you want to do, then, is
actually iterate over all those device IDs and request,
again, from the input device class, getDevice. And you’re going to pass in the
ID that you’re currently iterating on. That will give you an
input device object. And you can now start to
ask that input device object about itself. And the key here for detecting
game controllers, is in fact, to use device.getSource. So devices, our input device
object that we’ve created, getSources, returns an integer
value which is actually a set of bitmaps, bitmapped values
that create a large integer. You will logically end those
with an input device source-class joystick. Effectively what you’re doing
there is you’re filtering out all the other bits. And you’re just looking at the
one that’s going to tell you, hey, this is a joystick
device or it’s not. And if that returns non-zero
than it is a joystick device. That means there’s an analog
stick on it that is a joystick axis. From there, you’re going to
want to possibly check the ranges that are available for
that joystick device. So we’re going to look
at that now. TODD KERPELMAN: OK,
actually, sorry. So going back– KRISTAN UCCELLO: You want
to go back a slide? TODD KERPELMAN: So I actually
can’t tell the device, like, are you a game pad? I would say, hey, out of all the
features that you have, do you have maybe a couple of
joysticks and some buttons? KRISTAN UCCELLO: Exactly. You’re going to take the
getSources and you’re going to ask it yes, do you have
the ability to provide me joystick input? Do you have the ability to
provide me button input? Chances are, if it has a
joystick, it’s a game pad. TODD KERPELMAN: Yeah? Is there anything that would
have a joystick that would not be a game pad? KRISTAN UCCELLO: I’ve done lot
of tests with a lot of different input devices. I haven’t come across any. It’s entirely possible but
probably not the normal case. TODD KERPELMAN: What about a
stylus then, that would say, I’m not a joystick. KRISTAN UCCELLO: Yeah, the
stylus does have axes based on the angle. But it’s not classified
as a game device. It won’t register
itself that way. TODD KERPELMAN: Got you, OK. KRISTAN UCCELLO: So with our
joystick identified, or the device having a joystick, we can
go in further and ask that joystick what motion
ranges it has. And this is useful for
determining the number of axes that are available. So if you have a game pad or
some sort of game input device that had two joysticks on it,
it’s going to have eight axes right there. One for the vertical on each
stick and one for the horizontal on each stick. Now, if it also had analog
triggers for the left and right, those will also show up
as axes but single axes. So you could have a device– or maybe I did my math wrong. TODD KERPELMAN: Yeah, I was
going to say, that would be four for the joysticks
and then two more for the triggers. KRISTAN UCCELLO: I
doubled it up. Two more for the triggers. I was jumping ahead of
myself in my head. So six axes in that case. And the thing that looks like
a D-pad, actually, on game input devices, people think
that it’s a digital input. And it’s not. It’s actually a Hat
device with axes. So you get another
two off of that. TODD KERPELMAN: So a D-pad
looks like, basically, it looks almost like an analog
joystick except that the numbers aren’t really analog. KRISTAN UCCELLO: Right, while it
returns it’s axes values as floats it’ll either
be 0 or one. You won’t get any of
the middle ranges. Whereas the other more
analog-style inputs like the triggers and the joysticks will
return in an analog value range between 0 or
negative 1 and 1. So that’s just something
to be aware of. So we check the motion ranges
just to get a principle idea of how many axes are actually
on this device. And from there, we want to
take that information. We want to restore
it in a state. We want to create a class that
allows us to know how many axes we have, the IDs of those
axes and the values associated with them. So I’m just showing, really,
the skeleton of a state class here. You’re going to want to extend
that with things to process the axis input and normalize
it and all that stuff. And we’ll cover a bit of
that as we go forward. But I just want to point out the
critical things you want to store, the number of axes,
the axes values, and you’re going to want to use, probably,
a sparse array to store the number of keys
that you encounter. And the keys are actually
the buttons. So these map as keys. I think it’s a little weird,
but buttons or keys. TODD KERPELMAN: OK, correct me
if I’m wrong, but an Xbox 360 controller, for instance, I
believe those buttons are actually analog. Is that true? And if I had something that
was similar would those– KRISTAN UCCELLO: I’m actually
not aware of that. I didn’t know that
they were analog. TODD KERPELMAN: OK, I could
be totally wrong. That’s what I vaguely remember
reading sometime. KRISTAN UCCELLO: Different
manufacturers can do different things. And this just goes back to
what I said earlier. There are so many different
types of, again, controller inputs out there. It’s really hard to know
what they all are. Which is why the way Android
has approached it is really good. It lets you query the device
for what it’s capable of, which lets you, then, determine
if the device is capable of providing the right
kind of input for your application. or game. TODD KERPELMAN: OK, So let’s
say a query device, it’s a standard two-analog joystick,
a couple of triggers. And it says, OK, I’ve got
these six analog axes. How do I know which two, for
instance, correspond to the joystick on the left? KRISTAN UCCELLO: We’ll
talk about some of this going forward. When you get a dispatch
on-motion event from your activity class, that the event
object is either a motion event or a key input event. We’ll ignore the key
input event. So you get a motion event. And the event object itself
has information about what input source on the device is
providing that particular input event. So there’s a couple things
you can check. Whether it’s a move, action,
associated with a particular axis label. So back to the APIs I mentioned
before, API level 12, it introduced a whole bunch
of constants that you can use to determine
which axes it actually is on the device. So they all map to different
constant values. TODD KERPELMAN: Got you. So for instance, looking at
a controller, that analog control on the left, those two
axes generally correspond to constants like what? Like move vertical and
move horizontal? KRISTAN UCCELLO: It’s actually
access underscore x-axis underscore y. Now the one on the other side
the controller, if it’s there, is typically labeled
axes underscore rx. My memory’s a little
fuzzy on this. But it’s labeled
appropriately. TODD KERPELMAN: So I got my axis
left, axes y, axes rx and axes ry basically? KRISTAN UCCELLO: Right, but it’s
not always guaranteed to be that way. You might actually end up in the
case where that secondary joystick axis is labeled
with a z. So zx, z, none of it is
constant with game controllers. And so you have to do a bit
of experimentation. My advice is to stick with some
of the more established brands because you’re going to
get consistent behavior across them, more or less. But it’s a bit of
trial and error. And you will probably end up
having to map a couple of different types of controllers
and adjust what they’re reporting their axes to
be to be consistent with your game logic. TODD KERPELMAN: And the time to
find that out is on my very first get move event
from that game pad? KRISTAN UCCELLO: Exactly,
because you’re not going to be able to determine everything
on initial poling yet. But everything can be dealt
with on those events. So one thing I want to put in,
since we’ve talked about the state of the device and storing
it, you’re going to want to probably figure out an
abstraction where each player should be assigned a controller
device and let that be consistent. As well, you want to let the
users sort out or whose controller is mapping
to which player. So one concept I have for
this– which I haven’t implemented yet but I’ve
seen in certain games– is something along these
lines, where the game starts up. And it’s like, all right, which
players are assigned to which controller? So you have a list of all the
game pad identified devices down one column and all the
players along the top. And any device can push these
controller things into the right player slot. And then that player could go
ahead and configure their device to their preferences. So just something I wanted
to point out. It’s always a good idea, if it’s
a multi-player game, to allow the players to decide
which controllers are which. Otherwise they’re having to
physically switch it. And it’s not a great
user experience. TODD KERPELMAN: That’s
not so good, OK. KRISTAN UCCELLO: So now let’s
get back to what we were talking about before that,
the handling of events. So there’s two methods you’re
going to want to override in your activity. And that is dispatched generic
motion event and dispatched key event. My recommendation is, whatever
you’re going to write for your logic to manage your input from
a game controller, you’re going to want to feed these
motion events from your activity into that class. Don’t try and deal with them,
necessarily, in the activity. Because it’ll just bloat your
code and it’s not a good way to abstract, I think. So whenever there is an access
movement or a Hat movement or an analog trigger you’re going
to get the motion event. So anything that’s analog
will cause motion. Any button event will trigger
the dispatch key event. And this is where you start
to get into filtering. So you use the constants– again, look at API level 12
documentation on this– to sort out which mappings
are actually to the keys you care about. And I’m not going to cover too
much about establishing how to remap keys. But allow the user to
reconfigure the layout of their device, their
abstraction layer. So you’re going to want to pass
this off to something that manages the device state
and then returns it back to whatever’s going to use that
state to then modify the player-controllable objects
in your application. So it looks something
like this. So your dispatch key event and
your dispatch generic motion event come into the activity. You’re going to hand it off to
whatever system to get the state back and use that to
power your application. I want to point out a few things
about analog joysticks. You will have to be aware
of the dead zone. Not all joysticks
center on zero. They’re moved around a lot. They’re mechanical things. And so they can get a little
off and it can report to the sensors. Luckily, we have this thing
called the dead zone, usually by calling getFlat on
the motion range. This allows you to determine
some sort of air tolerance when the joystick is released
and not being touched by the player. Use the motion range
of the joystick to determine this stuff. So the ones you care about are
getMin, getMax and getFlat, which I just mentioned. You’ll have to normalize your
axis values accordingly. So I actually have a bit of code
here that shows this off. Pardon me. So if we want to process an
axes and we have some axis value that we’ve gotten from our
input state or controller state object, so we have
the motion range. We have the axis value. What we want to do, is we want
to get the absolute value of that axis value. And then we want to determine
the dead zone. So we’re going to go getFlat. And then we want to determine if
the absolute value is less than or equal to
the dead zone. If it is, return 0. That means that it’s actually
within that range. And we shouldn’t do anything
with this. Or if the access value is
greater than 0, we want to return the absolute value
divided by the minimum range, which gives us a normalized
value. If it’s less than 0 we’re going
to do absolute value divided by maximum range. TODD KERPELMAN: So what
do these numbers typically look like? So I’m assuming getMin
is a negative value? KRISTAN UCCELLO: Yes So getMin
is a typically negative one. And getMax is typically
one, yes. But you can actually
modify this. If you want to actually get out
of, let’s say, a method like this, you wanted to
get some greater range. You want to expand
it as you’re not dealing with decimals. You’re instead dealing
with integers, which is completely possible. You could add biases to your
calculations here to actually spit out oh, 1,000 or 200. TODD KERPELMAN: And getFlat here
would probably look like, say, 0.05 or something
like that? KRISTAN UCCELLO: Oh, I think
it would look even smaller. From what I’ve seen, from what
I’ve played with, it’s like, 0.02 or 0.02, 0.01. It’s a very small percentage. Because remember, the values
we’re dealing with here are negative one to one. And 0 is supposed to be
that absolute center. But it fluctuates a tiny bit. Not a great amount, but if
there’s a lot of wear and tear on the physical device you
might see greater values. So one more thing that I want
to talk about here is just about the user experience. When you’re designing
applications and games that utilize digital input– and I’m going to steer away from
the analogs for a minute because you’re not really going
to navigate around with that– let’s say, using the
Hat or D-pad, don’t punish your users. Provide layouts that are
actually navigable and don’t lead them into traps. So patterns that we found useful
are using shelves. You might remember or you might
have seen this in things like Netflix, where everything
is stacked as a shelf and you can just go along. It allows you to jump down or
jump up to get out of your current horizontal scroll. Because you might have gotten
100 units over. And you want to get back to some
menu item on the other side of the screen. TODD KERPELMAN: If I go down
and up or something? KRISTAN UCCELLO: Yeah, that’s
your shortcut out, as opposed to having to scroll
all the way back. And tabs can be utilized in this
fashion to help a user jump between a lot
of content lists. It’s OK to use lists but
always provide the out. Allow the user to jump to the
left or to the right as appropriate. And great grid is always good. Grid, it maps very well
to D-pad we find. So one last thing, I think
I mentioned it already. Allow the user to
remap the keys. This is important. Some people have preferences. Some people, when playing
first-person shooters, prefer the inverted axes control,
which means down is up and up is down. TODD KERPELMAN: Those people
are crazy, I think. KRISTAN UCCELLO: Well, what
do you prefer to use? TODD KERPELMAN: No,
I like up is up. KRISTAN UCCELLO: No
inverted control? I like up is up too. TODD KERPELMAN: What, you? This is crazy. KRISTAN UCCELLO: So yeah,
allow the user to assign different controllers to
different players, which we already covered. So at this point we’re
going to demo. So we’ll just go to that now. All right, so we chose
Cordy 2 here. I like this game because it’s
very responsive when using controllers. I had a lot of fun playing
it on the TV. So on the first screen here,
we’ve got an example of using focus to your advantage. So those little white– TODD KERPELMAN: Yeah, if I
move my game pad left and right it’ll go back and forth
between buy full game and choosing a level. KRISTAN UCCELLO: So this is a
really good example of how to illustrate visual focus. And this goes to what I was
talking about before when we were talking about the layouts
and how not to trap the user. So it’s very important to orient
the user when they’re navigating with an analog
stick or D-pad or hat. So we’ve got our little
game intro piece here. And Cordy’s coming out. All right, let’s jump through
the text that comes up. So this is all being done with
clicking on the button. TODD KERPELMAN: Right, you guys,
we’re full screen so you can’t see me. But listen, these are
joystick noises. I’m really actually playing
with a joystick, not the game pad. KRISTAN UCCELLO: It just it
feels very natural, almost like you’re playing
a console, really. TODD KERPELMAN: Yeah, KRISTAN UCCELLO: It’s
nice and smooth. And you can actually double
jump in this. There you go. TODD KERPELMAN: Oh,
look at that. KRISTAN UCCELLO: And for me,
playing platformers like this, it just makes all the
difference to use a controller. You’re not distracted by any
on-screen touch needs. Even though the UI, in this
case, is still showing some touch commands, you have the
option to jump back on touch screen, which is great. TODD KERPELMAN: Yeah, I have to
say, this a lot more fun to control using a game
pad controller. I don’t have to look to
see if my fingers are in the right place. I can just feel that. And this just feels, for me, a
lot more natural, playing a platformer game like this. KRISTAN UCCELLO: Absolutely. And one thing that actually
frustrates me a little bit about the on-screen controller
simulators, and that’s what I call them is just simulation
of game pads. Sometimes when there’s garbage
collection going on within the app or even on the platform,
you can get some lanky feedback from what you’re
touching and actually cause the game not to do what
you intended it to do. I don’t know if you’ve ever
experienced that. TODD KERPELMAN: I have
on occasion. KRISTAN UCCELLO: So it just
makes, for me, anyway, the argument that all games, really,
should try and strive and support game controllers
in this way. TODD KERPELMAN: Sounds good. Yeah, my only complaint here
is I’m sure this maps to a game pad button. But I don’t know which
one it is. KRISTAN UCCELLO: Yeah, actually,
that’s a good thing to point out. A lot of the on-screen
instructions in a game, if there is controller support,
they should detect that the input is mostly coming from a
controller and maybe adjust the instructions to map
to the buttons. So there you go. You figured it out. TODD KERPELMAN: There’s
the B button. Wee! Look at that. There I go. All right. KRISTAN UCCELLO: So yeah, a
great game to play with a controller. There’s lots out there. A lot of the controller vendors
highlight the apps that support their controllers
in the market. And you should check it
out for some examples. TODD KERPELMAN: Cool. All right, well, I could
play this for the rest of the video. But I won’t because we got
some wrapping up to do. KRISTAN UCCELLO: All right,
let’s get back into it. TODD KERPELMAN: All right,
and so we’ve got some Q&A at the end. I actually had a couple
questions that are not on here. KRISTAN UCCELLO: Oh, yeah,
let’s do some improv. TODD KERPELMAN: So at the
beginning, you talked about there’s two ways to do connect,
Bluetooth or USB. Does a developer need to care? Do I need to know how my
device is connected? KRISTAN UCCELLO: If you’re
developing for Android at anything less than API level
16 you’re going to care. Because while Android treats
both USB and Bluetooth devices as just input devices, when it
comes to monitoring their connections and disconnections– which is something you will have
to do on anything lower than API level 16– you’re going to have to write
two broadcast listeners, one for the USB, one
for Bluetooth. That’s where the differentiation
comes in. TODD KERPELMAN: Got you. OK, so if I’ve got a high-end
game, clearly only modern devices might work moving
forward, maybe I don’t have to care if I want to reach
the broadest range of customers as possible. KRISTAN UCCELLO:
Exactly, yeah. TODD KERPELMAN: OK, now I’ve
seen some game controllers or gaming devices where essentially
the controller is integrated right into
the device. KRISTAN UCCELLO: I’ve seen
a few of those myself. They’re quite amazing. TODD KERPELMAN: How is
that represented? And I guess, do I need to
care about connected or disconnected? Because it’d be hard to
disconnect a shield controller without breaking it. KRISTAN UCCELLO: You’re
probably right. If we think about other ones
that are similar form factor, it all depends on how
it’s connected. If you’re just targeting
one device– I don’t know how likely
a case that would be– you’re still going to have to
detect the input device as being there. So that’s a good question. I’m not quite sure what the
right answer is there. You get a point for that one. I would say, just treat
it like you would any other device. Don’t assume that it’s there. You’re going to try and build
your application as you said before, for multiple devices
and form factors. Don’t make assumptions. That’s what I would say. TODD KERPELMAN: Fair enough. Moving forward, the world’s
going wireless. Do you think Bluetooth
is basically going to be the standard? KRISTAN UCCELLO: I absolutely
think so. If we just think about what it
means to have wires– and I’m going to go back to TV
because I’m a bit passionate about TV– it really doesn’t make sense
to have a really long USB cable plugged into your TV pr
your set-top box while you’re sitting on the couch. People trip over it. Yes it provides a very
clean signal. But it’s at the expense
of being tethered. So as we, in our lives, move
around more and care about bringing our data with us and
interoperability between devices, I think Bluetooth is
only natural as the de facto standard, if it’s not already. TODD KERPELMAN: Is that going
to be replaced by a new-and-improved standard? KRISTAN UCCELLO: I don’t know. Do you know of a new standard? TODD KERPELMAN: No,
but I figured if anyone knew, you would. KRISTAN UCCELLO: I
mean, who knows? It could be the internet
is everywhere and just powers things. TODD KERPELMAN: OK, let’s see. And then, so speaking of modern
game controllers, there’s been, certainly in
the news, a lot about Android-powered gaming
devices. I’m thinking like the Ouya and
the Shield and probably more in the future. If I’m a game developer, is
there anything I need to know specifically about developing
for this new generation of Android-powered game devices? Or can I just address them
like normal controllers? KRISTAN UCCELLO: I’m going
to answer it this way– first piece of advice, do
not lock yourself in any vendors’ APIs. That is a good way to shoot
yourself in the foot. Now, there are reasons to do
that if you have deals with a particular device. But it means you’re going
to limit yourself to just that device. A lot of these Android game
consoles all share a lot of similar characteristics. They’re usually boxes. They’re usually boxes connected
to televisions. And they usually have wireless
controllers. And they all have four buttons
on the right hand. And they have an analog stick
available on the left hand. Some of them have a second
analog stick. And they usually
have triggers. So if you’ve ever played with
any one of the popular consoles out there– TODD KERPELMAN: You generally
know the capabilities? KRISTAN UCCELLO: They kind of
all look the same, yeah. That said, what those
keys map to for that device could be different. So I would say, see if you can
take a controller from one device and connect it
to another one. And see if it actually gives
you what you expect back on what the axes names are and
what the buttons are when those events come in. TODD KERPELMAN: All right, and
finally, if I’m looking at all this and thinking, boy this
sounds like a lot of work. Maybe there’s a game engine
that can do it all for me? KRISTAN UCCELLO: There
are game engines. I’m partial to a few myself. I mean, I haven’t played
with Unity that much. But I hear good things and
I’ve seen it around. libgdx is one of my favorites. And it does come with game
controller support. It’s an open-source project. I played with jMonkeyEngine,
which is also pretty good. If we were to think about web
games just for a second– and I know it’s a little weird
to mention it. But if you load a web page on
your Android device and you try and use a game controller,
none of that ever works. TODD KERPELMAN: I’ve
never tried. But I’ll assume that. KRISTAN UCCELLO: So there’s
no good engines– is what I’m trying to say– that I’ve seen that support game
controllers on a browser. TODD KERPELMAN: But it seems
like most modern game engines these days will have some type
of controller support? KRISTAN UCCELLO: Absolutely. It’s sort of essential for
a game engine to provide game-controller support. So if you’re choosing one and it
doesn’t, maybe you want to question using that. TODD KERPELMAN: Write them
an angry letter. KRISTAN UCCELLO: Or you know
what, better yet, if it’s an open-sourced project,
fix the problem. Submit the code. Patch it. Make the internet and world
a better place. TODD KERPELMAN: Oh, it’s much
better than an angry letter. KRISTAN UCCELLO: There’s
too many angry letters in the world. TODD KERPELMAN: That is true. I get them. All right, well, I think that
just about wraps it up. Let me see, do we have anything
else on our slides? KRISTAN UCCELLO: I think
there’s just one more. TODD KERPELMAN: Oh,
that’s right. KRISTAN UCCELLO: So I guess
we’ll point out here, I’m in the process of writing a
series of blog posts. I’m targeting about five
different posts right now that really go in depth technically
on all the stuff that we talked about today and
a little bit more around the UX guidance. So keep an eye out for those. They should be in
the near future. TODD KERPELMAN: Where would
I find these blog posts? KRISTAN UCCELLO: You would
find them on the Android Developers blog. TODD KERPELMAN: OK, I
sometime read that. KRISTAN UCCELLO: I read
that regularly. I’m a fan. TODD KERPELMAN: All right,
so people just keep an eye out there. And they’ll see your blog posts
in the next week or two? KRISTAN UCCELLO: I don’t know
if it’s going to be in the next week or two. I want to make sure all the
details are nailed down solid. I don’t want to give
anybody bad advice. So very, very soon. TODD KERPELMAN: I’m trying to
hold you to a deadline. KRISTAN UCCELLO:
I don’t get it. You can’t estimate
things like that. TODD KERPELMAN: So by the time
this video’s out, all five blog posts will be published
and they’ll be perfect. KRISTAN UCCELLO: Todd’s
going to write them. TODD KERPELMAN: You heard
it here first. KRISTAN UCCELLO: Thanks, Todd. TODD KERPELMAN: All
right, well, cool. Thank you very much for joining
us, internet audience. And thank you, Krispy. KRISTAN UCCELLO: My pleasure. TODD KERPELMAN: For providing
some really excellent content this week. KRISTAN UCCELLO: Thanks. TODD KERPELMAN: And
we will see you guys in a couple weeks. Bye.

Only registered users can comment.

Leave a Reply

Your email address will not be published. Required fields are marked *