
At the end of spring 2013, I described the
story of a bad start on Google Play . So far with iOS hitch, we decided to throw the game in VC and OK. In the article I want to share the features of launching the application under the social network, and tell you about the problems encountered before and after the release.
Features of the web player version

On this platform, it is possible to enable
dynamic shadows , not just a “soulless” Projector, to increase the clarity of textures, and also to improve global quality parameters. If Android was “Fast”, then you could safely choose “Good”.
We also needed a footer for the game. It usually contains useful information, a button to invite friends and a link to the group. I decided not to fool with Unity3d and made it right in HTML:

Server side preparation
In the web version there was a question about the reliable preservation of careers, ratings and payments. Without this, the application would be defective. I looked in the direction of the
PHP + MYSQL bundle that I already knew. The publisher reacted negatively to this decision (PostgreSQL was advised to go), but I did not listen and did it my own way, since it was easier for me.
')
DB structure, all the necessary data is stored here.

The main server.php
file came out in ~ 300 lines, it describes the following features:
- Player registration
- Buying and pumping machines
- Purchase of gasoline (consumables)
- Record the result of arrival
The player sends data to this file via POST and we write it to the database. Not very safe, but there are a few simple md5-type signature checks that protect against school children.
The answer comes about like this:{"id":"4","name":"Nolex","lvl":"7","coins":"9034","stamina":"40000","kill_zombies":"6952"}
This is JSON, for Unity3d I advise you to use the JsonFx.Json library.
Rating is an important element of the game, I constantly observe how players compete there among themselves, therefore I will mention the script rating.php. It had 8 queries to the database, 4 of which later began to bother me.
SET @rownum:=0; SELECT r2.`rank`, r2.`name`, r2.`points` FROM (SELECT @rownum:=@rownum+1 as rank, `salto` as `points`, `name`, `id` FROM `players` as `r1` WHERE `sn` = '1' ORDER BY `salto` DESC) as `r2` WHERE `id` = '999'
This is one of the problematic requests to determine the position of the current player in the selected category. When there were not enough players, it passed instantly, but later there were more players, everything began to slow down and I removed this option. Now, if a player misses the TOP-100, then from the bottom simply display his place as “> 100” and near points earned. I could not come up with another solution.
Later, after the release, there was also an
admin panel for the game , where I implemented a summary of the latest data, a section of statistics on all social networks, and the sending of alerts with logging to the database.

Balance
Given the poor conversion on Android and the Zhlobskaya audience in social networks, it was decided to reconsider the balance. We made an analogue of "energy" - gasoline. When it ends, the player has a choice - to
wait or donat .
After I introduced the consumables, the most painful and at the same time interesting thing began - setting up the numbers. The publisher (
Herocraft ) insisted on a hard balance, and on the contrary, I was softer. Conversations and disputes did not lead to anything good and we decided to trust the tests.
For this, I set up a full logging of all races. Testers drove and data appeared, thanks to which we were able to find out how much the player earns on average coins and how much gasoline he spends on each level. Then we just cut the fuel for each level. It was necessary to ensure that the level of "outright" is not passed, and the player was stopping closer to the end of the track. This does not apply to the first level, which is intended to entice the player. It is important.
A window with a warning about a small amount of fuel

Integration in social networks
At first I integrated it into the VC, it was easy, since it was not the first time. From the API, I needed a little:
- Getting personal data of the player
- Inviting friends
- Posting on the wall
- Spam (newsletter)
- Writing a player's level to the base of the social network (the friends can see the activity of the players at “ups”)
- Payment (probably the most crucial point!)
Then I started to OK, everything is more complicated. The API is not familiar, the sandbox is uncomfortable, but you quickly get used to it. To start, you need a legal entity (here plus the publisher). Of the
features in OK, you can select a square icon (with sharp edges), the name of the game in Russian is compulsory and picky moderation (somewhere from the 5th time it turned out to go through).
Running game
Static files were uploaded to the cloud to the publisher (there is a * .unity3d file, 22 MB in size, and several pictures). PHP + MYSQL posted on its weak server, which we rent with a partner for $ 40 / month. Considering that everything is in order, we started the launch.
In VC, everything happened very quickly, they clicked on the check button (the procedure is free, they take 10 votes as bail). On the same day, the application was approved and it fell into the “New” block. I went first traffic.

The server behaved normally, but not as good as we wanted. The requests went quite slowly, sometimes there were delays of 3 seconds, so I asked for my friend, who had a good tariff plan for Hetsner.
The game in the top lasted about a week, every day it fell lower and lower.
The day was 5-7k installations , then dropped to 2k.
Almost immediately, I set up a newsletter alert and every day I tried to notify players who have recovered gasoline.
Next was scheduled to start in OK. The release was assigned to us on the 27th, but for some unknown reason the game was released and hit the “New” on July 24, and then the server became ill from the influx of a large number of people.
Download downloads to the MySQL database

Thus, the server of my friend bent down, to which he told me “thank you very much” (by the way, there was 1 large project on the server bringing money). There were brakes and sometimes the error
“502 Bad Gateway” was knocked out. This situation was about a day.
Not expecting such a turn of events, I decided to throw the game back onto my server. It was stupid, since he fell 20 minutes after the move.
To all the players who played these days and were faced with "lags", I threw 1000 coins and sent out. This is a good practice in such situations.
Ultimately, I moved to the server to the publisher, where the game works adequately to this day. By the way, the server is quite interesting, it is constantly cached. Edit php files on sftp take effect only in a few minutes. Not very convenient, but it looks like some kind of "trick" to optimize the load, and I must say quite successful.
The schedule of registrations in the game, then you can see approximately how much traffic from VC and OK

Approximately the same situation with payments, in OK there are more of them, from which it can be concluded that traffic there is “fatter”.
Some numbers and conclusion
- Schoolchildren found a hole in learning. It was possible to farm 10 coins. As MySQL says, one very persistent boy did this operation 1200 times and fed 12k coins.
- At the moment, the game has already been installed by more than 130k people (50% BK / 50 OK%).
- Only 17% of players have reached the last levels.
- The other day, VK sent an application to a new one (already paid), withdrawn 1k votes, waiting.
To summarize, we can safely say that there is not much point in publishing such a game in social networks, there was more sports interest. In any case, it was quite entertaining to observe and influence the whole process.