Setup the build environment
The wiki has a tutorial for that too (it is right here
), but I tried to follow it step by step at first, and found some steps to be missing, and it is based on the new Android Studio by google, based on IntelliJ Idea.
I found Android Studio to be not mature enough yet, and I have over 10 years of experience with eclipse, so I prefer using the eclipse ADT bundle
. This guide will be based on this tool.
Let's start with the inventory. You will need:
- A working computer. You don't need an hardcore gamer rig, just not too old one. I would recommend at least an "Intel Core 2" or similar CPU, with at least 2 GB of RAM. If you plan to use the emulator (not a real Android device connected to your computer), make that a Core i5 with 3 GB of RAM
- The eclipse ADT bundle
- An archive manager, like winzip, 7-zip, or your OS's integrated archive manager (Windows as a poor but capable built-in Zip file management)
- A Java Development Kit (JDK) available on Oracle's website
- A working brain...
and optionally (not mandatory, but can make your life easier):
- A good text file editor, like Notepad++
- The GIT stand alone tools
- Tiled, the map editor
- An internet connection. It is "possible" to do without it (I did on one machine once) if you can download the binaries somewhere, and transfer them to your computer afterwards.
- If on Windows, MobaXTerm. It's a neatly packaged way of getting most unix tools on windows.
- A GitHub account. You could do without, and I will generally give instructions for both with and without
If you plan to contribute code and/or integrated content, the GitHub account becomes mandatory. Once registered, go to my repository on GitHub
and click the "Fork" button, to create your own repository for Andor's Trail.
Now, we will set up your computer.
If you don't have one already, install the Oracle Java Development Kit.
Unzip the eclipse ADT bundle in a directory of your choice. This should create a folder named adt-bundle-<OS Name>
-<CPU Architecture, i.e. x86>
-<build date in the format YYYYMMDD>
. For example, mine is adt-bundle-windows-x86-20130729.
Remember this location, as I will refer to it as your "ADT bundle install dir"
or "ADT root"
Create an empty folder to be used as your "workspace". Create it wherever you want, depending on your setup. I generally create it under the "My Documents" folder, or under my "home" folder on Unix-type of systems. Give it a meaningful name, I use "adtworkspace", but you can use "android_projects" for example...
Also remember this location, as I will refer to it as your "workspace"
Now, open the ADT root folder (see, I told you I would refer to it !).
You should have two folders and one file inside it. The "eclipse" folder contains the code editor and the "sdk" folder contains the stand-alone, android-specific tools. The "SDK Manager.exe" file is a tool allowing to download new versions of the android SDK, new images for the emulator, and various other things that won't be used for Andor's Trail.
Open the "eclipse" folder, and start "eclipse.exe". After a short loading, Eclipse should prompt you to select your workspace. This is where you select your newly created workspace folder... pretty trivial huh?
Once eclipse finished loading, close the "Send statistics" window and the "Welcome !" tab. You should be presented with a window full of tools, buttons, panels.... pretty scary if you've never seen an IDE (Integrated Development Environment). Fear not, you will quickly see what really matters.
On the left of the window, you should see the package explorer, this is more or less like a file browser, but smarter.
The biggest part in the middle is the editor view. When you'll open files for editing, that's where they'll show up.
The bottom part is some kind of feedback area. The different tabs will show you information from different tools : errors in your code, console output of the game... we'll get to it later.
Right-click somewhere in the package explorer (on the left of the window. Click anywhere in the middle of it), and select "Import...".
Then, in the window that popped up, under the "Git" folder, select "Projects from Git" and click "Next".
Select "URI" and click "Next".
In the "URI" field, enter one of the following:
<your github username>/andors-trail.git (If you forked my repository)
(If you didn't fork my repository)
In the "host" field, enter accordingly to the URI you used (should be filled automatically anyway):
In the "Repository path" field, enter what's after the ".com" in the URI, that is, respectively (should be filled automatically anyway):
- /<your github username>/andors-trail.git
In the "protocol" field, select "https".
Then, fill the "Authentication"'s section "User" and "Password" with your GitHub credentials, or leave it blank if you're using the Google Code URI.
You will be presented with a list of branches to select. Make sure that you have at least "master" selected, and click "Next".
Finally, for the "Local Destination" configuration, select a local directory (I use <workspace>/andors-trail), "master" as initial branch, and "origin" as "Remote name". Click next, and wait while eclipse retrieves the files from Git. Now, make sure that "Import existing projects" is selected, and click "Next". Finally, untick both "AndorsTrailEdit" and "ProjectPage" and click "Finish".
You should now see in your package explorer the "AndorsTrail" folder containing the very latest source code for Andor's Trail! Congratulations!
Unless you are very lucky, you should see in the "Console" tab at the bottom (remember, the "feedback area") a message in red like the following:
Code: Select all
[2014-01-22 11:48:43 - AndorsTrail] Unable to resolve target 'android-19'
This means that you do not have the android SDK that matches the one currently used by Andor's Trail.
Note what target the message references. In my example, it is "android-19", meaning I need version 19 of the SDK.
If you are lucky, and do not see this message, you can be sure it will appear someday when we upgrade the project to a newer one. So read the next steps anyway.
Open the ADT root folder, and launch "SDK Manager.exe".
It will connect to the internet, to google servers, and fetch the information about what releases are available, what plugins are available.
If you want to know more, I suggest that you read the SDK Manager documentation
, and more generally find information about "SDK Platforms" and "System Images".
If the download is successful, you should see a folder named "Android 4.4 (API 19)". That's the one we need (android-19, API 19, do you see the connection?). Expand this folder, and under it, and select the "SDK Platform" (tick its checkbox).If you plan to use the emulator, follow the next steps:
Find the latest SDK version that has a line with "Intel x86 Atom System Image", and select both this line, and the corresponding "SDK Platform".
Then, if you have an Intel CPU with virtualization extensions (Intel VT-x) and are running Windows or Mac OS X, at the bottom, under extras, select "Intel Hardware Accelerated Execution Manager".
Click the "Install packages..." button to download and install the items selected.
Finally, run <ADT root folder>/sdk/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe and follow the instructions.
Back to eclipse, click the "Android Virtual Device Manager" button (looks like a smartphone with an android face on screen).
In the "Android Virtual Device Manager" window, make sure that the "Android Virtual Devices" tab is selected, press "New...", and fill the fields this way :
Code: Select all
AVD Name: as you wish. Make it recognizable. "avdevice0" works for me.
Device: depends on the power of your computer, and your preferences. I use "3.2'' HVGA slider (ADP1) (320x480: mdpi)".
Target: the one matching your "Intel x86 Atom System Image"
CPU/ABI: You shouldn't have the choice, but just in case, select "Intel Atom (x86)"
Memory Options: RAM : 512, VM Heap : 16
Internal Storage: 200MiB
SD Card: Size 10 MiB
Now press OK.
Check that it works by selecting your new AVD in the list, and pressing the "Start..." button. It could take a while for it to completely start.If you plan NOT to use the emulator
Make sure that your device enables remote debugging. On mine, it's in Settings->Developer Options->USB Debugging. If you can't find it,look for some help specific to your device on google.
Make sure you have your device's drivers installed on your computer.
Connect your device to your computer with an USB cable.
Open a command line (shortcut Windows+R, type "cmd", press enter), and type the following (adapt the folder names and drive letters):
Code: Select all
D:\> cd ADT_root_folder\sdk\platform-tools
D:\ADT_root_folder\sdk\platform-tools\> adb devices
You should see a line showing your device. If not, look for help.Note:
the emulator is way slower than a real device, even an old cheap one. A good alternative is an Android x86
VM, in VirtualBox, VMWare Workstation, or whatever. It's pretty easy to set up and gives great results. Google for help if you need.Note 2:
you can do both, and select at runtime whether to run Andor's Trail on your device, the emulator, a VM, or several!Warning:
running Andor's Trail this way on your device will overwrite the Google Play version, and can mess up your saved games. Make sure to do a backup of your saves, and remember to reinstall Andor's Trail from Google Play once you're done. I even had to delete the debug app from Google Play to reinstall it.
Alright, you should have everything you need to start Andor's Trail.
Press the "Run" button in eclipse (looks like a Green "Play" arrow), it should prompt you to select a physical device and/or AVD. After a few seconds (or minutes), Andor's Trail should start automatically. If not, try to launch it manually (it sometimes happens on my x86 emulator image).
If you are using the emulator, do not try to start a new game. Andor's Trail loads all the content at startup, and in v0.7.0, this content is huge, and several hours could not suffice... you would be looking at a never ending "Loading..." screen.
Anyway, at this point, your environment is set up basically. You have all the basic stuff to run/debug/edit the game and the contents to your liking.
There are a few other things you could do to make your life easier, but I will not describe them step by step. Consider this an exercise for the reader!
- Configure Eclipse to open the .tmx files with Tiled.
- Customize the view in eclipse by opening/closing/moving/resizing the "views" (hint : Window->Show View).
- Configure the Git stand-alone tools to view your Andor's Trail project from eclipse in the Git stand-alone tools.
- Get familiar with the adb command line tools.
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2