GLBasic forum

Main forum => GLBasic - en => Topic started by: fjsantosb on 2009-Dec-08

Title: GLBasic & Android?
Post by: fjsantosb on 2009-Dec-08
Hi there,

Investigating some posiblemarkets to sell games, i arrive to android market. I know that its not so popular like iphone market, but i see that android popularity is grow daily.
Iphone developers adventage is that main resolution is 320x480, same as iphone, althought resolution sizes is increasing everyday too.
So i wonder is there is any plan to include android build on glbasic builds, or even if this is possible.
King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2009-Dec-08
This has a link to developing stuff for Android in C - apparently the one line test program took several hours to compile...

http://www.pocketmagic.net/?p=682
Title: Re: GLBasic & Android?
Post by: Kitty Hello on 2009-Dec-08
Android = Java
GLBasic = not
Title: Re: GLBasic & Android?
Post by: fjsantosb on 2009-Dec-09
Yep, i know that glbasic its C and android is java (i coded some time ago for android), really was a bit 'silly' question.

@MrTAToad: Interesting link you provide, its a pity that has several hours to compile a simple program :S, impossible to do some serious work.

Thanks for your answers!

King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: Hatonastick on 2009-Dec-09
Quote from: Kitty Hello on 2009-Dec-08
Android = Java
GLBasic = not
Time to switch Gernot!  =D

Just kidding.  Java isn't my favourite programming language.
Title: Re: GLBasic & Android?
Post by: Kitty Hello on 2009-Dec-09
rewriting the whole GLBasic engine in Java is close to impossible. Also, I'm afraid Java has not enough Template (Generics) support to do all the dirty tricks I use in GLBasic.
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2009-Dec-09
Java is too slow for really fast games.

Have you seen the amount of work needed to get C working on Android too ?  Its horrendous!  It also looks like its Linux only too...

Title: Re: GLBasic & Android?
Post by: Kitty Hello on 2009-Dec-09
and what about the android store - they will surely refuse to upload binary files.
Title: Re: GLBasic & Android?
Post by: Hatonastick on 2009-Dec-09
Yes, I suspect Android has been shot in the foot before it can even start to run.
Title: Re: GLBasic & Android?
Post by: fjsantosb on 2009-Dec-09
Well, personally I have an account to android store, and they don't provide any kind of review like Apple, I mean you can upload directly what you want (and after this, is there is any illegal, offensive, etc etc content, they delete your app). So is developer side the responsability of doing things well.

But coding for android in java is almost a pain, and there is a really bad bug referring to touch control (multitasking on java is not so good as you know), so main thread slowdowns always that screen get some touch input. (Yep there is some tricks to avoid a bit, but you cant really avoid this totally).

But his market in growing strong last months, applications starts now to have a decent number of downloads (far away of numbers on appstore, but i think that in a future it could be a serious competence).

Personally i use an android mobile device as main mobile (htc magic), i love his size!

Just my 2 cents.

King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: Kitty Hello on 2009-Dec-09
I use an iPhone as my main phone and I just love the Apps  :P
Android will soon be dead IMO.
Title: Re: GLBasic & Android?
Post by: fjsantosb on 2009-Dec-10
Well, if i had to kill a system, would be 'windows mobile' hehehe.
I hate his low response and continuous hang ups (its windows after all!).

But without any doubt, amount of quantity / quality applications on iPhone is far away of other systems

King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: okee on 2009-Dec-10
There's is a basic language for Android called Simple Basic
at  http://code.google.com/p/simple/ don't know how advanced it is though.
Title: Re: GLBasic & Android?
Post by: fjsantosb on 2009-Dec-10
@Ocean: indeed, other problem that i can see on windows mobile, its that windows mobile must be 'addaptive' i mean, there is a lot of differents device, with different processors and different screen sizes and same windows must addapt to all oh them which is difficult (Apple has unique mobile to addapt his OS, which is perfect).

@okee: interesting language, altought its seems a little advanced by now.

