Creation of the simplest computer games. How to create a game yourself? Stages of creating a game

This article will tell you what is still needed to create a computer game. If you are tired of general advice- look through this document and you will surely find something useful in it. The material is intended for beginners and is of no interest to professionals.

Freedom or money

Do you want to create a computer game? I hope you have already resolved your doubts. Based on the fact that you are now reading this text, I dare to assume that yes. Therefore, I suggest that you ask yourself another, no less commonplace, but no less important question: why do you need this? The answer to this question is already less obvious, and I will try to help you find it. It depends on it, first of all, what tools you will use.

And if you think about it, there are two options for an answer.

Option one. After reading an article in your favorite magazine, hearing an enthusiastic story from a friend or flipping through the Internet forums, you realized that a mere mortal could assemble a game and immediately became infected with this idea. Thus, you write the program out of pure enthusiasm for yourself, your beloved, presentation to friends, or, in extreme cases, for free distribution on the Web. That is, commercial distribution is not initially expected. In this case, you can not especially embarrass yourself in the choice of development tools. I do not urge you to switch to using exclusively pirated software. Just keep in mind the fact that many large companies - developers of popular software - turn a blind eye to such use of their products. The "try and buy" principle generally fits into their ideology.

According to the second option, you, on the contrary, are just looking for a way to earn more and have decided that the creation of gaming programs is the long-awaited bird of luck, your chance to step from rags to riches. It should be noted that very often the second option follows from the first. Having created a really high-quality product and constantly improving it, you decide to charge a fee for its use. In this situation, you no longer have such a wealth of choice. You will have to purchase one way or another licensed versions programs, otherwise problems will naturally arise. So, willy-nilly, you will have to evaluate your financial capabilities. In order to avoid misunderstandings, I had to raise this topic here.

And now let's think about what will come in handy for us to write the Game.

Flash and game designers

Flash is a unique program that has no competitors in its niche, mainly due to its broad functionality. Using just one product, you can be a programmer, web designer and artist at the same time. Created with Flash games slightly easier to distribute than "real" ones. But you won't be able to put together a serious project on a flash. If you are a lone programmer, then Flash can be almost the ideal solution for you, saving you time and money. But if you work in a team and want to make the Game, and not an interactive cartoon, I highly recommend paying attention to more specialized products.

Now regarding all kinds of game constructors. My friends, using them is pure lame. They (the constructors) lack the versatility of Flash, without providing any benefits in return. With the help of a constructor, you can do only what the creator intended, while translators like Delphi or Visual C ++ allow you to solve any programming problem.

My advice to you: stop using game constructors and immediately switch to "serious" products.

Debriefing

I hope I dissuaded you from using all kinds of flashes and directed you to the true path of the creator of games, if not, return to the previous section :)

And now it's time to figure out what we still need in the difficult field of game making. First, you need a personal computer, no matter how trite it may sound. Without it, sorry, no where. Secondly, a head capable of thinking, analyzing and a little imagination will definitely come in handy. And the last obligatory attribute of a programmer-game-maker, of course, is a translator. About him something dear and will be discussed further. In addition to the required set, you will need other programs like a graphics editor, but more about them later.

Choosing a translator

Notice that I haven’t said a word yet about choosing a programming language. There are a great many of them, and theoretically almost any will be suitable for writing a game. You can write games in BASIC and FORTRAN, and, pardon the expression, on the wall in the outhouse. Here it is important to decide what you mean by the word "game" and what kind of game you want to make. The device of modern graphic games is fundamentally different from all sorts of even-odd and others like them. A word puzzle that works in text mode is also called a game. And for this very reason, among the indispensable attributes of a game creator, I did not mention a graphics editor. Personally, under the proud phrase "computer game" I imagine a colorful show with dynamic action and the obligatory presence of graphics. To write such games, DirectX was created and such games are sold today in thousands of copies.

I pay such attention to this issue because play is a very vague concept and it is important to decide from the very beginning what exactly you want to do.

Have you decided? Then you can safely move on to choosing a translator, or, to put it simply, a development environment. Note that I do not recommend choosing a programming language, but a translator. This is due to one simple reason. The programmer doesn't work with C or pascal. It uses Microsoft Visual C ++ or Borland Pascal. It doesn't matter which language you will program in. Ultimately, what you can create is largely determined by the capabilities of a particular translator. I recommend opting for the already mentioned Visual C ++, Borland C ++ Builder or Borland Delphi. The presented translators are sold in several editions. I do not recommend taking the most sophisticated super pro version. Basically, the difference between different editions lies in the number of visual components and auxiliary utilities available to the programmer, which is not essential for creating games.

Game engines

Assembling a game from standard visual components is not the most beautiful solution. Following it, you lose acceptable performance and deliberately limit yourself in opportunities. However, writing a game "from scratch" today is also not accepted. DirectX libraries have been created to simplify the creation of gaming and multimedia applications. With many advantages, including high performance, programming in "pure" DirectX has one serious drawback - high development complexity.

And therefore, a lot of so-called "game engines" based on DirectX and greatly facilitating the programming process were created. Do not neglect, but do not abuse their use. It would be funny if the standard Windows solitaire was written on the DirectX engine and required a 3D accelerator in the system to work.

The most sophisticated engines are sold for big money and their distribution is strictly limited. Fortunately, there are many free engines available on the Internet. For example, if you are using Delphi and are new to programming, I recommend LCI Creator and DelphiX to you.

Choosing brushes

A few words about graphic editors. To create any decent graphics in Paint'e, you must have a remarkable talent and unlimited free time, so I recommend going a more civilized way. Of course, Photoshop is an expensive thing, but it will definitely come in handy. Another well-established program is Corel PhotoPaint. For processing 3D models, I recommend 3D Studio Max, which is almost the de facto standard in the field of 3D graphics.

Associated funds

And finally, I would like to mention, so to speak, secondary tools used in the game development process and worthy of your attention. Here I will not be verbose and will get straight to the point. After some success, you may find a program for creating installation discs useful - InstallShield Express is the best choice for a novice developer. Use InstallShield DemoShield to create a product presentation and create a CD wrapper. I don't even stutter here about the means of making music and other such things. Music for games today is rarely created by themselves, but downloaded from the Internet, especially for novice developers. The main thing is that the source is not too famous. One of your main assistants is the Internet. Do not neglect visiting On-Line forums and conferences.

What should future game developers consider? What language to start learning from? What to strive for? Who to look up to? And what needs to be done first?

Most rock music lovers pick up the guitar sooner or later. Sports fans dream passionately about entering the football field, basketball court or tennis court. Well, those who have committed hundreds of hijackings in GTA, spent dozens of hours in computer clubs for Counter-Strike, or achieved considerable success in MMORPGs, are probably thinking about a career as a game developer.

The problem is that this direction is taught in a few educational institutions. Therefore, most game developers are self-taught, who once wrote the curriculum themselves. But what nuances did they take into account? Where did you start and what did you strive for? What language was taught first? We tried to answer these and other topical questions.

What to strive for?

Before going to the store, you make a shopping list (at least in your head). Before traveling to the other end of the city, you are planning a route. Well, before learning how to develop games, it is advisable to ask the question: what exactly do you want to do? Create mobile applications or browser games? To work in a large company or a small one? Do you professionally develop games or devote your free time to it? And if the first, then what interests you more: creating an interface, polishing gameplay or writing scripts?

Setting your goal correctly can save you a lot of time and effort. In addition, it will allow you to reach your destination by the shortest route. Without the risk of getting off the road or getting into a swamp.

What language to learn?

In addition, the answer to the burning question depends on the goal: which programming language should you start with?

So, future developers of games like Minecraft and mobile applications for Android should pay close attention to Java. To begin with, we advise you to take an intensive course, especially since it is free. Those who are looking towards iOS - Objective-C. For browser games, knowledge of Ruby-On-Rails is sometimes enough. For very small and simple, HTML is enough at times. Flash games use ActionScript, and to write scripts of any complexity, you need JavaScript or perhaps the less common Lua. To create small console games, you need to know C #.

As for the most large-budget games (the so-called AAA class), most of them are equipped with their own or borrowed from colleagues "engine". Often, however, the entire "engine" or most of it is written in C ++. It was this language that was used to create many famous "toys" - from Doom 3 and Call Of Duty to FIFA and The sims... While classics like Quake were written in C.

However, there is a catch in mastering C ++ - excessive complexity. It’s not for nothing that they say that taking on C ++ without knowing other languages ​​is the same as starting the study of mathematics with linear equations.

Is one language enough?

One of the charms of programming is the possibility of constant self-development. In the development of games (especially large ones), self-improvement, including learning as many languages ​​as possible, is not a whim, but a vital necessity. So, experienced developers working for the benefit of the giants gaming industry, are often faced with the need to alternately write in 7-8 languages. At the same time, in addition to the above languages, they have to learn, for example, Python or even SQL (as you understand, to create databases).

Therefore, if you decide to connect your fate with the production of large games, be prepared to become a "polyglot". In addition, the more languages ​​you master, the more interesting and varied tasks will be presented to you. And, of course, the chances of getting a dream job will increase significantly.

WHERE TO BEGIN?

Before you can travel around the world, you need to learn to walk. Well, before a serious game project, you need to try your hand at something less significant.

Almost all experienced developers, regardless of regalia and talent, started with small applications: board games, variations of famous "toys", simple "flash drives". Then they did not think about large exhibitions like E3, but gained invaluable experience. Why not follow their lead? In this case, it is not necessary to write daunting code. For the debut, it is enough to use special programs for creating games (for example, Game Maker). After all, even thanks to simple tools, you will greatly facilitate your life. First, you will understand in miniature the logic and structure of almost any game application. Secondly, pack in bumps that will heal during the transition to serious projects. Finally, third, enrich your portfolio. After all, even a simple "toy" requires a lot of time, patience and creativity to come up with a concept, write code and fix bugs. In addition, it shows that you are familiar with the production of games not only in dry theory.

What should be taken as a landmark?

Anyone who dreams of becoming a writer will read hundreds of books before writing even one word. Piano masters know the best works of Strauss, Chopin and Beethoven. Well-known artists learned the history of art by heart before major exhibitions.

The same principle applies to game development. You cannot develop in a vacuum. Therefore, play, be inspired by the masters and, like a sponge, absorb the best. At the same time, try to look at applications not through the eyes of a "gamer", but through the eyes of a developer. In other words: transpose the game. Think about why at this moment in time the "bot" ran to the left, and not back? What factors change the power and accuracy of a hit in a sports simulator? How to create a "fatigue effect" when a character runs for a long time? How can I make it so that when it rains, the player hears the sound of drops, and not a pig squeal? In general, get to the point. Try to recreate in your head the algorithms that you encounter during the game. Believe me, such a constructive approach will help you in the future difficult, but damn exciting career of a game developer.

Each person dreams of doing something in his life - for this he chooses the profession that will allow him to do what he loves and to contribute to the area that is important to him.

However, not everyone can just take and become a game developer, because this profession requires a lot, and in return may not start giving away right away. But how oh gamer didn’t dream of creating his own game someday? Now this opportunity has become much closer.

The main obstacle

In fact, creating games requires certain skills, but you can successfully get them on your own, in educational institutions by specialty and without going through special preparatory courses. Considering the fact that the Internet is now a huge source of a wide variety of information, the guide to creating games can be obtained from there. It is only when the average gamer comes up with the idea of ​​creating his own game that he starts looking for ways and faces the first and main obstacle. On search queries, he is given dozens and hundreds of results with tips and detailed guides, among which you can very quickly get lost, get confused and get lost. The user starts reading one thing, jumps to another, in the end he cannot put anything together and decides to continue playing those games that have already been developed by professionals, and not try to create his own creation. It follows from this that man is his own main enemy on the way to creating his own creations. And here is the question of motivation - if you want to create your own game, then you should not be stopped by the abundance of materials.

Try to systematize them, process them in small quantities, do not rush to cook up a finished project as soon as possible - better understand the theory properly, practice in practice, and then get down to business.

Game building availability

Today, it is out of the question that game development is the advantage of a select few who have incredible abilities, as it was ten or twenty years ago. Back then, the creation of a game was a complete miracle, while now it is a banal production process. And now any person who has the proper desire and has certain ideas in his piggy bank can join this process without having a specialized education. You just need to decide what you are ready to give in order to create your game, because this process is time-consuming and requires perseverance and endurance. Therefore, first decide whether you are ready to take on such a project, then indicate all your ideas that you intend to implement, and only then you can proceed directly to the game development process.

The main components of the game-building process

To create your game, you need a clear understanding of what you need to be able to do.

The game-building process can be divided into two large parts - technical and creative. They are quite different, but if your plans do not include creating a multi-hour masterpiece with unique capabilities, then you can easily cope on your own. So, the technical part of the computer game development process includes writing code, developing artificial intelligence, drawing graphics, designing three-dimensional models, and so on. This half of the process is suitable for those who have a mathematical mindset - knowledge of programming, mathematics and other exact sciences will come in handy. As for the second half of the process, it is no less necessary if you want to create your game on a computer and want it to be of high quality and unique. The creative process includes, in the entire content of the game, that is, the game world, the characters of the characters, objects, locations, battle systems, development, finance, also this includes the voice acting of the characters and the creation of the soundtrack.

The easiest way to create games

There are various approaches to game development, but it is best to single out three main ones, among which the simplest one should be considered first. It is worth using if you are thinking about how to create your own game, but you have absolutely no knowledge of programming. To use this method, you need to download a special game constructor - a program that already includes the basic functions of creating games. One of the most famous builders is Game Maker, which is fairly easy to learn and has a decent set of features. As mentioned above, the main advantage of this method of creating games is its simplicity - you only need to bring your ideas to life through the capabilities provided by the program. But the main disadvantage here lies precisely in these very possibilities, or rather, in their limitations. In fact, with the help of the construction program, you can create a template game by choosing functions for it from the general list. If you want to bring a little personality into the game, add a zest, your own special chip, then you will not be able to do this.

Game development on a ready-made engine

You can implement much more impressive functions if you have a basic knowledge of programming languages, as well as you own graphic editors and understand what game scripts are. If you have a ready-made game engine, you can no longer create a template, but a full-fledged game with your own personality - it's just that its basis will be someone's, created by someone else.

But everything that you blind around the base - it already depends only on you. Naturally, this method of creating games is much more difficult than using a construction program, but the result is much more impressive. There is a possibility that in order to create a similar game you will have to involve other people in order to share responsibilities with them.

Creating a unique game

But there is also a third method, which is the most difficult, but gives the most impressive result. It differs from the second only in that you do not have a ready-made engine at your disposal, that is, the basis, the base of the game - you create this engine yourself. This means that in your game everything will happen and look exactly as you programmed - down to the smallest detail.

You will have to write a game literally from scratch, in which case you will definitely need a team of specialists so that everyone is responsible for their own area: graphics, physics, programming, plot, and so on.

A new branch of the industry - mobile games

If you want to try something simpler and less global, then the ideal option would be for you to try to create your own game for android, since mobile games have recently become no less popular than computer games, but at the same time require much less time and resources. You just need to know the java language and understand the principles of applications.

Flash games

Another possibility to create simple games is Flash. Such games have long been called "flash drives", there are a lot of them on the Internet, and their distinctive feature is simplicity and unpretentiousness. You can create your own game for girls or for boys, you can try yourself in other genres, of which there are a lot for such games. The main thing is desire. You should not make games "create your character and forward to the unknown" - it is better to work out the whole game properly so that the gamer is satisfied as a result.

Every day the games become more complicated and more sophisticated. They are published in the thousands every year on Steam. They are distributed over different platforms and categories. The audience of players is growing rapidly. The number of developers is also growing rapidly. Being an indie, or rather a solo game developer, has become tough. But the romance of independence forces the development of an indie game to start over and over again. In this article, we will talk about how to survive on this path and how to develop cool games in a tough competitive environment.

Although new technologies are emerging for creating games, their development becomes more and more difficult every year. There are three top engines: Unity, Unreal Engine 4, CryEngine 5. They are constantly talked about, and they are used by a variety of developers to develop a variety of projects. Nonetheless, the complexity of these tools has exceeded every conceivable boundary. They are huge, their functionality has reached universal proportions. All these possibilities can be used by large studios, but for a solo developer this is redundant stuff, he does not need it, because to implement it he needs additional resources that the indie doesn’t have anyway (he laid his house to develop a dream game). And if this is not an AAA game, then the implementation of these features is useless.

When you start creating an indie game, you need to budget for about a year in advance and accumulate enough money to develop the game of your dreams. The best place to start is while still working in your regular office job. Having chosen a theme for the game, write a design doc. It is even necessary to create prototypes by showing GIFs to the internet community. And only when the next prototype receives public approval, you can start full-fledged development.

Alternative engines

I understand that nowadays there are indie games of all genres for all tastes (and this is actually a good thing), but by indie games in this context we mean small, two-dimensional, mobile-oriented, created by a solo developer of creations ( which is the overwhelming majority), so using Unity, UE4 for prototyping will be unreasonably difficult. There is a wide range of alternative engines available, they are easier to use and allow you to achieve impressive results in less time, minus the special effects that an indie would not have put into their game anyway. Sometimes to create full game for all platforms, these engines do not require writing any code. I was especially moved on the topic of alternative engines after participating in the Moscow conference of video game developers White Nights 2017, held in October. I approached indie developers demonstrating their projects and inquired about the tools they were using. In many cases, they did not call Unity at all, but Construct 2 or GameMaker Studio.

Both products are 2D game constructors that do not require programming skills (!). In Construct 2, you create a game by defining game events and the reaction to them. The resulting games are ported to all common platforms. The program comes with detailed documentation, lots of examples and templates, so it's easy to master. I advise you to buy on Steam, where its cost for a personal version is 6399 rubles.

How to create a game yourself. Construct 2 with an open project

GameMaker Studio is a popular game builder with two game building options (similar to UE4): the first is a drag method and drop, the second is to write code in the system's own language. Depending on the target platform, games created with GameMaker Studio are rendered using OpenGL or DirectX using appropriate shader technologies. For physics processing, there is support for the Box2D engine. A wide variety of input devices are supported. The desktop version on Steam costs 1599 rubles, exporters for other platforms need to be purchased: for example, an exporter for the web costs 2579 rubles, for UWP - 6396 and the same for mobile systems.


How to create a game yourself. GameMaker Studio

The third noteworthy alternative engine is AppGameKit. Unlike the previous two, when developing games with it, you need to write code in a scripting language. Largely due to this, he interested me more than others. The cost of this engine on Steam is 2,059 rubles, including exporters for all supported platforms. A good investment. For more detailed description the architectural component of the engine, I refer you to the mentioned article.

I used to look at these tools haughtily, but now I see a strength in them that can rival top-end engines. It's time to pay attention to them and take the game maker into the kit.

Where can I get art and other stuff?

If you are a programmer and do not draw / model well on your own, you can buy all the stuff you need for a prototype in the stores of top and alternative engines (for example). Art, sounds, shaders and other stuff can also be found on Steam. They are not that expensive. There may be several thousand images in one set, but they are all for different games, so they may be enough for a prototype, but hardly for a full-fledged release. And then, perhaps, you will find free artists who will be impressed by your performance. And this is correct, because when working with purchased art, you are forced to adjust your plot to the existing art, and not vice versa.

Game development with AGK

My choice fell on AGK for three reasons:

  • game development is based on writing two levels of code (Tier 1, 2); as a programmer, it is easier for me to get used to the new API than to the new editor interface;
  • the price is democratic;
  • I bought this engine two years ago, all updates come as soon as they appear.

Additional chips: AGK supports many types of controllers, so, in addition to gamepads, it supports the Leap Motion contactless controller. Plus, AGK includes VR support.

Visual editor

After starting AGK, we see only the code editor without any visual tools that other engines are rich in. However, in August, The Games Creator company released an application, a kind of add-on for AGK - the Visual Editor tool. It is bought separately (it costs 899 rubles). This editor allows you to visually customize the content of the scene and level of your game, import images and 3D models, place them in the scene as game objects, adjust the position, size, rotation angle, color and other properties using the object inspector. You can see how the scenes look on devices with different screen sizes without leaving the editor. Finally, the scene can be saved and connected to the AGK. He will quietly execute the code, as if this file was created here. The Visual Editor allows you to build games using the drag & drop method (not completely, but partially), like the other constructors discussed above. But, I must confess, this is not our choice.

The game can consist of several scenes (for example, main menu, game board, victory screen, defeat screen), all of which can be customized in the editor. Text fields, anchor points, animation creation, and more can be used.


How to create a game. Visual editor

Classic tanks

The AGK engine is equally well suited for creating 2D and 3D games. We'll focus on 2D for obvious reasons: popularity on mobile - targeted platforms is one of them.

We will try AGK on tanks, try to recreate "classic tanks" from the NES game console from 1985 with new graphics. Whoever is not in the subject, that game is called Battle City, in many ways it was she who served as a prototype for modern games about tank wars (World of Tanks, "Tanki Online"). Therefore, our world will also be two-dimensional with a view from above.

AGK Basics

We will conduct development on tier 1 (Tier 1) - a scripting language similar to the BASIC modernized for the needs of the game maker. The first thing to remember about BASIC is that you don't need to put a semicolon at the end of a statement. Relax and have fun: no pointers and low-level gimmicks, no classes either. Structures fulfill their roles. You can create an instance of a structure that is attached to a numeric constant. In the future, the assigned number is used to refer to this instance. When executing a function, to indicate which object the operation is performed on, you must pass the corresponding number in the first parameter. In fact, there are only three data types in AGK: integer, real, string. By and large, this is all you need to know before you start coding games on AGK.

Getting started coding

We will not use the Visual Editor, we will write all the code ourselves (see the example in the materials for the article). I will not provide listings of the game in the article, since you can always find them in the materials. I will only write brief instructions on the executable code.
Let's create a new project in AGK and start coding. First, we initialize the output window: set the title of the window, set its size, and indicate the ability to resize. Then we will set the resolution, the possible orientation of the device, the frequency of redrawing, we will set the use of the entire screen area, the last initialization action will enable the use of advanced vector fonts instead of raster ones. This code is included in the project template. Below is the main loop of the game: do ... loop. It displays FPS and redraws the screen.

After the initialization of the game, the type of data for the tank is determined, it does not matter if it is enemy or ours, all fields are the same. A type declaration begins with the Type keyword, followed by a type identifier, in this case TTank. First of all, each tank needs coordinates. In AGK, the declaration goes like this: x as float. Note that there is no semicolon at the end. The second way to declare variables is to simply declare them. For example, a variable of type Integer can be declared like this:

x = 4, real: x # = 4.4, string: x $ = "four"

That is, a character is added after the identifier. For the string type, you can equally use single or double quotes to specify a string, the main thing is that the closing one is paired with the opening one. Next, we set the identifiers for the sprite, for the collision, for the flag of determining whose side the tank belongs to: the player or the AI. Speed, rate of fire, number of lives, flag of defeat, timer that measures the number of seconds when the tank became defeated, flag that is set when the tank has reached an obstacle (needed for AI), two variables are involved in the turns of the tank: the flag, set at the beginning of the turn, and the number of the side of the turn (needed for AI). Type definition ends keyword EndType.

Then we declare a type for the projectile object. It needs: location coordinates, destination coordinates, id for the sprite, activity flag, ownership flag, and speed.

Let's create two arrays: one for tanks and one for shells. Something like this: Dim tanks as player. The same is with the second.

Now we need to load the textures. This is done using the LoadImage function, the first parameter is the number to which the image will be attached, and the second is the path and file name. All game resources are loaded from the media subfolder of the game folder. The media folder is created on the first successful compilation. Load the projectile image in the same way. Create all the shells in the loop. The loop description starts with For makebullets = 1 to 20, and ends with an incrementing loop variable: Next makebullets. In the body of the cycle, a sprite is created (CreateSprite with parameters: the sprite identifier, the number of the texture pulled over the sprite), its position is set (SetSpritePosition), the depth layer is set (SetSpriteDepth), the origin of coordinates for the sprite is shifted (SetSpriteOffset).

After that, we reset the values ​​of all parameters of the tanks to their default values, this is done by our resetplayers function. The CreateTank function is called from it. It receives as parameters: tank number (index in the array of tanks), coordinates, color coefficients, rotation angle, player or AI affiliation. CreateTank is engaged in the creation of a tank, determines the position, speed of movement, frequency of fire, angle of rotation. She also creates sprites for the tank, adjusts their colors, layer numbers. Next, let's load the background texture and create a sprite for it, plus we need a texture for the obstacle. Let's set the type for the obstacle - bricks. It will only contain two fields: the sprite number and the activity. The position is set at creation in the cycle below.

For the game, we need to load two sounds: a shot and a hit. This is done by the LoadSound function, which takes a numeric identifier and file name. On a desktop, AGK can work with three audio formats: WAV, MP3, Ogg, and on mobile with two, excluding MP3, due to the fact that this format is not free. We create several global variables: the current time, the number of the current level. We call the function to create the level. All code is in global space and will be executed when the game starts.

Next, we dive into the central loop of our game, whose body is executed 30 times per second (depending on the frame rate, on a PC it can be 60). Here, the first thing we need to do is get the number of milliseconds (GetMilliseconds) that have passed since the start of the game. Then we start the loop over all game objects - tanks. If the tank does not rotate, it is not hit and it can be controlled (for this we call the controlplayer function), on the other hand, we increase its rotation angle. We turn a certain tank in the direction of its motion vector. If the tank is spinning for more than two seconds and it has run out of lives, we reset its state (resetplayers). Next, the positions of all shells are updated in the movefire function and a check is made to detonate any tank - in tankhit. It returns the number of the damaged tank, which begins to rotate around its axis, in addition, the sound of a shell hit is played. The last function to be called is the screen refresh function.

The rest of the program code describes the functions used. They represent the most interesting part - the "live" algorithms of the game's behavior.

The controlplayer function, to which the number of a specific tank is transmitted, reacts to user input by performing the appropriate actions. Each key has its own ASCII number, so first we need to declare the constants corresponding to the keys:

#constant KEY_LEFT 37

#constant KEY_UP 38

#constant KEY_RIGHT 39

#constant KEY_SPACE 32

When the player presses the Up key, the Forward variable is set to 1, when Right, the turn variable is set to 1, and Left — it is -1. When you press the spacebar, if the tank does not rotate, a shot occurs (call of the makefire function with the transfer of the tank number), taking into account that the tank can shoot at intervals of 500 milliseconds.

Next, we will deal with the management of the AI ​​tanks. If the enemy's tank is at a foreseeable distance, our straightforward AI simply chases the player's tank. When approaching the target, he shoots. Therefore, the first step is to find the angle between the tanks. This is done using the FindAngle function. The coordinates of the first and second objects are passed to it. If the second tank is lower than the first, then the turn variable takes on the value -2, if it is higher, then 2. The next action is to find the angle difference. Then you need to find out the distance between the tanks. If it is more than 100 virtual pixels, then the enemy tank is moving towards the target. By the way, in AGK measurements are carried out in virtual units; if after starting the game they are left by default, the size playing field will be 100 by 100. The size can be arbitrarily changed, in this case it will only affect the location and size of objects. An enemy tank fires under the following conditions: a shot every two seconds, the relative angle between the tanks is less than 20 degrees, the distance is less than 500 units. In addition, in this function, it is necessary to prohibit the tank from leaving the boundaries of the play area.

The final check placed in this function is obstacle collision. In the loop, we go through all the obstacles, check that they are active, and then we look to see if there was a collision with the tank. If these conditions are met, we try to find the best way to get around the obstacle. When the user's tank participates in a collision with an obstacle, we simply turn off the forward thrust. When the AI ​​tank moves or turns, add the value of the turn variable to the current turning angle. Tank rotation: the X position is calculated by adding the sine of the rotation angle multiplied by 32 to the current X coordinate, the Y position is found by subtracting from the current Y the cosine of the tank rotation angle, also multiplied by 32. That is, when we apply the cosine or sine to corner, the rotation is performed at the origin, and in order to move it in the given direction, you need to multiply. Using the SetSpritePositionByOffset function, we position the tank. The last action is performed only during movement: it increments the X and Y coordinates by sine
and minus the cosine of the steering angle multiplied by the tank speed.

Also, the resetPlayers function stops and deactivates all shells fired by tanks, resets the parameters of tanks to their initial values.

Then, in the makefire function, activation, positioning, setting the motion vector and the speed of the projectile take place. At the beginning of the game, we created 20 projectiles and hid them off the screen, making them inactive, so that at the right time we would not waste time creating and initializing the projectile, but, having positioned it, immediately launch it. Therefore, in the function under consideration, in a cycle from 1 to 20, we check for the presence of an inactive free projectile. Once found, it becomes active, as a parent it is assigned the number of the tank that fired, the projectile turns in the same way as the mother tank, and the position corresponding to the tank is assigned. Using operations with sine and cosine, it is assigned a flight vector, then in the settankfiredest function, using a subtle mathematical expression, we calculate the landing point of the projectile.

In the loop of the moveFire function, we iterate over all the projectiles and for those of them that are active, we increment the position in accordance with the vector and speed. If the projectile goes beyond the boundaries of the playable area, we simply make it inactive, in other words, we put it in the list of ready-to-use ones.

The checkHit function checks if a shell hits any tank. The outer loop goes through tanks, the inner loop goes through shells. First of all, possible collisions of the projectile with the floor cell are checked inside, there are 192 of them in total, and their numbering starts from 200. If a collision with the floor cell occurs (the rocket has reached its destination), no further checks are necessary, we make the projectile inactive. The next check makes sure that the missile fired does not belong to the tank that fired it. If it passes, we check the collision of the projectile with the enemy tank. If a collision is detected, we reduce the number of lives of the damaged tank, stop the rocket, place it in the list of available for the next shot. This function returns the number of the damaged tank.

The makeLevel function, as the name suggests, generates a level map. First, we go through all 192 "bricks" in a double loop, making them invisible and inactive. Further we make visible only some of the obstacles.

The remaining three functions are of an auxiliary nature. Based on the obtained angle value, the wrapAngle function returns its equivalent value within the range 0-360. GetDistance receives four parameters - the coordinates of two points and returns the extracted root from the expression calculated by the Pythagorean theorem; thus, the function returns the distance between two points. Finally, findAngle, given the coordinates of two points, returns the difference between the two angles.

The game is ready, the code is written, you can run it. But first, do not forget to copy the necessary art from the materials for the article (from the media subfolder of the game directory). The art for the game consists of seven files.

Build preparation and distribution

Testing on mobile devices

We will not be able to play this game on a smartphone, since control from the keyboard is implemented here, but, of course, it is not on the phone, but we can still run the application on the device to test it.

When developing games using AGK, you can not only instantly test them on the desktop, but also test them on a mobile device without bothering to install the SDK and prepare the build. To do this, you need to download and install the AGK Player utility on your device.


How to create a game. AGK Player

I tested on an Android tablet, but there is an equivalent iOS version of the player. When the utility is installed, you need to connect the device to your computer (via a USB cable or via Wi-Fi), launch AGK Player, and on the desktop in the IDE AGK, click the Broadcast icon. AGK will connect to the device, transfer data, and your game will start in the player.

Export build

When the game is tested and debugged, a build must be created to publish it to the store. To do this, using the menu command File → Export Project "Tanki" → As Android Apk, open the Export Android APK window, in which it is proposed to set the properties of the package being created.


How to create a game yourself. Export Android APK

In the APK Settings area, the APK Type drop-down list prompts you to select the target platform: Google, Amazon, Ouya. App Name is the name of the application in the operating system, Package Name is the name of the package, for example com.yazevsoft.Tanki. App Icon is the icon for the application, Notification Icon is the notification icon, Oaya Large Icon is the Android icon for the Oaya game console. Below is the orientation and minimum supported Android version. In the Permission area, permissions are set - access to the components of the system on which our game will be run: recording to external media, access to the camera, recording audio, vibration, and more. The Game Google Services / GameCircle Integration area allows you to set an identifier for using Google services. In the Output area, you specify the path where the resulting batch will be saved. The Signing area allows you to configure properties for signing a package for placing it in stores: set a version, a signature file.

Alternative sides

At the end of the article, I will also add that you should not balk and distribute your applications / games only in the top stores - the App Store, Google play... The big publishers have taken all the places there, and buyers look at their products first.

Pay attention to alternative stores: Amazon AppStore, Opera Mobile Store, Yandex.Stor and many others. They have fewer users, less traffic, and less competition. I do not urge to limit ourselves to the three listed, look more broadly. The Android platform is in the lead, meanwhile, in addition to the Apple AppStore, there are platforms for the distribution of iOS applications.

The emergence of alternative stores is associated not only with the desire of their initiators to make money, it is also a matter of national preferences. The conversation is about third world countries and eastern comrades - these are India, China, Vietnam and so on. Outdated Android devices prevail there, and users of these devices are willing to make small payments for digital entertainment quite often. You just need to correctly understand this market. Therefore, it makes sense to release applications / games there in cooperation with local distributors. A subtle oriental soul, you understand. In the first place comes the need to localize their games for local users. In addition, games of other genres may be popular in these countries: just like everywhere else, casual games, various puzzles, action games, and races. Take a look at the following picture about market research. She will clearly illustrate the above.

Conclusion

Let's summarize. The article began with a description of the reasons for the emergence of alternative engines and an overview of the most popular ones. We then discussed the sources of art and other stuff for the games. Then, having chosen one of the engines, we looked at its basics and began to code with its help a simple two-dimensional game - classic tanks. We have developed a simple arcade game with obstacles, minimal artificial intelligence, two enemies and weapons. After that, we debugged our game right on an Android device, and when everything was ready, we put together a package for installing the game for any Android. And all this in one article.

The gaming industry as a whole, and even more so the indie scene, is constantly on the move, constantly evolving. The same applies to the toolkit of indie developers. It is progressing: new tools appear, old ones improve. If earlier I looked at many game development tools with an ironic smile, now some tools have reached a very impressive state. And, using them, you can create quite fun and modern-looking games.

Sometimes players, who often spend time behind various shooters, quests and other fictional worlds, want to create their own universe. At the same time, if you use the developments of people who are more versed in this matter, then it is not so difficult to create a computer game.

Let's consider some programs that will allow you to do this without programming. These utilities are called engines.

The best software for creating games

Game maker

It is a Delphi game constructor. Supports both Windows and Macintosh. Dignity that constructor in cross-platform, low price, integration with Steam. TO disadvantages Game Maker refers to something that is not convenient to create big games, 3D mode is not developing, the purpose of creating games for computers has transformed into games for mobile platforms.

Construct 2

This is a constructor for 2D games. With the help of it, games are created for iPhones, Androids, Windows and other platforms. This program for creating games free... If the creator wants to sell the game created with the utility, then he should buy a license.

In the special Construct 2 store offered by the developers, creators can buy special resources for their virtual worlds... Music, sets of sounds, instructions - everything is in it.

Unity 3D

This utility contains everything you need to create a great game. The program has a built-in engine that allows you to work with 3D graphics. Of the advantages, it also has special programs for the development of landscapes, sounds, as well as physics.

Minus Unity 3D is - a necessity of computer programming training from the creator.

3D Rad

This utility is downloaded and used for free... It is the cheapest among all the others that use a 3D engine. In 3D Rad you will find an intuitive interface. And also it has the ability to create online toys.

Game Editor

This utility from merits has an excellent set of templates, and from disadvantages- cannot import layered images, and if the user does not know how to program, then all his projects will be of the same type.

All applications created in Game Editor have open source... The utility is intended for those who have mastered C ++ programming at least a little.

Stencyl

This environment for creating computer games does not require any special knowledge in development and programming. All scenarios are presented as blocks... Those who love Photoshop will love Stencyl too. Since it has functions that closely resemble this program.

CraftStudio

Here you can add and modify objects not only in 2D, but also in 3D space. CraftStudio makes creating games fun and challenging. The interface of this program is intuitive. There are no format incompatibilities or conversion problems here. For those who have advanced knowledge of programming, there is a section - Lua Scripting... You can download the program for creating games from the official site.

Adventure Game Studio

The advantages of this utility are the built-in demo game, import of sound files. TO disadvantages include low quality graphics and the creation of a game of only one genre. Adventure Game Studio's interface is also not as simple as it might seem at first glance. But there is lots of tips... There is no Russian language version.

Arcade Game Studio

This is a clean and simple constructor. To work with Arcade Game Studio, you do not need to have programming knowledge to understand it. It was created for writing shooters, arcades, runners. Here you can make a game dating back to the 80's or 90's. For many fans of the old-school genre, these toys will go well.

Clickteam fusion

This constructor can read sensor readings, apply shader effects. Of the shortcomings it can be noted that the license is not available in many countries, and there is practically no documentation in Russian.

The main feature of Clickteam Fusion is that if a programmer creates a utility on a mobile phone, then it will be able to read readings from GPS devices. There is no Russian language, but you can download the crack file.

GameSalad

This constructor will be useful for novice programmers... You will come across a simple and intuitive interface. The utility allows you to add many sound files and pictures. GameSalad is easily cross-platform compatible.

The program for creating games on a computer can be purchased for a trial period of half a month for free, and purchase will cost at twenty-five dollars.

Visionaire studio

This program is suitable for those who love puzzles and quests. Feature of the utility in that you can work in a point and click style. Here you can choose which heroes will participate in the plot, change them, prescribe various commands, answers to riddles you have created.

The only problem Visionaire Studio is that only demo version is free.

Blender

This application is designed for making 3D animation and 3D graphics. This utility is absolutely distributed free of charge... It has a lot of tools and options. Therefore, it can take a lot of time to study it. But it's worth it. However, Blender does not have a Russified version. In order to translate it, it is recommended download crack.

Construct Classic

This program is designed to create 3D and 2D applications. Games created on it can use technology Direct X. Here, all actions are performed using visual design technology. Therefore, no programming knowledge is required.

In Construct Classic, you can connect your own shaders. Supports most plugins have a built-in Python interpreter.

Unreal Development Kit

This utility is the most popular engine among game developers. It supports X Box, PC, Play Station. The main feature the fact that the engine was created for the manufacture of 3D shooters. Here can be processed complex architectures, facial animations, physical objects. And also has its own library.

The Unreal Development Kit is free to download and use. But when you want to officially release the game, you will need to buy a license.

NeoAxis 3D Engine

This constructor, unlike others, has high-quality graphics and a relatively simple interface. Before you start it is recommended to master programming languages ​​C +, C ++. But there are special libraries already with prepared actions. NeoAxis supports shaders, shadows, lighting.

It is very user-friendly and easy to use. This engine was developed in our country. The Russian language is set here by default.

CryENGINE 3 Free

This engine can be considered the best of all modern ones that support photorealistic graphics, as well as Direct X technology. Far cry and Crysis were made on it. And also it allows create games for platforms X Box, Play Station.

Textures can be taken directly from 3D Max. CryENGINE is very popular. You can find a large number of teaching materials in Russian.

Kodu game lab

This engine allows you to work with many tools with which you can release 3D applications. Kodu Game Lab created companyMicrosoft... It has many templates, allows you to upload your own content, and has many built-in tutorials for working with it.

Defold game engine

This constructor is sharpened for 2D, but can work with 3D graphics. It is easy to create games for non-programmers on it. Defold Game Engine is suitable for application development for mobile phones, HTML5, lua scripting.

Amazon Lumberyard

This is a new construction set from Amazon. It is issued with an open source code... With the help of this engine, you can develop applications for personal computers, mobile applications. Lumberyard - free constructor. But if you want to connect additional features, then you will be asked to pay for them.

CryEngine 5

This is a game engine from the German company Crytec. CryEngine 5 version is less demanding on your computer specifications but the graphics don't get any worse. There is support Direct X 11 and 12.

GameMaker: Studio

This constructor is free version what we considered at the beginning of the review of programs for creating games. It allows you to create 2D worlds in a few hours. It is cross-platform. GameMaker: Studio makes it easy to create apps for mobile devices, personal computers, Mac Os.

Share this: