HTC Phone - Android? Monkey?

Community Forums/Monkey Talk/HTC Phone - Android? Monkey?

Matty(Posted 2011) [#1]
Good Day to you all,

I just recently got a new phone, a HTC Desire - I've not used Monkey (mainly blitz3d/plus/blitzbasic) but is it possible to develop programs for that with Monkey?

And is it as simple as hooking up my phone to my PC, compiling on the Pc and sending the file across to the SD card in my phone?


_JIM(Posted 2011) [#2]
Yes you can, and after you set up everything it's as simple as hitting compile then opening the applications menu on the phone and running it. :)


therevills(Posted 2011) [#3]
Just confirming what Jim has put.

Yes you can use Monkey to develop programs on your phone (and any Android phone/device).

Once you've finished coding, enable USB debugging on your phone and plug it into your PC, then hit compile and run. Your code will be translated from Monkey to Java, compiled into bytecode then copied across to your phone - without you doing anything! ;)

(As long as you have downloaded the Android SDK and linked Monkey up with it of course :P)


Matty(Posted 2011) [#4]
Thanks for the quick response.

I may have to give it a go at some point...although am currently working on another project, I will keep it in mind.


Virtech(Posted 2011) [#5]
Hi

Is it possible to make the app automatically run on the phone as soon as the copy from pc to phone process is completed?


GfK(Posted 2011) [#6]
Is it possible to make the app automatically run on the phone as soon as the copy from pc to phone process is completed?


after you set up everything it's as simple as hitting compile then opening the applications menu on the phone and running it. :)


Last edited 2011


GaryV(Posted 2011) [#7]
Yes you can use Monkey to develop programs on your phone (and any Android phone/device).
I do not own monkey, so I could be wrong, but I think this is incorrect. Can't you only develop programs for your phone? Or has somebody ported the editor and "compiler" so you can develop programs on your phone?


GfK(Posted 2011) [#8]
You'd have to be insane to want to develop games on your phone. I think 'on' should have said 'for'.


Amon(Posted 2011) [#9]
I have a lesser model than the desire; HTC Wildfire S. After the initial configuration of monkey|mojo I code the game and test on the device with no problems.

I learnt this morning that I have to go in to the Applications menu to stop the game running, delete|uninstall it before being able totest a fresh copy. It's not tedious as it all works pretty quickly stopping and uninstalling my game.

I'm finding it difficult to go back to BlitzMax after using monkey|mojo. Coupled with the JungleIDE provided by Ziggy, the new language is a gem. I've learnt a lot also with the new coding style. For some reason it feels more natural; it did take me a while to transition to the coding methodology though.


EOF(Posted 2011) [#10]
I don't know about Monkey, but when using Basic4Android, after compile/run the app automatically runs on the phone (Galaxy S) connected via the USB. I have 'allow unknown sources' and 'USB debugging' on the phone enabled

Also, if the old version of the app is still running it is automatically closed and the new one opens. No "un-installing" or "installing" process is required


therevills(Posted 2011) [#11]
Is it possible to make the app automatically run on the phone as soon as the copy from pc to phone process is completed?


There should be - as Eclipse does it... must be in the ant file somewhere...

@Amon - you should only need to remove your game via the uninstall option if you need to change your savestate file, you could you null it out: SaveState ""

Last edited 2011


Amon(Posted 2011) [#12]
Thanks for the tips guys! Should be very useful. I'm new to Android phones having had my iPhone 4, still got it, still think it's the beez shiznalls and will never give it up. :)


Matty(Posted 2011) [#13]
Not sure I totally understand?

Do I need to download the Android SDK or can I compile with Monkey without doing so?

If I download the Android SDK do I also need the Eclipse thing they talk about on the Android SDK website?

I thought it was as simple as downloading monkey, compile on PC, copy to SD card and then run from phone?


GaryV(Posted 2011) [#14]
Matty: Monkey is not a "compiler", it is simply a source code translator. It translates the "monkey" source code to the source code required for the target platform. To compile the source code for that target platform, you need to use the compiler tools (SDKs, etc.) for that particular platform (and as specified in the requirements for monkey). Once those compiler/SDK tools are installed, you should be able to compile for most platforms directly from monkey (from my understanding).


_JIM(Posted 2011) [#15]
It's not THAT simple.

(Somebody correct me if the following is wrong)
Monkey, by default, can only do HTML5.
If you want to compile for Win, you need MinGW.
If you want to compile for iPhone, you need XCode (Mac, OSX, etc.)
If you want to compile for Android, you need Android SDK (no Eclipse)
If you want to compile for XBox/WP7 you need the XNA SDK.

It's not that hard to get it all set up though. And once you do it, you'll pretty much leave it like that until the moment to release your game comes (signing the apk, changing the icon, etc.)


therevills(Posted 2011) [#16]
You need the Java SDK as well as the Android SDK for Android, Flash requires the Java SDK too along with Flex. Oh and Ant!

With XNA, you need to install Visual C# 2010 Express and the XNA SDK.

This is from the "Getting Started" doc within Monkey:


Target platforms

This sections gives a brief overview of the various target platforms supported by Monkey, and provides instructions for installing the necessary tools and SDKs.


Note that in some cases the trans configuration files may need to be modified to reflect the installation paths of some of these tools. Please refer to the config.winnt.txt and config.macos.txt files in the Monkey bin dir for more information.



--------------------------------------------------------------------------------

The HTML5 target

HTML5 is an emerging standard for writing web based apps.


You will need:

An HTML5 capable browser such as Chrome, Firefox, Opera, Safari or IE9.


Notes

Print statements in HTML5 are redirected to window.console, which can usually be viewed by opening the browser’s Javascript console.


HTML5 apps use a ‘canvas; html element for graphics rendering. To change the size and layout of this canvas, you will need to modify the MonkeyGame.html and/or main.js files in the app’s .build/html5 directory.


By default, when using trans with the -run option to launch html5 apps, the OS’s default browser is used to view the output app. This behaviour may be overridden by modify the HTML_PLAYER path in the trans config file.



--------------------------------------------------------------------------------

The GLFW target

GLFW is a free and open source framework for creating native OpenGL apps.


GLFW apps use OpenGL for graphics and OpenAL for audio.


You will need:

(Windows) Microsoft Visual C++ 2010 Express: http://www.microsoft.com/express/Downloads


(MacOS) XCode 3.2.5: http://developer.apple.com/devcenter/mac/index.action


Notes:

On Windows, the MSBUILD_PATH var in your trans config file must be correctly set to use the GLFW target. Please see the trans tool for more information about the trans config file.


The GLFW target is for creating native C++/OpenGL apps. Native apps are likely to be the highest performance apps.


To modify the size and layout of GLFW apps, you will need to modify the config.h file in the app’s .build/glfw directory.



--------------------------------------------------------------------------------

The Android target

Android is Google’s hugely popular cellphone and tablet OS.


You will need:

Android SDK: http://developer.android.com/sdk/index.html


Java SE development kit 6: http://java.sun.com/javase/downloads/widget/jdk6.jsp


ANT 1.8 (Windows only): http://ant.apache.org/bindownload.cgi


Notes:

The ANDROID_PATH (Windows/MacOs), JDK_PATH (Windows) and ANT_PATH (Windows) vars in your trans config file must be correctly set to use the android target. Please see the trans tool for more information about the trans config file.


The Android download is just a 'setup' app - after installation you will prompted to run the SDK manager, which you will need to do to install the actual android SDKs. Make sure to install at least 'SDK Platform Android 2.1, API 7' and an emulator.



--------------------------------------------------------------------------------

The Flash target

Flash is a very popular web based platform by Adobe.


You will need:

Free Flex 4 SDK: http://www.adobe.com/devnet/flex/downloads.html


Java SE development kit 6: http://java.sun.com/javase/downloads/widget/jdk6.jsp


Notes:

The FLEX_PATH var in your trans config file must be correctly set to use the flash target. Please see the trans tool for more information about the trans config file.


To allow local flash apps the ability to access local files (such as images and sounds) without causing a 'security exception', you will need to modify Flash's global security settings. This can be done with an online app, currently here:


http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html


Use this to add the Monkey directory to the list of trusted locations, and don’t forget to add any other directories you may use to develop your own flash apps.


To modify the size and layout of Flash Monkey apps, you will need to modify the MonkeyGame.as file in the .build/flash directory.



--------------------------------------------------------------------------------

The XNA target

Games written for the XNA target will be able to run on Windows, XBox360 and Windows Phone 7.


You will need:

Visual C# 2010 Express: http://www.microsoft.com/express/Downloads


XNA Game Studio 4.0: http://create.msdn.com/en-us/resources/downloads


Notes:

The MSBUILD_PATH var in your trans config file must be correctly set to use the XNA target. Please see the trans tool for more information about the trans config file.


To be able to download XNA programs to the XBox360 or Windows Phone 7, you will need to join Microsoft’s developer program which currently costs about $100USD per year. However, you can still develop XNA programs for Windows free of charge, and run XNA programs on the Windows Phone 7 simulator.


To create a Windows Phone 7 project, you'll need to manually 'Create Copy of Project for Windows Phone 7' from within VC#2010 - right click on the 'MonkeyGame' project in the solution explorer to do this. Do this for the XNA project in your '.build' directory, not the project in the 'targets' directory.


To modify the size and settings of the XNA game window, you will need to modify the file Program.cs in the '.build/xna/MonkeyGame/MonkeyGame' directory.



--------------------------------------------------------------------------------

The iOS target

iOS is Apple’s OS for iTouch, iPhone and iPad devices.


You will need:

(MacOS) XCode 3.2.5 and iOS 4.0 SDK: http://developer.apple.com/devcenter/mac/index.action

Notes:

To be able to download iOS programs to actual iOS devices, you will need to join Apple’s developer program which currently costs about $100USD per year. However, you can still develop programs on the iPhone simulator free of charge.


To actually run a Monkey app on a real iDevice, you will need to manually open the output xcode project (.buid/ios/MonkeyGame.xcodeproj) in xcode, select 'device' as the target and build and run.


To modify supported device orientations - for example, to force ‘landscape’ mode for an app - you will need to edit the project’s ‘info.plist’ in xcode.




Matty(Posted 2011) [#17]
Thanks therevills - however I've downloaded Monkey demo, Apache Ant, Java SE SDK (from link above), Android SDK. I installed Java SDK first, then registered with Oracle. However every time I go to install Android SDK I get told I don't have the Java SDK on my machine....and it goes no further...


therevills(Posted 2011) [#18]
Hmmm is JAVA_HOME set in your windows environment variables?

You do know that the Monkey demo cant compile to Android - dont you?

Last edited 2011


Matty(Posted 2011) [#19]
Hi therevills...sorry while I've been spoiled by the luxury of blitz3d/blitzplus when it comes to writing code I have very little idea about windows environment variables, and the nuts and bolts behind coding some of this stuff.

I haven't actually gotten to the point of installing the Monkey demo, but I can see now that it won't be much use to me anyway (the demo) if it cannot compile for android. (Does that mean I cannot create a html5 program and put it on android with the android sdk/) - Yes I'm a real beginner at this sort of thing.



But my main problem is that the android sdk when I go to install it complains that the java sdk is not installed...yet I've just installed it. Maybe I need a machine restart, although it never asked for one...


Matty(Posted 2011) [#20]
Edit - What a dumb fix! - I googled the question and found all I had to do was click "Back" and then "Next" again and it fixed itself. Previously I'd just exited when it said it couldn't find it. Now that has got to be bad interface design!!!


therevills(Posted 2011) [#21]
all I had to do was click "Back" and then "Next" again and it fixed itself.


In the installation of the Android SDK?

Does that mean I cannot create a html5 program and put it on android with the android sdk?


With the demo you can only create HTML5 applications, which can be run on any HTML5 compatible browser, you can't use the HTML5 program with the Android SDK.

To create an application for the other targets (Android, Flash, XNA, GLFW, iOS) you need the full version.


Matty(Posted 2011) [#22]
Yes - the installation of the Android SDK. I'd already installed Java SDK, but upon attempting to install the Android SDK it complained initially that the Java SDK was not detected. First few attempts I simply quit the installation at that point. However after googling the problem - it is a common problem - the solution turned out to be, and was correct, to simply press 'back' at that point of the installation, then press 'next' and then the 'detected' status changed to 'detected' ...bizarre.

Thanks though for the information.

I had a brief look through the documentation of mojo in the demo - I could see the various image commands but I noticed that there does not seem to be any per pixel commands? eg writepixelfast etc..but that's a separate issue.


Blitzplotter(Posted 2011) [#23]
@marty, had exactly the same problem with the sdk,jdk