Hello dear reader. In this note I will describe my experience of creating the first game for Android mobile phones. Many people like this story, I think it should be published. This is not a success story, but I think many novice developers will understand where to start and what to do to create a simple game. I will definitely describe my mistakes, and what could have been done better.
May Jamie Hewlett and Alan Martin forgive me for publishing excellent Tank Girl art without their permission
Sometimes you get into a state where you want to create something so that everyone gasps and says with their mouths open “You’re awesome“. This story happened to me in 2011, when I watched a fragment of the film “Tank Girl” and was inspired by the idea of creating an arcade game in a comic style.
Why Android and not iOS? The reason is simple – I didn’t have a Macintosh or an iPhone, but I had a great desire to support Linux on mobile phones. At that time, I liked the FSF ideology, and Richard Matthew Stallman was my god.
Linux Hackers Song. Before you sing – believe in world peace
At the time of development, the latest version of Android was 2.0, and it was also necessary to leave support for older versions, since there were a lot of 1.6 users. Many phone manufacturers did not even release updates to version 2.0.
I immediately set a time frame for the implementation of this project – one month. During this time, it was necessary to improve my knowledge of Java, study the Android SDK, Eclipse, meet the monster in the face of OpenGL ES and put it on both shoulder blades. On the graphics side, it was necessary to create about six 3D models optimized for mobile phones. It was also necessary to release the project for gold in the Android Market, at that time Google Play was called that)
jPCT-AE бесплатный 3д движок для Андроида
Since there was little time, it was necessary to choose a ready-made 3D engine. It is possible to create your own engine from scratch, but it is not very productive, since most of the time will be spent on testing and compatibility with all devices. Before the arrival of Unreal Engine, Unity, ThreeJS (HTML5), the leading engine was JPCT-AE. The engine was supplied as a ready-made java library, supported old versions of Android. Also, its creator EgonOlsen promptly deals with support and fixing errors at the request of developers.
Frames decide everything – hooligan Anton agreed to write music for the game. I have always admired his creativity, his work served as a locomotive driving the entire gameplay, forcing the user to play until the last downed helicopter.
So much stuff, where to start? You need to start with installing the Android SDK. Now it comes with a built-in IDE – Android Studio. But at that time, the IDE and SDK were supplied separately. According to the documentation on the Google website, I installed the Android SDK, Eclipse. The necessary packages for Eclipse were also installed to ensure the assembly and launch of the Android emulator. An hour later, I built a test project jpct-AE:
That was wow! But in the phone emulator everything was very slow. Therefore, it was decided to buy a phone on the Android platform. For these purposes, LG Optimus One P500 was purchased. Since then, I have not used excellent Nokia push-button phones on the Symbian platform) There were problems connecting the phone to Linux, if someone still encounters them, then check the udev settings.
Jobs quotes Pablo Picasso
After watching Alien Runner, I realized that the alien could be replaced with a motorcycle and two punks with a bazooka, the clearing around could be turned into a metropolis, and the fog could be replaced with the night from Iron Maiden’s ballads.
How to make 3D models? It’s very simple, open a lesson on creating low-poly models on YouTube and do it. The whole process consisted of outlining projections in a 3D editor. I found drawings of an Apache helicopter, and made a model of the helicopter. Textures were taken from open sources of the US Army.
Why do you need a helicopter in a game with two punks and a bazooka? When I played the prototype, I noticed that the player can just stand still and score points. The ideal solution was a helicopter that flies in and throws submarine torpedoes at the player, preventing him from stopping.
In mobile applications and games of that time, the problem of lack of memory was acutely expressed, both on the phone itself and in the RAM. Performance was also a C. One ARM processor with a frequency of 300-500 MHz. As a result of testing on friends’ phones, it turned out that HTC has twice less video memory than LG, 8 MB and 4 MB so-no, because of which the game knocked out memory limits and did not start. All resources were compressed to the point of getting a frame rate of 30 frames per second, and the ability to run on almost everything.
Do not repeat!
In Alien Runner, control was carried out by pressing the screen. This type of control seemed inconvenient to me, so I implemented control using the accelerometer. That is, you turn the phone – the motorcycle turns. I liked it so much that I even added a first-person view, for the bravest.
I needed support from the developer of the jpct-AE engine when I noticed that the shading in the front disappears in the game. This happened after minimizing and maximizing the application. I created a topic on the jpct-AE forum and in two days the problem was solved. I integrated the corrected version of the engine into the game.
There was also the question of how to implement an infinite supply of cars. For a mobile game, it was necessary to come up with a way to ensure that cars were added to the game scene FAST. The option of loading from slow memory or an SD card was immediately rejected. A design pattern called an object pool came to the rescue. When a car went out of sight or was destroyed, it was turned off and at the moment when it was necessary to supply a new car to the beginning of the scene – it was turned on and placed there.
Well, the day of release has come. The game has been tested, a preliminary demonstration to friends has been held, now it was time to go gold on the Android Market. Registration in the Android Market cost $20, paid. A description, screenshots have been added. And at that moment I realized that I needed to record a video.
How to record a video for a mobile project? Should I really shoot it on a mobile phone and then upload it? The solution was interesting, I used an Android emulator, played a game with a frame rate of two frames per second, recording everything that happened on the screen using a program called something like gtkDesktopRecorder. With the help of VirtualDub, the video speed was increased to 30 frames per second. Then, in the best video editing program – Windows Movie Maker, I added all the game sounds and music.
Now came the moment of mistakes. Nothing was invested in the promotion of the project, no effort, no money. I then thought that the project would pay for itself. The game went gold, I created a topic on the jpct-AE forum about Mad Racer. I got 12 installations for a dollar in two weeks. And I found the game in free access on a bunch of warez sites the very next day.
Singing the FSF song “Share the software” I decided to make a free version, with advertising. The game was transferred to the AdWare category, an advertising banner from the AdMob network appeared at the bottom. Integration with the advertising system went smoothly. In a month, the game was installed on ten thousand devices. I received $50 from the advertising network.
In general, don’t forget about advertising, I think that it should be one of the main items of expenditure for your project.
On the positive side, I want to note that I got a job as an iOS developer in one of the best companies in our city. And of course, invaluable experience.
Ссылка на Google Play
If you liked the article, repost it on VKontakte, Facebook)