Wiebo de Wit's thoughts about game development and more…
Category Archives: Monkey
It been a while since my last post, so here is one, finally. These days I am enjoying my vacation, but I have also been posting on Google+, and not here. Sorry. Reading has also been one of my pastimes. I read the Dark Tower series and am now working through the latest book in the Game of Thrones series. Great books, and I still love my Kindle.
Some time ago I bought Monkey and put it away for a while while finishing Trapped. With that game out of the way and after taking some time off programming it is now time to go and make something with it.
But first I need to get to know the Monkey language a bit more and try to make my own modules to make programming life easier. Also, as my main platform to make stuff for will be Android, I took some time to get to know that OS from a development point of view. Also, as Monkey takes a lot from the Java language I decided to get to know that language better as well. So far, so good. Delving into Java has made Monkey more clear to me as well and the Google Android tutorials are really good at explaining how a typical Android project is constructed.
So I am slowly creating some small things with Monkey. I intend to make some kind of game framework, based on the structure of the RRFW framework, but stripped down to the bare essentials and optimized for use on mobile.
The first thing I am attempting to create though is a decent unit testing framework, so I can create my stuff with TDD in mind. The lack of reflection (run-time inspection of objects) is making it a little cumbersome to set up but it is working. I am happy.
I created a Google Code page for my Monkey modules. You can find it over here. So far only the unit testing module code is uploaded.
Other than the joy of discovery I have no set plans for my Monkey development. I have a game idea or two I want to try out but that will have to wait until I have some decent game structure running.
I am finishing my game so I though it is time to go out and set up my new development system. The idea is to go and make fun stuff on the Android platform! Are you with me!? Of course you are!
This post describes how to get Monkey ready for Android development. I want to mention beforehand that I am a total Java and Android development n00b, so when you read dumb stuff, tell me, ok? Thanks. Of course, there are loads of blog posts about setting up the Android SDK but these posts will be written from a former Blitz Max and new Monkey user development viewpoint.
I am using Windows 7, x64, SP1. I will be installing Monkey in D:\Monkey\MonkeyPro38, and I have a folder called D:\TargetSDK for all the SDK software. Here we go…
First, download the needed software. Here is a list of the needed components and their current version numbers:
- Monkey : Pro 3.8
- Android SDK: r10
- Java SDK, (32 bit version, even if you have a 64bit OS!!): 6u21
- Ant building tool: 1.8.2
After installing Monkey, its time to get the target platform up and running. First up is the Java SDK. Ugh, I never expected to install Java on my machine, but we need it! Start the installer. I installed the SDK in the folder D:\TargetSDK\Java\jdk1.6.0_25.
After installing the SDK, the JRE (Runtime Environment) is installed. Use the default path for this.
Next up is the Android SDK. Start the installer. I installed in the folder D:\TargetSDK\android.
If the Android installer is telling you it cannot find Java, press Back and then Next again. It will now find it. After installation, the SDK Manager will offer you a list of packages to download and install. Install the Android versions 2.1 and up.
The SDK Manager will tell you it cannot find the path to Java, so add that as suggested to your Path variable.
Next up: Create an Android Virtual Device (AVD) on which we can develop and test our programs. This is not necessary, you can put your compiled .pka on to your phone and test there, but for quicker testing this might come in handy.
It is important to remember that the next time you start the manager, make sure you start it as an Administrator.
We now install Ant. It is what builds our Android Java code. ANT comes in a zip file so extract it where you want to. I used D:\TargetSDK\apache-ant-1.8.2\
Now we must tell Trans (a Monkey component) where to look for the three SDKs we just installed. Let’s go to the monkey\bin folder and locate the file config.winnt.txt.
Create a copy of this file and then open the original.
Let’s add in the Java SDK path. We installed Java in D:\TargetSDK\Java\jdk1.6.0_25, so add the line: JDK_PATH=”D:\TargetSDK\Java\jdk1.6.0_25″
And now the Android path: ANDROID_PATH=”D:\TargetSDK\android”
Add the Ant path as well: ANT_PATH=”D:\TargetSDK\apache-ant-1.8.2″
Comment out the obsolete Ant, Java and Android paths. Save the file.
Trans should now be able to find the installed SDKs and ANT and use them to create Android .APK files. Using this setup I was able to build and run an application in the Android emulator. Huzzaa!
Some handy tips:
- The Android emulator must be running when you press that compile button otherwise the program is not installed on the device.
- NO SPACES IN YOUR PROJECT PATH AND FILENAMES. You will get an error message from Ant.
I will be diving deeper into Monkey and Android development in the coming weeks. It should be interesting.