Author Topic: To all the Android developers here...  (Read 2799 times)

0 Members and 1 Guest are viewing this topic.

Online namida

  • Administrator
  • Posts: 12409
    • View Profile
    • NeoLemmix Website
To all the Android developers here...
« on: April 29, 2014, 04:03:18 AM »
Well, I've been wanting to have a shot at Android programming... had a look at tutorials here and there, thing is though, I learn best from messing with existing source (my knowledge of all progamming languages that I know any of, except for BASIC, was gained this way), but I don't know which examples I should be looking at. So I'm wondering if you guys know of any (or can provide any of your own - I only intend to use it for studying how to make things work, not to make derivatives) good examples to look at? Ideal would be fairly simple games, better yet if they're concepts I'm familiar with (Lemmings variants, basic platformers, or renditions of traditional games (Pacman, Asteroids, that kind of thing)).

Any tips appreciated as well.

I am aware of solutions like Multimedia Fusion 2 (I actually own it, just not the Android exporter), BASIC!, etc - heck, QB64 (which you might remember I used to make LemSet) supports Android so I could always turn to it as a last resort - but I'd really rather learn the proper way using the official development kit.

If you're wondering, obviously not as my first project but eventually, I plan to do a reboot of that RPG I posted a (fairly advanced) demo of a while back, making it for Android. I've been thinking for a while that to really get it how I want, I need to use my own engine, and if I'm going to put in that much effort, Android seems like a more sensible platform to target than PC.


If it helps, my main concerns are around starting up and closign down the app of course, and that aside, mostly to do with how to handle graphics. And of course, the structure in general. I'm only interested in 2D, at least for the forseeable future. Once I can get those down, handling the actual game logic is pretty much the same no matter what language you're dealing with, so I don't forsee much trouble there. (It would appear Java is most similar to RGSS, out of the languages I have experience with.)
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: To all the Android developers here...
« Reply #1 on: April 30, 2014, 05:12:47 AM »
No experience here, but this hit that Google returned might be worth checking out?

http://www.kilobolt.com/game-development-tutorial.html

You could also maybe ask that guy (LJPJM or something?) here that's working on an Android Lemmings clone.

Offline geoo

  • Administrator
  • Posts: 1475
    • View Profile
Re: To all the Android developers here...
« Reply #2 on: April 30, 2014, 08:09:24 AM »
A possible alternative to Java could also be using SDL, which supports Android as well, and I think I saw tutorials and sample programs out there.

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: To all the Android developers here...
« Reply #3 on: April 30, 2014, 08:21:13 AM »
IMO it would definitely make sense to learn something that is supported cross-platform, so SDL does sound like a good idea.  But then again, it sounded like namida was already rejecting things like Multimedia Fusion 2 and and QB64 which were also apparently cross-platform.

Offline geoo

  • Administrator
  • Posts: 1475
    • View Profile
Re: To all the Android developers here...
« Reply #4 on: April 30, 2014, 08:33:35 AM »
Well, in the same vein Java is cross-platform, sort of. :P
I think SDL does way less stuff for you than MMF, just providing you with an interface for graphics, sound, etc, and it has been used for plenty of big titles.

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: To all the Android developers here...
« Reply #5 on: April 30, 2014, 08:52:42 AM »
Well, in the same vein Java is cross-platform, sort of. :P

I was under the impression that Android only uses the core language subset of Java, and to do things like graphics and sound, the standard class libraries available are different between Android vs the actual Java platform available on PCs/Macs/etc.  That's what I have in mind when I looked at SDL as "cross-platform", that you basically have (presumably) nearly the same APIs available from SDL whether you are writing something for Android vs PC vs Mac etc.

Online namida

  • Administrator
  • Posts: 12409
    • View Profile
    • NeoLemmix Website
Re: To all the Android developers here...
« Reply #6 on: April 30, 2014, 12:43:20 PM »
I'm not objecting to cross-platform systems in general, just, I'd rather avoid things which have a noticable degree of limited functionality, or just run a code file through an interpreter (yes, I am aware that to some extent this is how Android native apps work, but the developers here should know what I'm meaning), or create over-bloated output files, etc. Definitely, I'd want something that do things like background processes, integration with Google Play for in-app purchases, etc. Not because I have any plans to use them now; but so that I don't have to go learn yet another system if I ever get to the point where I *do* want to use these.

To be honest, cross-platform is ideal if it can be done while meeting those kind of needs. While Android is my preferred system by far out of the mobile platforms, I'm obviously not going to complain about being able to fairly easily port it to iPhone and/or Windows Phone, and even more so if the cross-platform even extends to PC (though I would guess if Windows Phone can be supported, at the very least it wouldn't be much of a stretch to also support Windows 8 Metro anyway, though desktop is obviously preferable).
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline LJLPM

  • Posts: 404
    • View Profile
Re: To all the Android developers here...
« Reply #7 on: April 30, 2014, 07:25:19 PM »
I'm not an expert Android coder, and I read the "Android Programming: The Big Nerd Ranch Guide" book to start with the Android thing. This book was good for me, and I learnt a lot of things. And when I have specific questions, I ask to Google.

I use the "Canvas.drawBitmap()" function for displaying 2D stuff on screen (http://developer.android.com/reference/android/graphics/Canvas.html#drawBitmap%28android.graphics.Bitmap,%20float,%20float,%20android.graphics.Paint%29).

And prior to that, to get a Bitmap to deal with, you'll need to call the "BitmapFactory.decodeResource()" function (http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeResource%28android.content.res.Resources,%20int%29).

And if you want your images not to be auto-scaled by Android (keep your images to their original size), then use the relevant option when using the "decodeResource()" function: http://stackoverflow.com/questions/6805355/i-dont-want-android-to-resize-my-bitmap-automatically

And, last but not least, you'll need to be aware of your project's auto-generated "R.java" file: http://stackoverflow.com/questions/10004906/what-is-the-concept-behind-r-java

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: To all the Android developers here...
« Reply #8 on: April 30, 2014, 10:45:57 PM »
I looked up SDL a little bit more today and it looks like you will have to use C/C++ to make use of it for Android, which may go against your more immediate goals of potentially taking advantage of Android-specific features which (I think) are only exposed in Java.  To be clear, Android does provide support through something called JNI for interoperation between C/C++ (more precisely, "native") code and Java code, but that is an extra thing you will probably have to learn if you go with the SDL route but also want to do things like in-app purchases etc.

One other thing worth mentioning is that I'm guessing you will probably want to write a "level editor" or similar tool as well in order to create your game's content effectively.  This provides a choice of having the editor written for Android as well (potentially even built into the game itself and only disabled for release versions), vs using cross-platform tools/libraries to build the editor for PC with possible code reuse from the game itself, vs using completely separate means to build the editor for PC.  There are minor trade-offs in the choices, though perhaps nothing that would clearly dictate one choice over another given that the Android SDK includes an Android emulator that effectively would allow you to use the PC for level editing purposes.