The story of the iOS game about quick reaction and steel nerves

In early April, I quit my job. From an excess of free time, I decided to write a game for iOS. A game about a poor cube, which is constantly pursued by other geometric figures. Real drama. The cube needs to hold out as long as possible without collisions. The prototype of the game was written in about 8 hours. In total, the development of the game took 3.5 months. What I have been doing all this time can be found below.


I used the cocos2d-swift framework. He is very popular and comfortable. Its advantage compared to SpriteKit is support for iOS versions below seven. The game was written simultaneously for the iPhone and iPad. For iOS 6+.

In order to be able to share a record, UIActivity is used. How to add sharing to VKontakte by default is well written in this article: .

In each round, the enemies have a random speed and direction of movement, but the total sum of their speeds is always the same so that the complexity does not float from round to round. The speed of enemies during the round gradually increases, but to a certain limit, so that the maximum result of the player is unlimited.

The scoreboard under the playing field always shows the player’s world rank. It is shown only for players who are registered in the Game Center. In addition to the result itself, the Game Center sends control data using a hash from the result, the date, and some string sewn into the code. The hash is sent in the context variable. Yes, I understand that this is not a panacea, but in my opinion it will help to identify the vast majority of fake results and delete them. 100% protection against a fake result in Game Center is impossible. This is not an online game and we trust the data received from a third-party device.

Code for moving the poor cube:
- (void)touchMoved:(UITouch *)touch withEvent:(UIEvent *)event {
    if (_gameStatus == kGameStatusStarted) {
          CGPoint currTouchLocation = [touch locationInNode:self];
          _hero.position = ccp(_hero.position.x + currTouchLocation.x - _lastTouchLocation.x,
                                                _hero.position.y  + currTouchLocation.y - _lastTouchLocation.y);
          _lastTouchLocation = currTouchLocation;

The main character moves around the playing field when a player moves his finger across the screen. If a player moves his finger a centimeter up in any part of the screen, then the cube will also rise by a centimeter. For the fastest possible response to the player’s movements, in fact, the cube is instantly teleported rather than moved. You can move your finger very quickly, you can fly the entire playing field in 1-2 frames at 60 frames per second. Here the tunnel effect manifests itself. Due to the fact that collisions are checked only 60 times per second, you can slip through the enemy and collisions will not occur. I went the simplest way. Increased the frequency of simulating all movements and checking collisions by 6 times. Why at 6? I just experimented with this coefficient and found that if you update all positions 360 times per second, then everything is already fine. Do more often just wasting CPU resources in vain. With a coefficient of 6, the CPU load increases by only 10%. In iOS, the current position of the finger on the screen is also issued 60 times per second, it is impossible to affect the polling rate of the touch screen. We are also not wise, just find 5 intermediate points between the current and the previous:

for (i = 1; i <= kPositionsUpdatesPerFrame; i++) {
  currNewHeroPosition = ccpAdd(_lastFrameHeroPosition, ccpMult(heroStartAndNewPositionsDifference, i / kPositionsUpdatesPerFrame));

Tunnel effect:



The previous illustration is the limit of my artistic possibilities. I found a designer on Freelance. The girl with kind and sunny drawings, whom I asked to mutilate the cube. The big plus was that she draws in a vector, so I had no problems with different resolutions of iPads and iPhones and minor edits. It cost 21,500 rubles. Plus 900 rubles for Adobe Illustrator CC for a month (trial 30 days ended and I accidentally closed the program).

Variations of beatings:

Variant of the icon in the pile:

Geometric shapes:

Music and sounds

Is music required in such a simple game? I think no. But I still decided that I want to add musical accompaniment. I listened to music in cool projects with millions of budgets and if I liked the music, then I was looking for a composer of the game. I chose two composers. One refused because of a contract with the company he works for, according to which he cannot write music for other mobile games, and the second (not by professionalism) agreed. Music cost about 14,500 rubles.

I picked up sounds in free and paid sound stocks. I advise these: and On, you can accidentally come across sounds that were used in Minecraft or Flappy Bird. And at there is a huge amount of good music and sounds for little money.

There are 2 switches in the settings: for music and for sounds. I often saw people asking for this option in other games.


Advertising is used for monetization. It can be turned off for a dollar. I immediately refused banners during the game. They take up precious space on the screen and add brakes to the game, especially on older devices.

The game uses full-screen ads from iAd, AdMob and Chartboost. In my opinion, these are the most profitable networks at the moment. AdMob, purchased by Google, supports not only its ad network, but also more than a dozen third-party ones, including Apple’s iAd. That is, it’s enough to implement AdMob, and through it already connect other networks, without understanding their documentation for hours on end. Chartboost is unfortunately not supported. For each connected network, you need to download an adapter from Google and add it to Build Phases -> Link Binary With Libraries.


The game is translated into 14 languages. I took the list of languages ​​in Real Racing 3 and added Turkish to it. Naturally, this should be the very last step, otherwise you are tormented to correct all translations if something changes in the game. In general, it is better to try to make everything clear without translation, if possible. Icons are our everything.

Translated on It is advisable to provide translators with exhaustive comments on each line, plus screenshots and videos, then everything goes smoothly and you do not have to long and painfully explain to the Chinese what is meant here. Translation cost 4,000 rubles.

After localization, a small problem appears. You will need to make a mountain of screenshots (in my case 210), and even fill them all in iTunes Connect. (2 iPhone resolutions + 1 iPad resolution) * 5 screenshots * 14 languages ​​= 210 screenshots. I think in the thirtieth screenshot I want to kill. UI Screen Shooter comes to the rescue for automatically clicking screenshots in all languages ​​and iTC Localized Screenshot Uploader for automatically uploading screenshots in iTunes Connect. Both projects are available on github. I made a special game mode for clicking screenshots, in which everything goes “on rails” and wrote a simple script for UI Screen Shooter, which presses on the screen, takes a screenshot, waits, then presses again and so on. 210 screenshots take half an hour. But the main thing is that everything is done completely automatically. Script for UI Screen Shooter:

#import "capture.js"
var target = UIATarget.localTarget();
var window = target.frontMostApp().mainWindow();
var model = target.model();
var delayFactor = 1.0;
if (model.match(/iPad/)) {
  delayFactor = 3.2;	
target.delay(2.5 * delayFactor);
target.tap({x:100, y:200});
target.delay(2.0 * delayFactor);
target.tap({x:100, y:200});
target.delay(2.0 * delayFactor);

The delayFactor coefficient for the iPad is obtained experimentally. I introduced it, because the Retina iPad simulator is terribly slow on my MacBook and all the delays have to be increased.

Publisher Search

I sent out information about the game to the following publishers: Chillingo, FDG Entertainment, Fingersoft, Wooga, KamaGames, G5 Games, Apps Ministry, Pocket Gems, Renatus, Big Fish Games, Game Insight. Some did not even answer. A couple of publishers asked to send them a test version.

One publisher became interested and said the game could be promoted to the top 10 free apps in several countries. All income in half.

Earnings in the game depends on the number of players entering the game during the day (DAU - Daily Active Users). Everyone knows that Flappy Bird made $ 50,000 a day. The daily audience of the game was 2 million players. After getting into the Russian top audience of the game will be 20 thousand people a day, which will bring $ 300-400 per day from advertising. Moreover, if the application has bad reviews, an unattractive icon or screenshots, and the application itself is about nothing, then after the end of the stream of paid installations the application will fly down from the top and the publisher’s investments will never pay off.

Be prepared to give 13-20 thousand dollars to be guaranteed to be in the free top 10 in the Russian App Store for one day. The numbers may vary, it all depends on the virality of the game, that is, on how people will advise the game. People who come on the advice of friends are free for you. If each user will bring one new user, then the application expects explosive growth. In fact, this indicator is almost always less than one. Buying installations to get to the top is not an expensive lesson. One installation will cost $ 1.5-3. Here virality is not taken into account, it is cheaper with it. Why is the goal to get to the top? I think it’s obvious that when the application gets to the top, it gives a huge amount of free installations, as people view these tops.

One player in a large and high-quality shareware game of type 3 in a row brings more than $ 3-4 for the entire time of his “life” in the game. Such a high average earnings per person in a free game is achieved not without the participation of the so-called “whales”, who can easily spend a couple of hundred dollars on in-game purchases in one game. With an advertising model, this is unrealistic. In the end, the publisher’s representative painted all the dealings and said that they decided not to take such a risk.

Interesting fact

From the evening of August 18 to the evening of August 23, all results sent to the Game Center disappeared approximately 30 minutes after sending. In all games. Apple recognized this fact only on August 22 at the developer forum. I received some feedback from the players that their records were gone. For my part, it was a mistake to trust the information that comes from Game Center. The results of some players reset to zero locally due to this problem. The main number of records received from August 18 to 23 returned to the results table. But not all.
Topics on the Apple Developer Forum:

Also popular now: