📜 ⬆️ ⬇️

Conveyor of games for stores from sophomores with love

Promo codes.apk


Nowadays, so-called “promotional codes” are popular with many stores, according to which buyers can get a discount on goods. On average, the customer base of stores using such “innovations” consists of buyers aged from 16 to 30 years. People of this age group practically do not part with their smartphones. On the face of the relevance of mobile applications, which is growing every year. This brought us and the guys to the idea of ​​creating an application for the distribution of these same promotional codes.

Concept and marketing


After a brief discussion, we stopped at the development of a maze in which the user must find a promotional code. The number of promotional codes, as well as the frequency of maze generation, will depend on the customer. Each user can find a promo code in the labyrinth, but only the first N clients will receive it.

User benefits:



Customer benefits:



Benefits for developers:




Unity3D as the main development tool


When choosing a game engine, we stopped at Unity3D . There were several reasons for this:
')

Data storage


When there was a question about the storage of data, such as: the name of the shares, numbers of promo codes, a map of the maze, etc., we came to the conclusion that storing data locally is at least silly.
First, the volume of the application increases, which clogs the memory of the device, and, secondly, there will be a problem with the update (you would have to do a new build forever and upload it to the site). So we came to the conclusion that the game will work on the principle of “ Client-Server-DB ”.

image

Why not “ Client - DB ”? - Because in this case, each user will have direct access to the database, which reduces its security to zero.

Since the database will be located remotely, we need hosting. For the prototype of our game, we chose a free hosting. The main criteria were the provision of two databases at once and the ability to edit data through PhPMyAdmin . Due to the meager experience with the database, the latter has become the key for us.

Access to the database


Since the game accepts the principle of “ Client-Server-DB ” - it is logical that the client should contact the server so that he in turn makes a request to the database. Data is returned in the reverse order. The access from the client to the server is made using the WWW and WWWForm already existing in Unity (see the Unity API Scripting for more details) using C # , and from the server to the database using a regular php script. For the distribution of data that is taken from the database, JSON was used in Unity.

<?php $servername = "**"; $username = "**"; $password = "**"; $dbname = "**"; //Create connection_aborted $con = mysqli_connect($servername,$username,$password,$dbname); mysqli_set_charset($con, "utf8"); $id = $_REQUEST["id"]; $sql = "SELECT * FROM UnityDB WHERE id = {$id}"; $result = mysqli_query($con,$sql); $rows = array(); $rows = mysqli_fetch_assoc($result); $rows['Map'] = base64_encode($rows['Map']); echo json_encode($rows,JSON_UNESCAPED_SLASHES); mysqli_close($con); ?> 

“What is the date today?”


In each row of the table, we used id as an identifier, according to which we selected from the entire table what interests us. It ranged from 1 to 31, depending on the date of the month. As you already understood, a unique maze, a promo code, etc. was ready for each id . The check was carried out through a short php script that returns a number in a specific time zone (so that everyone has the same number).

The syntax was implemented in such a way as not to overload the database with unnecessary queries.
At first we addressed a script with a date that returned the day of the month. After that there was a check of the local number (which was saved during the last query to the database) with the number that the script returned. If they are the same, then we don’t refer to the database, but simply use local data (what we took from the previous reference to the database), and if the dates differ, then we refer to the database, and replace the local number with what the script returned with date.

 <?php date_default_timezone_set("UTC"); //      $time = time(); //       $time += 5 * 3600; //  3      echo date("d", $time); //   ,     ?> 

Style of the game


After writing the basic mechanics of the game, it was necessary to determine the design of the graphics. We stopped at a simple “cartoon” style, because:


image

3D models


All 3D models, including the character model and scan, were made in 3D Studio MAX .
The animation was made using Mixamo , as there are already ready-made presets, which were enough for us.

image

image

Texturing


Our 3D model consisted of no more than three colors. The sweep itself looked like this:

image

We divided the model into parts depending on the color. As a result, the texture itself looked like this:

image

The texture can be made of any size and it will not affect the quality, since these are just two solid colors. Naturally, we made it as small as possible so that it does not take up much space on the device.

It is convenient and quick to create different variations of the character's clothing colors, which is an undoubted advantage when adjusting the application for a specific order.

Creating the necessary material in the engine was also not difficult - Unon already has Toon Shader, which is almost completely suitable for us. By slightly changing it we achieved the result we needed.

UI Design


The interface was created in Adobe Illustrator.

image

The system for creating animation in Unity is quite convenient, which allowed us to easily animate menus, buttons, etc.

image

Conclusion


Having developed such a simple template, you can safely offer your goods to stores or even to some institutions. Proper presentation and portfolio in the form of deals with other stores will help you with this. Three sophomores invented such a wicked start-up on a cold winter evening.

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


All Articles