DIY tower defense

Good day!

I would like to tell you about my personal feelings about igrostroy after a year of work on my own project.

Until the first time I touched the game engines, I thought that making games was simple and fun. A team of talented people gathers and at some certain time they make a game without any problems, write its code and fill the environment with beautiful things. Yeah ... for some reason this is all true, but I did not expect that in reality everything is much more complicated.

Let me remind you again, this article is just a feeling of acquaintance with the game building, and a story about my little experience.


So here. It all started a long time ago - in March 2012. It was then that I first became acquainted with the game engine, or rather, what you can do there. But as it turned out, you can do everything! To do this "just" requires some knowledge of the programming language (JavaScript or C #). And then I interrupted - before that I had never programmed in my life (the editor of Warcraft III with its triggers and Thinking Particles doesn’t count - this is a completely different level), even at school there have never been programming lessons. Although there were, it seems, Pascal or something similar, but it was so long ago and it was not true that all the knowledge since then disappeared without a trace. I had to surf the Internet for training articles and video tutorials. The first lesson every 5 minutes resembled watching the official help on scripting, and this rule helped me very, very much in the future. Another complete shock for me was the need to write a few lines of the script for a very elementary thing - exit the game through Esc.

As a result, it turned out that programming is not so difficult. The main thing is to understand the logic of the program and the programming language (by the way, my choice fell on C #. It seemed to me more understandable and flexible). My first crafts were not particularly unique - to run somewhere, to inspect something, to press somewhere. Time after time, I felt better and better at writing scripts, and at some point everything became so “native” that I almost without hesitation and errors wrote one script after another. And here I got the idea to do something grand! To begin with, it’s quite small, but with rich functionality - this is how the project was born, on which I spent a month and a half, four weeks of which I was busy writing scripts! This was really cool - however, I realized that this was not enough. Yes, I was able to implement the change of day and night, switching cameras, many different modes of "game" and some other chips. But all the functionality was tied only to the use of various components in the editor, and only that. It was then that the idea of ​​creating a full-fledged game was born.

The idea (type) of the game was determined instantly - it will be a game like Tower Defense. Yes, of course not very original, but there are practically no real and full-fledged TD games (and even in 3D!). The first weeks of development went into creating the basic mechanics of the game, which subsequently changed more than once.

Still, scripts are the engine of the game, and without them, beautiful models will be simple models, and angry peasants will remain at the point of spawn (and even without a script they will not even spawn) in a silly pose of running.


Having estimated in my head what opportunities I would need at the tower, I began to write scripts. At first, two scripts were written - the first allowed the mob (the enemy) to have some specific health and blush as it decreases, and the second was just responsible for the shots at the tower. Everything would be fine, but it looked really stupid how the tower damages the mob, and the shell has not yet reached it. I had to edit ... and subsequently more than once return to the attack script to upgrade it. But what TD without the ability to install your own tower? Another script, and we can put the tower in the location indicated by the mouse. After a couple of days, the game took the form of a screenshot above, and it was time to do a more detailed study of the game.

And the first thing on the task list was to get the mobs to follow a predetermined path. I had never encountered this before, and I had to transport this task from half a day until I remembered about Pathfinding. Now the game has played with new colors! With burning eyes of happiness, I watched as my cubes ran along the new map, more precisely along the path of the new map! But then the first jambs with the tower appeared - it was simply not able to get on a far-running mob, and even in the sight it took only the target closest to itself. I had to change the scripts ... enter the second array and make a selection according to the farthest, but at the same time, within the range of the tower goals. Rejoicing at the correct operation of the script, I had to return to the problem when the towers simply didn’t hit too far targets. This is where school geometry came in handy :) Yes, now there is one less universal question - mathematics with geometry has found its place in life. Having tinkered with sines, cosines, several variables and ticking “shoot ahead”, the towers began to successfully hit targets wherever they were! And this did not require any “auto-guidance” - the shells flew in a straight line to the target and hit it! At this point, the game had acquired a pretty beautiful appearance and it was finally possible to play it, although only 5 minutes.


But ... something is missing. Really lacking. The game lacked depth - the monotonous shooting of mobs was not very interesting for the players. Then the first ideas of an already global game began to appear ...

The first thing I decided on was to connect the game to a social network. This gave me the ability to "authorize" the user to store his records and some other information. After that, thoughts went in a huge stream, which it was sometimes very difficult to grab onto.

The result of reflection was that the player will have his own settlement, the development of which he will be engaged in all his free time from the game. Three professions will also appear, one for each type of resource (wood - forester, stone - mason, magic - mage). The towers can already be bought not only for gold, but also for resources - to choose from.

Until the middle of winter 2013, I tried to make a working game with all the bells and whistles that I came up with. He even announced closed beta testing, which 20 people signed up for. Development went on as usual; I had to learn how to work with MySQL + PHP along the way. It was a long time, it was difficult. Another stone on the way was VK.API. Oh, how much time was spent on understanding the principles of his work ... I recall that at that time I was only programming for less than a year, and there was still not much experience to understand what was written in the help on the fly. Nevertheless, although belatedly, the game entered the PTA stage, and for the first time, people were able to play it.

Obviously, the first pancake came out lumpy. A bunch of bugs, non-obvious (but for me they were obvious, I did it all) opportunities, the lack of training and a clear understanding of what was happening, made me nervous - the players were not happy, although they liked the game itself. Development went on as usual, testers report on bugs found, some of the bugs were quickly corrected, others were put in the "queue". At that time, I first felt like a developer - without the participation of testers, there was some dissatisfaction with what I was doing.


But then it only became more fun. Announcement of MBT and blind vision of the "completeness" of the game. The emergency pace of work on the project, sometimes I went to bed only at 3-4 a.m. (I played the game in my free time). Nevertheless, many important features of the project were finalized - editing the village, building buildings, the market, and much more. Added 4 game levels to the game, now at least there was something to play.


On my birthday, I decided to open access to the game to everyone and look at the reviews. At that moment, about 70% of the core of the game was “ready”, and indeed it was possible to allow people to test.

The result again turned out to be quite funny - everyone had the same bug related to my decision to slightly change one of the models without checking the result. As a result, when everyone started the game, they watched a warehouse floating in the air in the village.

In two days, 330 people played the game, and according to the survey, the average grade point was 7.82. I don’t know whether this is good or bad, but I think that you can make a discount on the incompleteness of the game and ...

The concept is not fundamentally, but has changed. Based on the testing, the weaknesses of the project were identified. And one of the most obvious is the lack of an "avtivnogo" gameplay. Players simply came into the game, launched the level and set up towers wherever possible. Then they left for a few minutes from the computer, and upon their return they were waited for by the passed level and reward. It was necessary to change something ...
Again, reflection, pondering the situation. Also, many complained about the wretchedness of the interface (I admit, it really looked wretched), and it was urgent to take action.

From that moment began the "real" development. Based on the experience gained, some important conclusions were made, and the game moved to a new stage - the alpha version. Beta didn't even smell here.

Before continuing, I would like to give a couple of tips to beginner developers:

1) First of all, a full reflection of the idea and concept of the game, a record of all the possible features of the gameplay. It seems like it's called a design document, and I highly recommend thinking it over before starting development. Critically recommend.

