📜 ⬆️ ⬇️

Walking around the rake and the circles when creating a game from scratch

A post about making a dream and creating a game from scratch. And about a rake of different size.



0. Given

Once, in times not so distant from us, when the Internet in Ufa was still with MBP, I was creating and developing local “frushnyh” Lineage and WoW servers. But then there were unlimited tariffs, and local services began to lose their relevance and I went into web development.
In some ways, as a hobby, I even saved my attitude to Geymdev, but on the other hand, developing bots and all that.
The years went by, and the thought of writing something of their own, with preference and poetess, did not cease to torment me. At some point, I realized that either now or never.
')
1. Idea and Prototype

Where does the development start? C prototype. A prototype - with the idea. For the first project is to create something small and simple. Feeding love for puzzles and step-by-step strategies, I got carried away with the thought that you need to do some step-by-step puzzle. Upon reflection, I remembered one interesting game from the times of the Spectrum (it is worth noting that the author is not as old as it may seem), the idea of ​​which was beautiful in its simplicity. The player walks on 1 cell, avoiding obstacles, and the enemies chase him and go on 2 cells, but obstacles do not bypass.

If we take the situation “A,” then we can safely walk up and down, and the monster will simply rest against the wall. In situation “B”, the monster is in the zigzag, and we can safely walk to the right, above and below it. Since the game is deterministic, there are two types of monsters that differ in color and path finding algorithm. This is so that there is no uncertainty about where the monster will go when it stands diagonally. Red always first reduces the distance to zero along the X axis the situation “C”, in which the monster will enter the stub and rest against the wall. Violet is on the Y axis the situation is “D”, in it the monster will go down, and then right and eat the main character.

There could still be a big paragraph about the choice of "engine" for writing the game. But perhaps you can get along with a few words; before trying Unity3D, I poked in the native Obj-C, Corona SDK, UE, Cocos2d and a couple of 2D Frameworks, whose name is so deep in the memory stack that I don’t dig it out.
As a result, the choice fell on Unity3D, it seemed to me optimal and I slowly began to write. A month later, this iPad app appeared.



In it, we played for a peasant in red and ran away from peasants in blue, and at the same time gathered hearts - read the stars. At that moment, we also used cubes as walls, but then to save space on the screen, we replaced them.
I would like to note that up to this point, I never wrote in C #, but I wrote in JS, so the prototype was written by UnityScript (this is such a dialect of JS within Unity3D). And it was the first big rake that served us as a lesson. I had to rewrite everything in C # and it took a couple of months.

2. Team

How true that what I wrote in a dozen languages ​​is also true that I am not able to draw even a straight line. Therefore, after creating a prototype, I started looking for an artist \ 3Dshnik, for this I went to the freelance website and looked at the first three hundred people, with a dozen - I wrote off. Finding a person for a share in a rather risky project is not an easy task. But it was resolved, and a talented artist Ramil appeared in the project; so - there are two of us.
In parallel, I was looking for an investor. The point is not the lack of money to buy plug-ins or devices for the test, but to create commitments that will help not to score (not to resign from authority) under certain circumstances. And such an investor was found, in the form of a friend who decided to invest his hard-earned money, in this dubious, as it seemed to him, venture. So, there are three of us. I note that at the time of launch, the game budget was only about 100,000 rubles, while this amount includes the purchase of several Android devices for testing, plug-ins and voice acting.

3. Expansion of the basic concept of the game

From the very beginning it was assumed that, despite the fact that the game will be as simple as possible, it will be necessary to introduce several new ideas into the basic concept. So we had one-sided teleporters (later become a boot), traps and disposable mushrooms that eat up those who approach them.

Concept Art


The main feature of the game we planned to do is that the character can go back in time, a few moves back. Those. not canceling the move, but the ability to move 1 time per level to the cell where the character was 3 moves back. This gave a huge number of options for the move, but at the first tests it turned out that ordinary players are not able to pass such levels. Too hard. Can it cost to do Brainiac Edition?

We also experimented a lot with the size of the levels, eventually settling on the fact that the whole level should fit on the screen, even on devices with a small screen. So we got levels of 5x8 cells. But at the same time, we have a pinch zoom, for more fingered or 6x10 levels. In addition to reducing the size of the levels, turning off the return in time, for simplicity, the cancellation was added, up to 5 times per attempt.

4. 2D vs 3D

At some point, our test builds looked like this:
Horror horror

The realization came that we are not able to make a picture that we would like to see in 3D with normal fps. The test scene for comparison, the performance of 2D and 3D showed not comforting results.
Screenshots from the scene

As a result, on iphone4, on the left (3D) there were only 20 frames per second, and on the right (2D), stable 60. At the same time, on the right, the picture quality, as you can see, is an order of magnitude better. Now of course, if you focus on the minimum performance of the iphone5 + level and make specially a few square graphics, kosher shaders + lightmapping + lightp robes, you can make excellent graphics for 3D


As a result, it was decided to redo everything on 2D. But here we made a mistake, which only then could not be fixed. 2D animation can be of 2 types, the first is a sequence of frames, the second is the overlay and offset of sprites.
Visual comparison


Since we had 3D models, we chose the first option. As a result, this will result in a large weight of the application, even taking into account the huge number of optimizations, we will not be able to keep within 50 megabytes.

5. Force majeure is an opportunity.

I don’t know whether it is possible to call the birth of a child and moving force majeure, but these events excluded our artist from working on the project for a few months. The same circumstances served me as well. In order to self-study and knowledge of the intricacies of the stores, I made another small application - the usual guessing movie.
For those who do not understand what I mean

On this application, I was able to test integration with social services. networks, several ad networks, internal analytics and in-app purchases.

6. Technical part

I think it's time to raise the degree of geekiness. A significant part of the development time took the creation of a level generator. The generator was written on python, because it was spiritually close to me and numpy allowed me to quickly operate with matrices.
The output generator itself created a txt file (which Unity parsed to create the scene) and a series of pictures showing step-by-step level passing.

gif animation

Here the green square is the player, yellow is the enemy, the skull is a trap that kills the player or puts the enemy to sleep for 3 turns.


Now I can say that writing an external generator in another language is a bad idea. Mainly, the fact that the game logic begins to be written in two different places. And this is the risk of a rassinchron. Especially if you consider that inside the game, there are such concepts as animation and the time of its execution. Both in the generator and in the game, each cell itself observed what was happening in it: who entered, who left, who died, etc. But the cells, a kind of teleport or fly swatter (attacks nearby cells), connected several cells together. And if it didn’t cause problems in the generator, it was more difficult to repeat the same in the game. animations of characters from different cells should have synchronized with each other.

A huge chunk of time was taken by the integration of native libraries. Let me be blunt: if you can buy a ready-made implementation of what you need, feel free to buy. In this case, it is desirable to take everything from one vendor, because as in Unity3D in the manifest (Android), there is such a thing as mainactivity and this is a place where different plugins may conflict. Then for iOS, most likely, you will have plug-ins that are involved in various post-processing, this is also a place for conflicts. In general, natives are a place where you can easily get very difficult to detect errors. Therefore, almost everything related to the native code was bought from Prime31.

Full list of plugins and a few words about each
Prime31 (Android + iOS) Admob $ 95 - advertising with a large fillrate, it just so happens that not all networks can show a banner when asked for ...
Prime31 (Android + iOS) Flurry $ 100 - analytics + advertising.
Prime31 (Android + iOS) InApp Purchases $ 130 - in-app purchases.
Prime31 (Android + iOS) Social $ 120 - social integration of Twitter and FaceBook, so that you can post the result or just like the app.
Prime31 (Android + iOS) Etcetera $ 130 is a native application evaluation window + every little thing.

Since we are talking about plugins, NGUI $ 50 was also bought, the best plugin to create an interface. In AssetsStore there are a lot of plug-ins for creating GUIs, but IMHO is the best, besides its developer is now working in the Unity team itself and promised at the forum that when the official GUI comes out, he will try to simplify migration to it. Must have

2DToolKit $ 65 for game animation, now it has an alternative, built-in 2D support from Unity. But 2DToolKit is sharpened to work with sequences of frames, besides it has several very important features. For example, it can cut a large image into squares and put them into one atlas, this is necessary if you have some kind of 2048+ texture at 1xxx pixels. This will allow it to fit into the texture of 2048x2048 (Limiting the size of android textures). Out of the box it has support for x1 x2 x4 multi atlases. For example, you have a character; he has a lot of animations and they don’t fit into the 2048x2048 texture, it will automatically break into several atlases that, from the code, you will see how one collection. Must have.

UniWebView 15 $ is a plugin that allows you to show the browser and receive from it, normal callbacks. Needed in order to communicate with VK api
Also some free plugins:

The official Google Play Games plugin for Unity , for achievements, leaderboards and, subsequently, systems for synchronizing progress between devices.

Pushwoosh service for sending push-tagging, which has a package for Unity3D.

Google Play OBB Downloader plugin that allows you to create applications larger than 50 megabytes for the Google Play Store. It comes with source code, was partially rewritten for compatibility with other native plugins.

PoolManager by Path-o-logical Games is a good pullman manager in order to avoid lags when an object is created.

Audio Toolkit - for working with sound.



7. Statistics

In the release about 400kb, the code I wrote. Another 150kb is a generator and some related scripts.
In the game itself, at the moment, 3 chapters of 16 selected levels. There is also a Test mode, where there are about 700 levels dynamically distributed by complexity.
On average, the level without stars can be completed in 25 turns. The most difficult levels with stars around 55.

8. Monetization and promotion

There are no exact figures yet, but we, like the Cylon, have a plan.
Using the example of movie guessing, we realized that you can earn money on advertising only if you have 300k + users. Since the project we have, no matter how cool niche, I think this is not an option. But at the same time make a paid application for Android - suicide. As a result, the standard model was chosen today: the display of advertising and the sale of coins. With any purchase of coins comes complete disabling advertising. Coins are given when passing levels and for them you can find out the perfect level passing.

We decided to advertise through reviews, because the purchase of plants is very expensive and ROI will be negative.

The iOS version is also ready, but it has not yet been decided on how to release it. Maybe it makes sense to negotiate with some publisher.

9. A small video game.



True, the game is portrait orientation screen.

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


All Articles