📜 ⬆️ ⬇️

Mobile development with Corona SDK

Hello!

I wanted to share my experience with Corona SDK - a cross-platform development tool for Android / iOS from Ansca Mobile (the founders of the company in the past worked at Adobe on Flash Lite). There are not so many articles about him here, although the engine is one of the most popular and for good reason. Corona SDK is designed primarily for developing games, but you can also write business applications in it - for this, the engine has a set of UI components with interchangeable styles. The main advantage of the engine is a significant increase in the speed of development for experienced programmers, as well as the reduction of the technical barrier for beginners in mobile gamedev. Continued under the cut ...


I have long wanted to try my hand at mobile development, without much desire to learn Objective C or Java and new large frameworks. I wanted to use the existing experience of a web developer. I did not immediately learn about the Corona SDK, and before it I tried Appcelerator Titanium, Sencha Touch, JQuery Mobile and PhoneGap. All these tools, however, do not provide sufficient stability and speed, especially on Android. Of these, the Sencha Touch + PhoneGap bundle is the most complete, but still not production ready. So…
')

Advantages and disadvantages


Pros Corona SDK:

+ development in a simple and elegant dynamic language - Lua
+ simulator allows you to see the changes made instantly
+ ease of setting up the working environment (just download the simulator and use the code editor of your choice, compilation takes place on a remote server)
+ compact and intuitive API
+ high-quality documentation from the developers of the engine
+ a large and active developer community (the amount of free help is really huge and it helps a lot in the initial stages + stimulates helping newbies when you already know something)
+ stability and speed of the engine
+ quick bug fixes by developers - for many, this is the weakest link (for example, with Titanium Mobile, my bug reports hung in a bug tracker for months, with Corona - from a couple of days to a couple of weeks)

Cons Corona SDK:

- license $ 200-350 / year (all of the above tools are free)
- the inability to connect third-party libraries written not on Lua (say, the module of the publisher of the game or the banner network)
- the speed-critical code will still have to be written on Lua, if there is no corresponding function in the API of the engine, or to find workarounds (they, as a rule, exist)
- some differences in the functionality of versions for Android and iOS (for example, payments within the application are supported so far only on iOS)

Pyro shelf

My first project was a puzzle game like Bubble Blast. Because Development with Corona is extremely simple, the biggest difficulty was the design. Everything had to be drawn from scratch. I did not have money for a designer. Therefore, half of all the time spent working on the project was boldly spent on this part. Think about the design first! Then it will be much easier.

Another difficulty - support for different screen resolutions. The schedule for each resolution has to be done separately, given the scale and aspect ratio. Why it is impossible to make graphics once in hi-res, and then only scale it depending on which device the application is running on? The fact is that the amount of texture memory in devices with a small screen resolution is significantly smaller, and the maximum texture resolution is also true (if you use sprites for animation). Therefore, it makes sense to release the first version of the application for iOS - only two permissions with the same aspect ratio (or three, if you take the iPad). With Android it is more difficult not only in this regard. Judging by the developer reviews, monetization of applications, both paid and free, is much easier on iOS. And after the success on iOS, it will be easier for you to declare yourself on Android.

Auxiliary means


A very small TexturePacker utility was very useful to me in the development. It allows you to automatically create sprite sheets and Corona-code for them from individual images, with scaling, trimming and many other options. Just can not imagine how much time I would spend asking the coordinates and dimensions of each image in sprite sheeet manually.

Sprite sheet

The same developer makes another useful utility - PhysicsEditor, which automatically creates the code for the physics engine Box2D used in Corona. Each program costs $ 20 (or $ 35 for a bundle), but it will save you more than one hour of time.

In general, for Corona, third-party developers have created many different tools, the most popular of which can be found here: www.anscamobile.com/corona/tools/?ref=nav

All code was written in IntelliJ Idea Community Edition with Lua plugin (both are free). After having tried many different editors, I settled on this. The developer did a great job on the plugin. Supplement actively developed right before my eyes, this summer. Support for debugger, modules, refactoring, and many other goodies has been added. And the integration with IntelliJ Idea adds even more. Once I accidentally deleted the folder with the project, and the last backup was made a week earlier. Thanks to the Local History function in Idea, which stores the history of all changes, I was able to restore the project when I was not hoping for anything.
For those who don’t like to use IDE, there are a lot of light editors, the most successful of which, in my opinion, is this Russian SciTE bundle for Lua .
But the use of IDE is fully justified. I had a few hundred files in the project - a little over fifty with code (half of which TexturePacker was automatically generated), more than a hundred with pictures, the rest were levels. Also, project search is a very convenient and useful feature of Idea. Even one function of highlighting scopes of variables is worth a lot!

Application monetization


With Android, you have two options - either sell your app or use ads. With iOS, you can add in-app purchases. InMobi is used as a content provider for advertising - the second largest mobile ad-network after AdMob. Just the other day, Ansca Mobile announced from cooperation with inneractive that it should give an opportunity to use any banner networks for monetization. However, for AdMob there has long been an unofficial hack (http://developer.anscamobile.com/forum/2011/10/17/admob-helper-module), used, for example, in a well-known free game like Blast Monkeys. From my own experience, both AdMob and InMobi have a very poor fill-rate in some countries, including Russia. Fortunately, the AdMob hack can be remade to work with any mobile banner network offering web integration. I recommend using AdSense for Mobile - there are no problems with fill-rate (banners are shown in 100% of cases) and higher CPC. Anyway, if you decide to use advertising to monetize your application, then you will have to face a number of adjustment difficulties. Sell ​​your game or additional levels to it is much easier.

Conclusion


In conclusion, I would like to note that in order to try the engine and even develop a game on it, you do not need to pay money. From anscamobile.com you can download it for free, after registering. You only have to pay if you decide to put your game on the market. The differences from the full demo version are small: longer compilation (subscribers get priority on time), the window when launching the compiled application notifies that it is a demo version, there is no access to daily builds (i.e. the newest chips and fixes). In fact, a full demo allows you to save money on a subscription while you are developing your application.

PS
Huge collection of text and video lessons: www.learningcorona.com
I liked the video lessons of Rafael Fernandez most of all - a very consistent and high-quality presentation. You can take money for them, but they are absolutely free.

Despite the excellent and fast simulator, you still need the real device in order to evaluate the performance. In addition, some things in the simulator are not supported. For example, web-popup to display web pages within the application or OpenFeint module (social network for gamers).

Source: https://habr.com/ru/post/134480/


All Articles