2) After compiling the design document, think about all the possible models in the game. Make a clear plan for modeling - what you need first of all, and what can wait. A clear plan will always help you orient yourself when a development thread is lost.

3)When writing scripts, think about the “scalability” of the project. Provide places that could be useful in the future and consider the possibility of their use outside the script where you write this whole thing. I hope the idea was clear.

By the way, one of the very unexpected stages of development for me was the interface. That's what I did not expect - so that you can do it forever. I began to remake the interface at the end of summer, and I am still working on it. Of course, not as active as I could, but the interface takes a surprisingly long time. This should also be taken into account by many novice developers, because sometimes they don’t even think about it the same way as I did not think about writing the Esc button to exit the game.


Now, I’ll probably voice another obvious thought, but - when creating a multi-user game (especially for social networks), try to do as many checks as possible on the server of the actions that the player does. During development, I, of course, looked at competitors. And some of them had huge problems with protection against hacking.

I also highly recommend using interpolation for smooth action. In Unity3D, almost any variables can be interpolated between each other ( Mathf.Lerp (), Vector3.Lerp (), Color.Lerp (), etc. ), which allows you to transform the interface, or various movements in the game in several lines. Honestly, this also became one of the revelations during development.


Well, the last thought: game dev is difficult. This is not a rainbow of inventing an “open-world zombie apocalypse, World-PvP and caravan robbery”, it’s really hard work, especially for a loner. You need a lot to be able (programming, modeling, animation, Photoshop skills, knowledge of post-effects, shaders, software tools, the ability to create music, a beautiful voice for voice acting, and much more) to complete a complex project alone. That's why I'm trying to attract a small amount on the domestic boom starter - I really miss the composer, sound engineer and translator. Few people are interested in browser games, and I don’t think that I can get the right amount. By the way, the first thing I’ll launch the game on facebook, and it will also be a lot of problems. They say that without expensive PR it will be very hard there.

Thank you for your attention, I hope you liked the article and maybe you will take note of some of my thoughts.

Also popular now: