📜 ⬆️ ⬇️

The story of the creation of iOS games about fast 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 shapes. This drama. The cube needs to hold out as long as possible without collisions. The game's prototype was written in about 8 hours. Total game development took 3.5 months. What I did all this time can be found below.



Development


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


')
In order for the record to be shared, UIActivity is used. How to add VK sharing to available by default is well written in this article: habrahabr.ru/post/214637 .

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

The scoreboard under the playing field always shows the world rank of the player. It is shown only for players who are registered in Game Center. In Game Center, in addition to the result itself, control data is sent using the hash of the result, date, and some string stitched 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 identify the vast majority of fake results and remove them. 100% protection against a fake result in Game Center cannot be done. This is not an online game and we trust data coming from a third-party device.

The code for moving a 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 the player moves his finger across the screen. If the player has moved his finger one centimeter up in any part of the screen, then the cube will also rise one centimeter. For the fastest possible response to the player's movements, the cube is in fact instantly teleported, not 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 easiest way. Increased the frequency of simulating all movements and checking collisions 6 times. Why at 6? Just experimenting with this coefficient and found that if you update all positions 360 times per second, then everything is fine. To do more often, only in vain to spend CPU resources. With a factor of 6, the load on the CPU increases by only 10%. In iOS, the current position of the finger on the screen is also displayed 60 times per second, it is impossible to affect the touch screen polling frequency in any way. Also not wise, just find 5 intermediate points between the current and the previous one:

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

Tunnel effect:

somealt

Graphics


The previous illustration is the limit of my artistic possibilities. I found a designer in Freelance. A girl with good and sunny drawings, which I asked to mutilate the cube. The big plus was that it draws in the 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 (the trial 30 days ended and I accidentally closed the program).



Variations of beating marks:



Option icons in the pile:



Geometric figures:



Music and sounds


Is music obligatory in such a simple game? I think no. But I still decided that I want to add music. I listened to music in cool projects with millions of budgets and if I liked the music, then I was looking for a game composer. I chose two composers. One refused because of a contract with a company for which he works, 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 drains. I advise these: freesound.org and pond5.com. On freesound.org, you can accidentally stumble upon the sounds that were used in Minecraft or Flappy Bird. And on pond5.com a lot of good music and sounds for little money.

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



Monetization


For monetization used advertising. It can be disabled for a dollar. From the banners during the game, I immediately refused. They take away 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 this is the most profitable network at the moment. AdMob, purchased by Google, supports not only its advertising network, but also more than a dozen third-party, including Apple's iAd. That is, it is enough to implement AdMob, and through it you can connect other networks without understanding their documentation for hours on end. Chartboost, unfortunately, is not supported. For each network you connect, you need to download the adapter from Google and add it to Build Phases -> Link Binary With Libraries.



Localization


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 will be tortured 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 the site onehourtranslation.com. It is advisable to provide translators with comprehensive comments on each line, plus screenshots and videos, then everything will go smoothly and you will not have to explain to the Chinese for a long time and painfully what is meant here. The transfer cost 4,000 rubles.

After localization, there is a small problem. You will need to make a mountain of screenshots (in my case 210), and even upload them all to Itunes Connect. (2 iPhone resolutions + 1 iPad resolution) * 5 screenshots * 14 languages ​​= 210 screenshots. I think on the thirtieth screenshot I want to kill. UI Screen Shooter to automatically click screenshots in all languages ​​and iTC Localized Screenshot Uploader to automatically upload screenshots to iTunes Connect come to the rescue. 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 the UI Screen Shooter, which presses on the screen, takes a screenshot, waits, then presses again, and so on. At 210 screenshots it takes 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); captureLocalizedScreenshot("screen1"); target.tap({x:100, y:200}); target.delay(2.0 * delayFactor); captureLocalizedScreenshot("screen2"); … 

The coefficient delayFactor for the iPad was obtained experimentally. I introduced it, as the Retina iPad simulator terribly slows down on my MacBook and all delays have to be increased.



Publisher Search


I sent 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 even did not answer. A couple of publishers were asked to send them a test version.

One publisher became interested and said that the game could be promoted to the top 10 free applications 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 earned $ 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 per 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 a stone down from the top, and the publisher's attachments 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 differ, it all depends on the virality of the game, that is, on how people would advise the game. People who came on the advice of friends are free for you. If each user leads one new user, then the application is waiting for explosive growth. In fact, this figure is almost always less than one. Buying equipment to enter the top is not cheap. 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 is obvious that when an application hits the top, it gives a huge amount of free installations, as people browse these tops.

One player in a large and quality conditionally free type 3 game in a row brings more than $ 3-4 for the entire time of his “life” in the game. Such a high average earnings from one person in a free game is achieved not without the participation of so-called "whales", who can safely spend a couple of hundred dollars on in-game purchases in one game. With an advertising model to achieve this is unrealistic. In the end, the representative of the publisher painted all the layouts 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 the 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 players that their records were missing. For my part it was a mistake to trust the information that comes from the Game Center. The results of some players were nullified locally due to this problem. Most of the records received from August 18 to 23 returned to the results tables. But not all.
Topics on the Apple forum for developers:
devforums.apple.com/thread/241761?tstart=0
devforums.apple.com/thread/241366?tstart=0

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


All Articles