вторник, 18 июня 2013 г.

Android Development For Beginners AND Advanced

Nowadays mobile technologies are extremely popular. Especially such platforms as Android and iOS. But how to develop ? Usually development for Android is knowledge of JAVA and for iOS - Objective C. But is there an easier way ? Certainly YES. And here I will try to list some of the most popular and simple ways to develop on Android OR/AND iOS. Lets divide this into some categories:

1. Native NetBeans/Eclipse/IntelliJ IDEA (JAVA) / xCode (Objective C)

2. Browser based JavaScript, HTML5 and CSS3 editors / JavaScript, HTML5 and CSS3 standalone pc programs

3. Other native tools (similar to number 1)

Let' stake a look at number 2. Many of such programs uses PhoneGap. PhoneGap is an open source framework and a cloud based service to build cross platform applications. So write once , build to all. There is support of the following platforms:
iOS, Android, webOS,Windows Mobile, Symbian,BlackBerry and Windows Phone 7. It is great BUT with phonegap you get web application written in JavaScript, HTML5 and CSS3 so the speed for complicated apps/games can be slow , also you haven't access to all SDK functions.

Mobile web frameworks:

Example of browser based mobile app creators:
Codiqa (uses jQuery Mobile)

Example of standalone JavaScript, HTML5 and CSS3 mobile app creators:
IBM Worklight (Uses PhoneGap)
NS Basic (uses Visual Basic and compiles using PhoneGap , supports jQuery Mobile)
Adobe AIR
LiveCode
Intel XDK (AppMobi)

P.S. HTML5 games can be accelerated by GPU in two ways:
       1.Hardware accelerated canvas (CocoonJS)
       2.WebGL (CocoonJS now also supports it)

Number 3. Other Native tools.
Tools that are much easier for beginner and powerful for advanced users and which produces native code exactly the same or nearly the same as number 1 options.
Very simple app originally developed by Google , now belongs to MIT and uses scratch similar language and visual blocks. It is good for beginner but not very good for advanced users. It is very limited in possibilities.
Uses KAWA framework to compile to native Android app.

Delphi XE5

Full featured IDE with a lot of libraries. Uses Visual Basic similar programming language. Very simple for beginner and very powerful , extensible for advanced users. There is visual layout editor , no more XML. Of course you can program your layout in code if you want. Network , maps , JSON , XML , advertising (Admob , MoPub and so on). It is really great IDE with great community. All apps that you see on this blog developed with B4A. The final APK is exactly the same as if it done in Eclipse/JAVA.

Another Basic implementation for Android

Cross platform app creator

HyperNext Android Creator
Native Android development system

Cross platform development environment

Implementation of .Net platform on android. Let's consider this native tool but the speed can vary

Andromo
With Andromo, anyone can make a professional Android app.There's no programming required, plus Andromo generates 100% pure native Android apps

Android Assets Generator

For Android app or game you need graphics and all images must be for varius densities. There are:
Small ldpi        ~10% (240x320)     0.75  2"-3.5"     120dpi
Normal mdpi   ~16%  (320x480)    1.0    3.6"-4.9"  160dpi 
Normal hdpi    ~37%  (480x800)    1.5    3.6"-4.9"  240dpi
Normal xhdpi  ~25% (720x1280)    2.0   3.6"-4.9"  320dpi
Large  xxhdpi              (1080x1920) 3.0        5"        480dpi

So you need graphics for 5 densities : 120 , 160 , 240 , 320 and 480 dpi.
Manually doing this is nightmare but I found very useful script for generating Android graphics automatically though Adobe Photoshop scripting. It generates all assets from XXHDPI source , so you will get the best possible quality for all densities. I suggest you to make graphics in Adobe Illustrator then export it to Photoshop and make size which you need for 480dpi , or if you don't know it size you can make an image for 1.0 scale factor (320x480) then multiply to 3.0 and so you know the size you need for XXHDPI image.

Then the following steps are required:
1. Make directory C:/ANDROID_IMAGES (I have slighty modified script to point to this folder because there can be problems with various names of folders , if you have problems with UAC then you can change in script to any drive letter you want)
2. Place your XXHDPI image into this folder
3. Run script

Thats all , you will get all android images for all densities sorted into folders.
So here is script , you must save this into file with extension .jsx :


// Output Android Assets.jsx
// 2012 Todd Linkner
// License: none (public domain)
// v1.0
//
// This scrip is for Photoshop CS6. It outputs Android XHDPI, HDPI, MDPI,
// and LDPI PNG assets from XXHDPI source files. The resulting PNGs will be
// placed in sub-folders within your target folder.

/*
// BEGIN__HARVEST_EXCEPTION_ZSTRING
<javascriptresource>
<name>$$$/JavaScripts/OutputAndroidAssets/MenuAlt=Output Android Assets</name>
<category>mobile</category>
</javascriptresource>
// END__HARVEST_EXCEPTION_ZSTRING
*/

// bring Photoshop into focus
#target photoshop

main();

function main() {

    var cleanup = confirm("This script outputs Android XHDPI, HDPI, MDPI, "
                        + "and LDPI PNG assets from HDPI source files.\r\r"
                        + "Do you want to delete your original files when "
                        + "complete?");
 
    // Ask user for input folder
//var inputFolder = Folder.selectDialog("Select a folder to process");
//if (inputFolder == null) throw "No folder selected. Exting script.";
    var inputFolder = Folder ("C:/ANDROID_IMAGES")

// get all files in the input folder
var fileList = inputFolder.getFiles("*.png");

// Make output folders
var dirxhdpi = Folder(inputFolder+"/drawable-xhdpi");
if(!dirxhdpi.exists) dirxhdpi.create();
var dirhdpi = Folder(inputFolder+"/drawable-hdpi");
if(!dirhdpi.exists) dirhdpi.create();
var dirmdpi = Folder(inputFolder+"/drawable-mdpi");
if(!dirmdpi.exists) dirmdpi.create();
var dirldpi = Folder(inputFolder+"/drawable-ldpi");
if(!dirldpi.exists) dirldpi.create();



// Open each file in turn
for (var i = 0; i < fileList.length; i++) {
// Open file
open(fileList[i]);
// Make XHDPI
resize(dirxhdpi,'66.7%');
// Make HDPI
resize(dirhdpi,'50%');
// Make MDPI
resize(dirmdpi,'33.3%');
// Close and do not save
// Make LDPI
resize(dirldpi,'25%');
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
// Delete the original
if (cleanup) fileList[i].remove();
}
    alert("Done!");
}

function resize(dir,percent) {
    // Setup file name
    var fname = app.activeDocument.name.replace(/\s+/g, '_').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();

    // Set export options
    var opts, file;
    opts = new ExportOptionsSaveForWeb();
    opts.format = SaveDocumentType.PNG;
    opts.PNG8 = false;
    opts.transparency = true;
    opts.interlaced = 0;
    opts.includeProfile = false;
    opts.optimized = true;

    // Duplicate, resize and export
    var tempfile = app.activeDocument.duplicate();
    if (undefined != percent) tempfile.resizeImage(percent,percent);
    file = new File(dir+"/"+fname);
    tempfile.exportDocument(file, ExportType.SAVEFORWEB, opts);
    tempfile.close(SaveOptions.DONOTSAVECHANGES);
}

Android 2D/3D Game Engines

I wanted to choose some 2d game engine for creating 2D Space Shooter . It can be done for example in B4A but there it is more difficult because you must programming directly into Open GL ( note: look into Basic 4 Android - it is really great IDE for Android applications) or using accelerated surface/gameview which is good but not so powerful as full featured game engine. So I read a lot of info about game engines and made some notes about them. I didn't include Unity 3D or Shiva 3D because these engines are very good for 3D but for 2D I think it must be special engine.  Also I will list some game makers which has not only built-in game engine but also visual editor to make games with just no programming skills. So there are:

2D/3D Game Constructors:
Construct 2
Stencyl
GameSalad
Game Maker
Multimedia Fusion 2
Engine 001
Enigma Development
3D Game Studio
Game Editor
Tululoo Game Maker
GameDevelop
Wintermute Engine

2D Game Engines:
Marmalade
LibGDX
AndEngine
Corona
Gideros Mobile
Cocos-2D
Torque 2D
MOAI
App Game Kit / Freedom Engine
GLBasic
Emo Framework
Monkey (Blitz Basic)
Unity 4.3 and Up
Dreemchest
ImpactJS
Isogenic Engine

3D Game Engines:
Unity
Shiva 3D
JPCT-AE
JMonkey
SIO 2
UDK
Ardor 3D
Unigine
Havok Anarchy Project


For me I choose Gideros Mobile because it is very fast , more faster than Corona , it is LUA engine , LUA is very simple and fast. Gideros exports your project to Eclipse or xCode and there you can compile to its platform offline. Corona compiles on their own server. Gideros is free , there are paid versions but only if you want to remove their splash screen "made with Gideros". Gideros has wonderful particle engine , also various plugins for advertising.

Very good engine also is MOAI but it is more complicated , very powerful. It is completely free.

Zen Stories

Simple application contains zen stories . Feel the wisdom of teachers of the past. Zen is a school of Mahayana Buddhism that developed in Ch...