📜 ⬆️ ⬇️

As we came up with and made our first game on Android. Part 1: Game Mechanics

Hello! We are two new mobile game developers, former classmates, graduates of Kazan Federal University, Aydar and Ed.

Aydar: “The history of our game“ Syncomania ”began with the fact that I had a strange dream. It was a computer game where four white balls moved synchronously in a square field. When the first of them broke out of the playing field, I woke up. The next morning I called Ed, and already at lunch we met in the courtyard of the university where I worked. ”

Ed: “What programmer did not dream of making his own game? In the summer of 2014, I had a lot of free time, and I gladly jumped at the idea. Then we could not even imagine what difficulties we would face. ”
')
However, at the first stage we were full of enthusiasm, everything was easy and interesting. It is about him that we will tell in the first part of the article.

So, at the entrance we had one simple idea - the player controls four heroes in one movement.

Initially, it was necessary to deal with the genre of the game. We rejected the arcades rather quickly: it was not an easy task to manage this number of simultaneously moving elements. We both like measured intellectual games, so we agreed that this would be a turn-based puzzle. True, this did not make it easier for users - the game turned out to be hardcore. We also decided to eliminate random and unpredictable elements so that the game process completely depended on the player’s actions.

Ed: “Without thinking twice, I chose Processing as a programming language, since it is easy to create prototypes on it without preliminary settings. In addition, the Java syntax allowed us to easily transfer the game logic to Android using combinations such as Ctrl + C and Ctrl + V, but more on that later. We created four heroes in the form of white circles and changed their coordinates using the arrows on the keyboard. ”

Aydar: “We set the initial position of the heroes in equidistant places of the level, since it looked symmetrical and“ why not? ”. Subsequently, we decided that it would be fun if each level began the same way. ”

Having a little experimented with management, we realized that the heroes need a goal, a certain way out of the level. At first, we considered the idea of ​​bringing the heroes out of the playing field (this was how it was in Aydar’s dream). But the only way out seemed to us more interesting and more dramatic - he imposed more restrictions (of which, as we know, creativity is born). So we had the only condition for victory: all heroes must come out alive. The “exit” sign is usually highlighted in green. We did the same.

image

“On the second day, They created a wall. Let there be a wall in the middle of the level, and let it separate the heroes from the exit. ”

The wall object is a natural obstacle and the main tool for building a passage script. Intuitively, we decided that the hero remains in place if there is a wall on the way of his following. Since walls are usually built of stone, we depicted them as a gray square.

image

We made the playing field in the form of a chessboard with the dimension of 11 by 11. Thus, it is easier to store and move objects. For example, if the hero is in the lower left corner, then his coordinates are [0] [0]. To move the hero up one cell, it’s enough to add one to the string value: [0 + 1] [0] => [1] [0]. Each cell can occupy only one object, from which follows the natural question: “What happens if two objects end up on one cell?” For the first time, we thought about it only when one hero ran into the wall and the second hit him. So one of the conditions of loss appeared: two heroes in one cell are mutually destroyed.

image

Another condition of loss appeared when we created a trap element - a cell, on hit on which the hero dies. The trap had to be depicted as something dangerous and forbidden, therefore, adhering to the minimalist style, we chose a red square.

image

Ed: “I really like the board game “ Roboralli ” , and especially the conveyor system, which introduces an element of surprise, if you miscalculate your actions. Conveyors are triggered in a separate phase of the turn (after the heroes move) and displace objects in the direction of the arrow. We have brought something like this to our game, calling it streams. ”

Streams have two main functions:

1) System nipple. She skips one way, but does not skip back.

image

2) Production line. With the help of her heroes, enemies and boxes (about them later) can ride on the pre-set routes.

image

Aydar: “Continuing the search for sophisticated ways to kill heroes, we decided to develop the idea of ​​traps and make them mobile. At first we had the idea to introduce into the game a trap-pendulum, which with a certain frequency would move between two cells. But a trap that can travel all over the playing field is much cooler. Such elements are obtained “alive,” and we immediately called them enemies. ”

However, the random movement of elements introduces unpredictability and uncontrollability into the game, which go against the laws of the world invented by us. Therefore, we made a decision that the enemies should be controlled by the player himself and, being the antagonists of the heroes, move in defiance of the teams, that is, in the opposite direction. For example, if the hero goes to the right, then the enemy - to the left.

image

When there are a lot of enemies at the level, an illusion is created that they live their own life: they ride in streams, beat their heads against walls unsuccessfully, die in traps or embrace each other, leave this world through the exit and, as if on purpose (actually not) , all the while trying to kill the heroes.

image

Ed: “At one of the test levels, the enemies were so annoying that I always wanted to take revenge on them. We needed a tool, or rather a weapon against them, which the heroes could use. After going through several options, we decided to crush our enemies with heavy objects. ”

We remembered the game "Sokoban" and created a modified type of boxes (new - this is a well forgotten old). In essence, the boxes are walls that can be pushed, so we depicted them as reduced gray squares with a crosshair. They harmoniously fit into the rules of our game: if you push a box on a cell with a hero or an enemy, the characters die, since according to the law, two objects cannot be in the same cell. In addition, the boxes can ride in streams, and if they fall into a trap or exit, they are destroyed. As in the game "Sokoban", you can not push more than one box in a row, so there may be situations where the hero is locked up.

image

Aydar: “When creating a level, it is almost impossible to predict all possible solutions, and right at the very beginning Ed and I noticed that we pass the levels in different ways. This is not surprising, because with each new move the number of states grows exponentially. ”

The variability of the passage is a feature of the game, of which we are sincerely proud. Of course, most levels can be completed without thinking, but then instead of twenty moves you may need forty or sixty. So the game has an incentive to re-pass - the search for the shortest solution.

Ed: “For me personally, finding the optimal passage is a favorite part of the game. At the very beginning of the development, we created a table where our friends, the very first users, shared their records: for how many moves the level was completed. Beating records and getting into this list motivated us to play further. ”

Before the release of the game, we needed to collect the shortest passing of all levels in order to issue them in the form of paid prompts. To do this, we programmed a brute force algorithm with constraints, but it worked too long at levels with a large number of objects. When the settlement time exceeded several days, we decided to use crowdsourcing (eng. Crowdsourcing, crowd - “crowd” and sourcing - “use of resources”). If a player improved the record on one of the levels, then with the help of Google Analytics we received his decision in the form of a sequence of moves. Experienced players usually search for optimal passage heuristically, applying their established patterns and avoiding redundant moves. Thus, we quickly replenished the base of passages, but, to our surprise, some players still continue to beat records. We accurately record and update them in subsequent versions of the application.

image

To be continued…

In the next part we will talk about how to develop riddles and technique of passing levels in the game “Syncomania”.

As we came up with and made our first game on Android. Part 2: Levels

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


All Articles