Experience creating a game for smartphones
Introduction
Most leaders in the field of mobile platforms are trying in every way to attract developers to their camp. To do this, they offer various APIs and SDKs for creating their own applications, which, according to them, should bring good profit, if not financially, then at least in the form of experience gained.
Check whether this is so, it was decided on their own experience.
Idea
The main criterion for the new application (game) was its novelty in the market. Having spent some time thinking, one puzzle from a school age came to mind. Its essence is simple - you need to visit all cells of the field 10 by 10, making a move with a chess horse. You can start the movement from any position. Previously, this problem was solved using a notebook sheet in a box and a pencil. But now, in the era of computer technology, this can be transferred to a more convenient form.
Having a little imagination, the puzzle was modified as follows:
- The field can be any (including with missing cells). Due to this, you can come up with puzzles of varying complexity
- When passing the level there is an opportunity to begin to cancel the moves, “paying” for it with life.
- Added the type of cells that you want to visit on a certain move
Since I am mainly related to Microsoft technologies, such as Silverlight or WPF, I decided to implement the game for Windows Phone . However, I also wanted to be able to easily port the application to other platforms, so JavaScript and HTML were chosen as the main tool for implementation. At the time the development began, there was no deep experience with these technologies, but it was very attractive for the cross-platform capabilities that, for example, Phonegap can provide with the approach used.
Implementation
About 1-2 months were spent on the implementation due to employment at the main job and frequent changes to the already implemented functionality. The foundation for the application was the jQuery Mobile mobile framework , for which there are a large number of plug-ins for working with user interface animation, as well as for automating other frequently occurring tasks. For example, the Flip plugin was used to animate visiting a field cell , and simpledialog2 was used to display pop- ups . The library itself allows you to quickly create markup that will be appropriately displayed on your mobile device.
The first version used only the capabilities of HTML and Javascript and fully worked in the browser. True, in each browser it’s different =)
In addition to the fairly
function stGet(name)
{
return $.jStorage.get(name); // Получаем данные через плагин
// return localStorage.getItem(name); // Стандартный localStorage
}
Another inexplicable feature was that the stGet function described above returned null for the “settings.hints” parameter and “null” (string) for “settings.language”. This behavior was repeated regardless of the use of the JStorage plugin or localstorage. I suspect that the problem is in the local computer, but there was no time to check this, so I just used the checks of both options to set the default parameters when I first started the application.
Another difficulty was the desire to immediately support the English and Russian versions. There are several solutions to this problem on the network, but for my task they did not work properly. I wanted to change the language of the entire user interface of the application at the click of a button. At this stage, it turned out that it is quite useful to describe HTML markup not statically, but dynamically assembled using JavaScript. In this case, you can rename the controls without any problems. In this regard, once again I had to rewrite the already implemented functionality. But, as they say, “the end justifies the means” and the task was solved.
From the point of view of the implementation of the game itself, it is difficult to single out any interesting points, so I will not go deep into their description. The main points are the generation and drawing of the field, the processing of clicking on the cell, checking for the possibility and necessity of visiting the field, checking for victory or defeat, etc.
Windows phone
Windows Phone (WP), starting with version 8, supports HTML / JS applications and does not require the use of third-party frameworks (such as PhoneGap). To run the application on WP8, you must open it using the WebBrowser control.
In order to post the implemented game in the Windows Phone MarketPlace, it had to be supplemented with the “Rate” option to evaluate the application and add processing for pressing the “Back” button on the device. Due to the lack of a last opportunity, the first certification of the application in WPStore was failed.
To add the described features, a “bridge” was used between the WebBrowser control and the side written in JS. Everything is implemented quite simply:
- through a combination of the Browser_ScriptNotify event and the window.external.notify ("...") method to call code that can work with the WP8 API
- via Browser.InvokeScript ("...") to call Javascript code that can control the developed application
Also, to register the application, it was necessary to prepare screenshots. Making them was pretty easy with the emulator included with the WP8 SDK. A name, description, keywords for search were invented and other necessary procedures were done (obtaining a PEGI license, registering a bank account). What happened can be seen in the picture, and the application itself is available in MarketPlace.
Conclusion
At the moment, the application is paid and contains 10 levels. In the near future I plan to make a free version with fewer levels and a link to the paid version. Then I port it for IPhone users. The application is already successfully launching on iOS, it remains to test it and figure out how to publish it in the AppStore. During the development, a huge amount of experience has been “google”. As for the financial part, I can’t say anything yet.
PS: Since the game is paid, and this article is in some way its PR, I do not indicate the name and link anywhere.
UPD: Thanks for the good advice to the readers. Here is a link to the game. For some reason, it does not work stably.
UPD2: The application received a trial version. The link is the same.