Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Getting Started In Android Game Development

Soulskill posted more than 5 years ago | from the android-needs-tetris-too dept.

Games 43

rbgrn writes "If you're interested in developing a game for the Android platform, there is a lot you need to know. If you have previous experience with game development, moving over to the Android platform won't be all that difficult. You will mostly just need to learn the architecture and API. If you're new to game development, here is a list of must-knows for getting started in Android game development. This is a good starting point for developers seeking to write any type of mobile game."

Sorry! There are no comments related to the filter you selected.

Slashvertisement (2, Insightful)

Enderandrew (866215) | more than 5 years ago | (#25670851)

They're not selling a product here, so much as a concept, but why is this on Slashdot's front page again?

Mind you, I'm excited about Android, but what here is newsworthy?

Re:Slashvertisement (3, Informative)

Anonymous Coward | more than 5 years ago | (#25671097)

More than anything else, this article read (yes, I'm new here) like a generic "Game Programming for n00bs" intro, with occasional references to Android in particular and mobile development in general. There was no real discussion of any specific challenges raised by Android, and no description of actual APIs. Their single "code sample" could have been for any C-like language on any platform.

It was nice as a brief overview for people who are non-programmers of what goes into programming a game. Not really worthy of Slashdot, though.

Re:Slashvertisement (2, Interesting)

g0dsp33d (849253) | more than 5 years ago | (#25673697)

Really? Anyone on Slashdot should have enough experience to know coding something that complex is hard, whether it be first-hand or not. Especially when it is for this type of hardware platform. Hell, half of us probably tried making a game at some point. I tried making Pacman in high school and Tetris in Visual C++ / Opengl in college. Neither were as easy as they sound, and that was for relatively simple games on relatively homogenized systems.

Re:Slashvertisement (0)

Anonymous Coward | more than 5 years ago | (#25671099)

I agree with you, I'm sick of Android being on Slashdot every couple days! I'd much rather read a fun blurb about Tofurky or something.

I bet Obama eats Tofurky. Oh wait, politics, no!! Boo! Hiss!

Re:Slashvertisement (1)

LingNoi (1066278) | more than 5 years ago | (#25672465)

This is the first android thing on front page in a long time. Agreed that it sucks though.

Re:Slashvertisement (1)

bonch (38532) | more than 5 years ago | (#25672269)

If it's not newsworthy, why did you stop scrolling through the Slashdot page, click on Read More for this article, and post to it? Slashdot posts stories for people to read and talk about. Maybe some folks would like to discuss game development on Android or other embedded devices.

I'll tell you why it's on Slashdot front-page. (-1, Troll)

Anonymous Coward | more than 5 years ago | (#25672707)

And no, this isn't about the GNAA supporting the Prop-8 marches in front of the Mormon Temples in Los Angeles. You see, this day in age, people don't have an actual product in implemented proto-type. They sit down and think of the future interest and the failure, then decide to sell that future to whomever is silly enough to go down that path until their death. Consider the Amish perspective; they're the ancestors to the marketer-class. They knew that marketing was a gimick, so they created the greatest ploy and plot to take over as much land as possible and stay under a cloak of simplistic living to avoid the Brittish Crown collecting Income Tax on their former colonists. Just 20 minutes ago I saw an advertisement on Television about a company using Amish labor to produce a 1-foot deep by 1-foot tall by 2-foot wide portable fireplace unit and that is completely contrary to their scripture. There is a patern in the economy that looks upon the possibility of standards and distinguished societal structures and political subdivisions to disregard their charter and just jump into the myre and slop that their forefathers and grantors waved from them. Consider all the other business models that will fail, but the greatest one was of the market-droid who was sold down river by the Amish. The most successful models are the most taxed, simple because it's Governments cut of the drug that people are willing to pay such high initerest on such little yield. Booze, tobacco, prostitution, and porn are all forewarned and despised in the Holy Bible that there evinces a diametric plot of society to create a worker class inspired by progress and efficiency to work maintenance and grunt-work to carry the ancestral denizens of simple living Amish caste through the present. The same story is seen in the tribes of Israel conspiring against Benjamin to sell him down the well as a slave to Egypt, yet he saves them all by his wit to progress where they could only speculate as dreamers.

As for me, seeing how all the Beer Taverns, Smoke Shops, Video Arcades, and Porn Stores are slowly merging into their customary futures as laundromat general-stores to compete against Walmart I am looking at a dream that none dare venture towards; a dream so cunning that it'll work by the willingness of the sweat and blood of the new form of brainless slave that pays for the privilege to power by enterprise: the physical fitness dweeb. My design is inexpensive in a 3-tear product placement that not even Walmart would dare such: A library with exercise equipment and internet kiosks to fill with paying-pettlers to generate power to run a next-door laundromat, where the people pay again to wash their clothes and generate heat that runs the bakery of the nextdoor bar and grill, where paying-patrons pay to receive cooked vegetarian food raised from the rooftops and drink an endless mine-shaft of beer brewed underneath, and the next-door vintage video arcade houses all the ripped ROM and custom mimic cabinetry to house the biggest marijuana-growing franchise in the verry housing which the embedded Linux computers don't occupy. It all starts with sheep of Billy Blanks, Chuck Norris, Jazzersize, LA Fitness, and 24 Hour Fitness, to harness their power, so people like me
 
  Can Prepare the World For...THIS [youtube.com]

My pinball gallery is almost complete!

Re:Slashvertisement (0, Troll)

terminal.dk (102718) | more than 5 years ago | (#25672717)

I think all the attempted iPhone clones suck. Android included. Android is just another one. Based on Linux instead of BSD like the iPhone.

Re:Slashvertisement (1)

gbjbaanb (229885) | more than 5 years ago | (#25673329)

generally considered that the problem is not the linux base of Android, but the java base for its API. There's a lot of Symbian c++ developers out there with a ton of code they're ready to reuse... except they cannot in Android. A lot of them are also complaining about performance of low-level coding they've had to use previously. They don't want to write image processing routines in java for example.

Considering Android's built on Linux, and the difficulty in using an API is the features and documentation of that API (and that Google's done a good job there), and the Android low-level stuff is written in C++ anyway, then a C/C++ API would probably have been a better choice for it.

Re:Slashvertisement (1)

LingNoi (1066278) | more than 5 years ago | (#25673809)

Android is going to be running on different phones, processors and architectures so making an app in C++ for the phone means it's only going to work on that one phone, defeating the whole point of cross platform for phone manufacturers.

and also to be honest, fuck Symbian, the bringers of software patents to the UK. fuck them in the ass with a hot iron rod, everything they touch turns to shit so I hope they don't get anywhere near this. ..and last but not least you can in fact do c apps on android however for the above reasons it's pointless to do so.

http://benno.id.au/blog/2007/11/13/android-native-apps [benno.id.au]
http://devphone.com/java-why-not-write-an-android-application-in-c [devphone.com]

Re:Slashvertisement (1)

tobe (62758) | more than 5 years ago | (#25673849)

There is at least one company that sells a product that allows you to write native C/C++ apps once that target many different platforms: I3D [ideaworks3d.com]

Re:Slashvertisement (1)

gbjbaanb (229885) | more than 5 years ago | (#25674593)

erm.. remember that the low-level Android API is entirely written in C++. And the whole thing runs on Linux.

So your "cross platform" problems are immediately concerned with the APIs Android and Linux gives you, so your C++ apps will be as cross platform as Java. (ie its not the same as running a desktop app on Linux, Windows and Mac - here you're running solely on the Android platform).

Symbian is irrelevant, its the huge amounts of code those Symbian developers have that they want to reuse that matters. If they now have to write the same stuff all over again for Android, they're less likely to do so. Why would any of them bother to port to Android if they already have a huge market for Noika phones? If they could port easily (or semi-easily) then I'm sure they would - the market for Android suddenly increases dramatically. To rewrite in Java means they won't until they see a large market already, and that won't happen if they're not developing for it.

Don't forget that a Java implementation (on mobile) is not as cross platform as you'd think, and mobile phone development is never "it just runs" simply because of the different resources available like screen sizes.

See the link here where he describes [nokia.com] one mobile java developer who had to make 100 versions of his java app to make it run on lots of phone models.

I think Android on Linux is a good idea, a common platform and a common API means all the hard porting work is done by the manufacturer. Putting Java on just doesn't make sense when you've got that niceness; and you have a large developer base waiting to port their apps and suddenly finding they can't.

PS. the java used on Android isn't really JavaME [betaversion.org] , due to Sun licensing. I suppose its a possibility that Google could develop a c++ compiler that turns c++ code into dalvik bytecode, or perhaps (more likely) a C# or VB.NET one. Wouldn't that be fun?.....

Re:Slashvertisement (1)

LingNoi (1066278) | more than 5 years ago | (#25680317)

The example of a 100 different variations of a java program is not on the android platform.

This is the whole point of android, so that you don't have to do that anymore.

Re:Slashvertisement (1)

Nursie (632944) | more than 5 years ago | (#25674663)

"Android is going to be running on different phones"

Already is, I have it on my Freerunner. It's pretty.

Re:Slashvertisement (1)

geekoid (135745) | more than 5 years ago | (#25683133)

Not really.
It means you ahve to compile it for different platforms.

Unless your app really needs the speed, just do it on Java, it's plenty fast.

Evening the playing field (1)

ClosedSource (238333) | more than 5 years ago | (#25677161)

The fact that Symbian C++ developers have a bit of a learning curve to climb before they can produce android apps should be a source of encouragement for anyone who is starting from scratch to develop one. Let one of the kids on the bench have a turn at bat.

second post (-1, Offtopic)

Anonymous Coward | more than 5 years ago | (#25670881)

jacking it for Obama!

Interesting... (3, Interesting)

Darkness404 (1287218) | more than 5 years ago | (#25670911)

I really didn't consider it, but there would be a major market for an MMORPG for Android. Think about it, when you are waiting for a bus you can hop on to finish a quest, if you want you can receive alerts about your character at work and the keyboard would make typing messages easy. The only problem I see with all games for Android is all the phones that could (potentially) use it. For example, a phone with only a touch screen is going to demand a totally different form of input than a phone with both a touch screen and keyboard, as is a phone that is all buttons and no touch screen. And I can see this really being a limiting factor, does the Android marketplace allow you to "restrict" apps to certain phones or download different versions?

Re:Interesting... (3, Interesting)

Opportunist (166417) | more than 5 years ago | (#25671271)

I've been rolling that idea around for a while now. Tossed ideas what could and what could not fly on a mobile phone.

Basically what it ends up at is the mobile phone transfer rates and the amount the companies charge. We pay about 20 bucks for 5 Gigs worth of traffic. Ok, people might not play as much as they do with standard PC based MMOs, but then again, I'm sure they will. And 5 Gigs ain't that much traffic. Factor in the mostly horrible stability and unbearable lag and any kind of "normal" MMO is pretty much out, especially when you consider, as you have pointed out already, that input is usually by no means as easy as with PC games. Can you imagine trying the bard twist on the buttons of a cell?

I'm currently toying with the idea of a turn based/real time hybrid game which would result in a rather slow pace. But then, I'm quite sure people are willing to accept slower gameplay since they're probably playing in a situation where they can't do anything "sensible" anyway, like waiting on a bus or riding it.

Re:Interesting... (2, Interesting)

VValdo (10446) | more than 5 years ago | (#25671715)

This is slightly offtopic, I actually did some research for nethack for Android. Found this thread [google.com] , and if you look on sourceforge there are a few java implementations of rogue-like games. Of course, with the supremely awesome ConnectBot [google.com] (the ssh client) + screen, you can pretty much do anything consoley, including games like rogue, MUDS, etc.

To get back ontopic, Android is actually a cool little platform to learn to program Java in. I've never programmed a line of Java before or ever used eclipse, but after reading the first few chapters of thinking in Java [smart2help.com] , downloading and installing the SDK on my mac, reading the SDK documentation, and asking tons of dumb questions in #android (freenode), I got my first little all-text game going in about a week and a half.

Seems like right now when everything is now there is so much good stuff that can be done with Android-- so much "low-hanging fruit" - simple apps that people would love to have if only someone would write it.

Lovin my g1,
W

Re:Interesting... (1)

chibiace (898665) | more than 5 years ago | (#25672567)

vodafone nz charges something like NZ$1/10MB now i think. too expensive even to play MUDs.

Re:Interesting... (1)

Opportunist (166417) | more than 5 years ago | (#25676441)

Well, I was on a pay-per-MB line back when MUDs were in fashion, so I know you can actually get quite far with 10MB text (if the client allows you to cut the spam to a minimum, like only giving room desc on demand and such). So doing a MUD would probably be quite possible and maybe even affordable, but, well, this ain't 1995 and people are used to MMOs. Reading is sooooo 90s.

You can, of course, limit updates to about once a second or even less, with some good motion prediction, but you will invariably end up with jumpy graphics. But I could well see people accept that, considering the state current mobile games are in. Hell, they'd probably blame their cell and its mediocre processing power. :)

Re:Interesting... (1)

fan of lem (1092395) | more than 5 years ago | (#25673413)

MMOs in mobile devices remind me of Charles Stross' Halting State [amazon.com] . It also introduces the concept of "servers" as a cloud where data is passed around via a peer-to-peer protocol (fragments of data - encrypted - reside on all players' devices).

Re:Interesting... (1)

IorDMUX (870522) | more than 5 years ago | (#25677973)

Hmm... It would appear that Runescape is poised to make a comeback, then. It should be a cinch to port to Android, it can be played in small bites, and it's limited interface makes the phone-migration issues far simpler, too.

Not that I'm thrilled about the possibility or anything--I lost a college roommate to Runescape for a while... I still remember him staying home from class to mine ore and wander through town shouting "Selling cooking pot!"... "Selling pot!"... "Selling high quality pot!".

I believe he made a veritable in-game fortune dealing his pot on the back streets of whatever-ville.

Good general guide for game development (1, Interesting)

corsec67 (627446) | more than 5 years ago | (#25671025)

Learning how to write AI is out of the scope of this article but the general idea is that the AI will press buttons just like the user does.

I hate games that don't do this. If the computer player and I are the same species, we should have the same limitations. Why should the computer player be able to do more stuff than a human player?

Re:Good general guide for game development (1)

QuantumG (50515) | more than 5 years ago | (#25671155)

Because you have a lot more computational power available to you (note: it's between your ears) than the computer player.

Re:Good general guide for game development (2, Funny)

Anonymous Coward | more than 5 years ago | (#25671703)

No, I don't. You insensitive clod.

Re:Good general guide for game development (5, Insightful)

Jimmy_B (129296) | more than 5 years ago | (#25672521)

I hate games that don't do this. If the computer player and I are the same species, we should have the same limitations. Why should the computer player be able to do more stuff than a human player?

Because reproducing the player's limitations is an enormous amount of work for nearly zero benefit. You can either spend months writing code to compute what the bots can see, AI to make it look around at the right times and remember where players that have ducked behind cover were and predict where players might come from, or you can just let the bot see through walls. If you want the bot to only use the buttons the player does, you then repeat that sort of problem twenty times, each with a theoretically possible solution but extremely tricky solution. Forcing the bot to use the player's interface is basically a waste of time, time which could have been spent on features that actually make the game fun.

Re:Good general guide for game development (1)

MobileTatsu-NJG (946591) | more than 5 years ago | (#25672929)

If the computer player and I are the same species, we should have the same limitations. Why should the computer player be able to do more stuff than a human player?

Compensation for lack of good AI. Usually the reason for lack of good AI is processing power, but I cannot tell you first hand how true that is.

using mobility, blending realities (4, Interesting)

Singularitarian2048 (1068276) | more than 5 years ago | (#25671321)

I'd like to see an RPG that uses the google phone's GPS feature to involve you in quests that blend real life and the video game universe. Perhaps certain tasks can only be achieved from a particular location in RL. Perhaps you are assigned to meet a particular player in RL in a certain location and achieve some goal together.

This is like Hideo Kojima's game Boktai: The Sun is in Your Hand, which comes with a solar sensor for your Gameboy, and certain portions of the game cannot be completed without actual sunlight. However, GPS adds a lot of potential that hasn't been explored.

Re:using mobility, blending realities (1, Funny)

Anonymous Coward | more than 5 years ago | (#25673327)

You best make sure you don't put the quest at the bottom of a cliff or the ladies toilets though or you'll be meeting some pretty mean lawsuits!

Re:using mobility, blending realities (1)

tobe (62758) | more than 5 years ago | (#25673867)

I so want this to happen it hurts. Would be a huge amount of fun to develop as well. If anyone's at all interested in exploring this idea then get in touch.

Re:using mobility, blending realities (1)

T.E.D. (34228) | more than 5 years ago | (#25676151)

So instead of 30 people crowded on a mob spawn online, you'd have 30 people looking at their cellphones crowded around a mob spawn in RL? Ick.

Re:using mobility, blending realities (0)

Anonymous Coward | more than 5 years ago | (#25676691)

There have been quite a few experiments with augmented reality games, which is what you're describing there. There's an interesting paper on augmented reality and also 'seamful design' I looked at whilst studying you can find at: http://eprints.gla.ac.uk/3423/01/Gaming_on_the_edge.pdf. The main premise of the game described there was to collect coins or steal them from other players by physically being in the correct location, GPS would determine that you were in range to collect or steal a coin.

Not a gaming platform people (-1, Troll)

Anonymous Coward | more than 5 years ago | (#25672217)

If Linux hasn't developed into a viable gaming platform, what hope does Android have? The iPod is already a bigger gaming target platform than all Linux distro's combined.

Android will not succeed as a gaming platform, and therefore won't succeed at all.

Re:Not a gaming platform people (1)

LingNoi (1066278) | more than 5 years ago | (#25672475)

um, ok..

Great Article. (2, Funny)

dkarma (985926) | more than 5 years ago | (#25672579)

Clean and concise. Tells you exactly what you need to know. I've been looking for this exact information for the last month now. Nice to finally have it in one spot.

How about writing a Web game? (1)

DraQ (161513) | more than 5 years ago | (#25673189)

Write a Web game application and ensure it works smoothly in the Android browser. i.e. Tweaking the CSS for bigger buttons etc. etc.

BONUS: Should work on the Iphone too and any Web browser ... yowsers!

I think the most compelling games platform is the Web. Someone needs to write a cool simple game like BRE or Planetarium. =)

the platform is cool, the service is expensive (1)

Speare (84249) | more than 5 years ago | (#25674251)

While I have all the game development experience, and the Java development skills, and the interest in supporting the Android platform in my spare time, I have to say that at this point, I can't see spending the dough on buying a G1.

I don't mind the idea of paying for a data plan for a data-oriented device, but I just don't need a phone. The cheapest voice plan is more expensive than the data plan. With the required voice plus data plus hardware, I'd pay $1,520 over two years. Many little apps are being released for free (which is as it should be) but we have yet to see how for-pay apps will fare on the Android Market.

There's no way for users to get a G1 with no voice plan, as they do with a Sidekick. AT&T apparently briefly offered a "deaf users" plan, or said they were going to do so, but then retracted that offer.

I guess the only other option would be to develop what I can on the SDK without owning a device, then ask other people to help me test it. That doesn't really seem particularly fun or useful, if I can't use the apps I write.

Performance with Java (1)

Dan East (318230) | more than 5 years ago | (#25675791)

I'm not java expert, but I have written some things for Blackberry (a Klondike Solitaire game for one). I've done some very, very performance intensive work on Pocket PC (Quake 1 & 2, my own 3D engine with ARM ASM optimizations, etc). All in all, Java will be a substantial hindrance and cap the performance of what can be achieved on the hardware when it comes to real-time rendering.

As a small example, most mobile devices use 16 bit RGB 565 pixel format, and the CPUs are RISC 32 bit. So for maximum performance, you try to always work with two pixels at once to halve the instructions required. With java, if your pixel buffer is of a 16 bit type then you cannot simply cast a pointer to a 32-bit aligned value in the array and then do 32 bit math on it. At the very least you will have to pack and unpack the two shorts individually. I hope someone can correct me if I'm wrong on that (that you can do 32 bit math on two adjoining, aligned 16 bit values with no extra overhead), because I'll certainly make use of it.

With these types of devices, if you work within the APIs - using available drawing primitives and hardware rendering capability - you'll be in decent shape. However if you need to do direct pixel manipulation (rotozooming, custom 3D renders, voxel terrain, bumpmapping, etc) then the language will be barrier.

When performance is most important (inner loop of texture mapper rasterizers for example), nothing can beat hand-coded ASM native to the CPU. I have a friend who can code StrongARM / XScale ASM like a fiend. He can take my best, carefully optimized C loops and usually cut the execution time in half over the compiler.

So not only can't you do decent high-level performance-optimized coding in Java, but the option of hand-optimized routines native to the processor are out.

Re:Performance with Java (1)

RealTime (3392) | more than 5 years ago | (#25676541)

Android includes an OpenGL API [google.com] . I have personally seen Quake 1 running on the TMobile G1, which has an on-board GPU as part of the Qualcomm chipset in the phone [wikipedia.org] .

Also, at the recent Google Summer of Code [google.com] mentor summit in October, an Android engineer mentioned in a presentation to attendees that native (ARM) code .so files would be bundle-able in .apk files soon. These libraries would be accessible via JNI. They would initially only have access to libc and libm in the first incarnation, though.

So, yes, I do believe Android is a mobile gaming platform.

(This was discussed in a public forum at an open source conference hosted at Google, so I don't believe it is secret information...)

Re:Performance with Java (3, Interesting)

Dan East (318230) | more than 5 years ago | (#25676967)

Nice. As a side note, ATI contracted me to do the Quake GS OpenGL ES conversion a few years ago (the NDA has expired). I got to fly out to one of their labs in California to do performance tuning with the guy who drafted the OpenGL ES specification. It was a nice experience.

As another side note, I had asked the marketing guy who arranged for me to do the conversion (it was done, along with MotoGP by another group to market ATI's new mobile 3D chipset) to not release the source. It was of course GPLed, and since ATI was only demoing it on their own hardware and not distributing the executable, the source did not have to be released. I wanted to contact Id about potentially marketing the game. The ATI marketing guy's contract ran out, so someone else started demoing it. That person handed the source code over to the first guy that came along. He ended up contacting me with some questions about it, which is how I found out. I told him that he would have to release the source if he distributed the game since it was GPLed. He had already flown to Id headquarters and met with Todd and had a contract in place. He then changed what he said, and told me that my work was crap, and he had another programmer totally redo the conversion (which is complete BS). I have proof that their version still incorporates that code that I modified and added under the GPL. In Quake GL the particle textures are hardcoded into the engine. They used a simple square texture which looks exactly like what was done in the software engine (a square particle was used in the software renderer purely for performance). I thought it looked particularly poor having a square particle, so I made it into a more rounded, diamond-like shape. That is what is in their version to this day.

So if the version of Quake you're talking about is from Pulse Interactive, then thanks, I'm glad you like my work, and you were seeing software running in violation of the GPL.

Re:Performance with Java (1)

Civil_Disobedient (261825) | more than 5 years ago | (#25680803)

Completely off-topic, I just wanted to say that I've been a big fan of your work on the ARM platform since your Quake port all those years ago (that and DEXplorer) and really appreciate your efforts.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?