Anyway, i prefer glbasic ^_^ (and i try a lot of language before!).

King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2009-Dec-10
Perhaps it may be worth looking at a Linux/Mac only GLBasic version for developing on Android - due to the limitations of the Android SDK, its not possible on Windows...
Title: Re: GLBasic & Android?
Post by: fjsantosb on 2009-Dec-10
Development for android is possible in windows using eclipse.
I personally write how to set up (mainly for not to forget it), some time ago here: http://coding4android.wordpress.com/2009/05/12/set-up-enviroment/

But using glbasic on MAC will be really great! (I would like to use my macbook pro as main developer platform).

King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2009-Dec-10
Not in C its not - the headers are case-sensitive (same filenames but different cases), which are one of the many problems on Windows...
Have a look at : http://www.aton.com/android-software-development-tools-what-do-i-need/
Title: Re: GLBasic & Android?
Post by: fjsantosb on 2009-Dec-11
You are right MrTAToad, very interesting article indeed.

King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2009-Dec-11
The chances of doing anything in Windows would be 0% - I don't see Gernot doing a version for Mac/Linux :)

Pandora if/when it's commercially available would be a good thing to support though.
Title: Re: GLBasic & Android?
Post by: gigios on 2010-Mar-10
New version of  Android NDK, Revision 3 (Native Code SDK)

General notes:

http://developer.android.com/sdk/ndk/index.html (http://developer.android.com/sdk/ndk/index.html)
Title: Re: GLBasic & Android?
Post by: Kitty Hello on 2010-Mar-10
Is Android any good. I mean - does anyone have such a phone?
Title: Re: GLBasic & Android?
Post by: MikeHart on 2010-Mar-10
Yes, i have a G1. It is great.
Title: Re: GLBasic & Android?
Post by: fjsantosb on 2010-Mar-10
I have HTC Magic (I use this mobile device usually).

King Regards, fjsantos.
Title: Re: GLBasic & Android?
Post by: Ozden79 on 2010-Mar-10
Having an Android support would be a great addition, that would make GLBasic very powerfull on mobile development...
Title: Re: GLBasic & Android?
Post by: codegit on 2010-Mar-10
I'm hearing that this platform is growing very fast.  :good:
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2010-Mar-10
Unless Apple win their court case :)
Title: Re: GLBasic & Android?
Post by: doimus on 2010-Mar-10
Problem with Android is in hardware fragmentation. There is way too much different platforms/resolutions/graphics etc.

Android runs on anything from mobile phones to netbooks with 10" screens. Developing game for it would be similar to developing games for Java on mobile phones. Nightmare, in short.
But it would be nice to have it as supported platform nevertheless.
Title: Re: GLBasic & Android?
Post by: MikeHart on 2010-Mar-10
Quote from: doimus on 2010-Mar-10
Problem with Android is in hardware fragmentation. There is way too much different platforms/resolutions/graphics etc.

Android runs on anything from mobile phones to netbooks with 10" screens. Developing game for it would be similar to developing games for Java on mobile phones. Nightmare, in short.
But it would be nice to have it as supported platform nevertheless.

And so are PCs and Macs. Well MAcs are more standard but you have the problems on the desktops too.
Title: Re: GLBasic & Android?
Post by: doimus on 2010-Mar-11
Yes, but on PCs you can always go to the smallest denominator: 640x480 + keyboard + mouse = runs anywhere.

My fragmentation remark wasn't about actual code or programming, but more about design and asset creation.
Is your target device portrait or landscape? What is the resolution? Aspect ratio? Is it multi-touch? Does it have a keyboard or any kind of physical buttons? Stylus?

Once you start catering to all the possible options, your game will probably become unplayable and you will probably soon realize that you're not developing for a platform, but for a particular device instead.
Just like developers for mobile phones don't develop for Java platform, but for Sony Ericsson model whatever, Samsung model whatever. And then something that works on Motorola X2BN is completely borked on Motorola YC6, because they just added these neat extensions for Java platform, etc.
Title: Re: GLBasic & Android?
Post by: planetm on 2010-May-21
Quote from: Kitty Hello on 2010-Mar-10
Is Android any good. I mean - does anyone have such a phone?

I've had an HTC Hero since last November, excellent phone. I'd really love to see Android support in GLBasic.
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2010-May-21
Unfortunately, until C/C++ support is setup for Windows, I dont see it being feasible.
Title: Re: GLBasic & Android?
Post by: monono on 2010-May-21
IÃ,´ll have the HTC Tattoo from my brother soon. He is going to update on the Legend. I have played around with it for a while. ItÃ,´s amazing. Even the hardcore-applemaniacs in my peer go for android. There are coming harsh times for apple. Compare the prices for what you get and a thing called 'freedom' (I have to admit the iPhone is an awesome gadget without it). First time for years I am looking into java again. And yes: it sucks! Never liked it.

So we have to wait for a decent android c compiler. In the meantime, I hope that the iPhone is getting cheaper. Good to have a real competition here.
Title: Re: GLBasic & Android?
Post by: Darmakwolf on 2010-Jun-17
Interesting find: http://developer.android.com/sdk/ndk/index.html
Gernot, is there any way GLBasic could wrap around the SDK and compile a C program for Android? I am getting an HTC Droid Incredible soon from Verizon. I understand it uses interpreted Java by default, but this SDK permits the use of C in the program. It's likely that it would still require a small java applet to launch the program, but that could be built into the compiler and be generated automatically. Is there even the slightest possibility of this??
Title: Re: GLBasic & Android?
Post by: codegit on 2010-Jun-17
I have an HTC Desire (1ghz processor) and it is brilliant.  <3

http://www.htc.com/www/product/desire/overview.html
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2010-Jun-17
QuoteGernot, is there any way GLBasic could wrap around the SDK and compile a C program for Android?
I posted about this before - if you want to use C with Android, you have to use a non-Windows machine, as the library files are in a name format only really suitable for Linux.

See http://www.aton.com/android-software-development-tools-what-do-i-need/
Title: Re: GLBasic & Android?
Post by: Kitty Hello on 2010-Jun-17
Thing is - I don't have an Android device. And they are not cheap. And I don't know for sure if it will work in the end. I don't see a big problem with C/C++ and the NDK, though.

Is there an emulator I could use? Or does anyone have a spare unit? Donation fond?
Title: Re: GLBasic & Android?
Post by: Slydog on 2010-Jun-17
Android emulator:
http://developer.android.com/guide/developing/tools/emulator.html (http://developer.android.com/guide/developing/tools/emulator.html)

As for Androids having difference specs, I don't see that as a big problem.
Screen size / orientation is simple.
Just code your elements to be relative to an anchor (top, top-left, bottom-right, top-center), plus perhaps a pixel offset.
So, no matter what size screen or orientation, you score is always bottom-right, for example.
You just need a 'ConvertAnchorToScreenCoordinates()' function.

Same as game content.  A tile map would be easy, just pre-calculate the number of tiles down and across, etc.

But I see the problem with various input methods: keyboard, single touch, multi-touch, etc.
You would have to create a custom library to account for it all.
Use this in your game initialization:
Code (glbasic) Select
IF Device.HasKeyboard()
  Input.EventAdd_Keyboard("Fire", kAscii_Space)
//ELSEIF Device.IsMultitouch()
ELSEIF Device.IsTouch()
  Input.EventAdd_TouchPoint("Fire", 100, 200)
ELSE
  Input.EventAdd_HWButton("Fire", kHardwareButton_3)
ENDIF

This code (ha, I just made that all up, sure to have logic/bug problems) will setup a 'Fire' event that could be called anywhere in your game logic and would work for any device, iPhone, Computer, etc, such as:
Code (glbasic) Select

IF Input.IsEvent("Fire") THEN . . .


It would be better (faster) to use constants instead of strings for event names, instead of "Fire", use kEvent_Fire, but you get the idea.

The 'Input.IsEvent' code would then handle the device specific checking as initialized earlier.
This keeps your game logic clean and device independent.
But since I've never done this, I'm sure there may be hurdles I can't predict yet.

I'm starting this soon for my own project, using compiler directives.
... If iPhone then rotate means tilting, else rotate means analog stick movement, etc.
(Input.AxisAdd_Tilt("Rotate", "XAxis"), or Input.AxisAdd_Joystick("Analog2.XAxis")    maybe)
view_x = Input.GetAxis("Rotate") (or something)
So testing on the PC versus the iPhone won't require any extra thought/changes.

[Edit]
This could also allow for more than one input method on the SAME device.  Add a touch point AND keyboard key to both trigger a 'Fire' event.
Title: Re: GLBasic & Android?
Post by: Darmakwolf on 2010-Jun-20
With the emulator, it would be possible to at least see if it's going to be doable in the least. (GLB for Android, that is.) If you would like, I can try any prototypes/betas you would like on my actual Droid Incredible. I'm sure the many Android people would L O V E for this to happen. In fact, I'd pay for a special version of GLB that only compiled for Android. xD
As for the emulator, you can load custom binaries but they need to be packed into a .APK format, which I do not know how to make myself but the SDK can pack binaries into APKs, then you just send them to the emulator via command prompt in windows. I tested out the Gensoid emulator on the emulator that way.
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2010-Jun-20
Unfortunately I dont see it being possible as there is no compiler for Windows
Title: Re: GLBasic & Android?
Post by: Darmakwolf on 2010-Jun-20
This guy did it. http://forum.openhandsetdevelopers.com/android-application-in-c-yes-t13.html - not to mention the C bits can be done within Eclipse for windows apparently too. It's looking less and less impossible, MrTAToad
Title: Re: GLBasic & Android?
Post by: MrTAToad on 2010-Jun-20
That looks like Linux stuff - if not, how did he get around the header problems ?  Or is he just using standard C routines ?

As far as I know the C bits cant be done in Eclipse on Windows unless you want to rename loads of files - unless the NDK has be radically updated for Windows (which even the Android site doesn't mention).

Also see my previous link about a companies attempt to get it going in Windows, specifically :

QuoteWe used Ubuntu to obtain the Android source tree, which included the run time libraries and associated headers.  We wanted to run the cross tool chain from Windows, but almost immediately ran into two significant roadblocks:

    * One was that a few dozen of the files whose names differed only in case.  Windows file names, by default, ignore letter case in names, whereas for Linux/Unix file names, case makes a difference.  Copying the files to Windows generates files with duplicate names.
    * The second roadblock is that the header files are organized in a different manner than expected by a GNU tool chain.  Both of these roadblocks could be overcome, but the amount of time and effort to do so was deemed prohibitive.

I wouldn't say its impossible - just incredibly hard and time consuming.

Oh, and apparently using C with Android prevents you from accessing various functions too :

http://www.zdnet.com/blog/burnette/program-for-android-in-cc-with-the-native-development-kit-if-you-dare/1284 (http://www.zdnet.com/blog/burnette/program-for-android-in-cc-with-the-native-development-kit-if-you-dare/1284)

QuoteKeep in mind that using the NDK will not be relevant for all Android applications. As a developer, you will need to balance its benefits against its drawbacks, which are numerous! Your application will be more complicated, have reduced compatibility, have no access to framework APIs, and be harder to debug. That said, some applications that have self-contained, CPU-intensive operations that don't allocate much memory may still benefit from increased performance and the ability to reuse existing code. Some examples are signal processing, intensive physics simulations, and some kinds of data processing.

QuoteThe Google answer on running C/C++ applications on Android from the FAQs is : "No. Android applications are written using the Java programming language". Very simple answer, but the problem here is for developers and companies having ready to use code and applications for other mobile platform and looking to get their code ported to Android at low cost.