I want to share my acquaintance with game dev. Share how I started my journey with XNA. I would also like to tell you how I became a programmer, eager for more control over a computer and how I got involved in writing my own engine in C ++. I will tell about knowledge of ready decisions, such as Unity3D and show on the examples that from this it is possible to make.
Foreword
Once at my first job (as a programmer), my immediate superior asked if I had ever written games. The first and last (up to this point) my acquaintance with igrodel was twenty years before on the ZX Spectrum on Basic. No documentation, no internet and habr. Elementary knowledge in programming - that's all. In general, the game I did not do. The boss asked another clarifying question: can I write a game in C #? I started to laugh, but he threw a link to the forum that mentioned XNA. ')
XNA / C #
XNA was a good start for me. I already felt good enough programming in C #. Also quickly found a community on this technology. As it turned out, XNA was developed by MS specifically for learning how to work with 3D graphics. Essentially, XNA is a wrapper on DirectX.
In any book on XNA describes the basic principles of the game. Such concepts as the life cycle of the game, which occurs every frame in the game and updates the statuses of objects and renders the finished frame, camera, projection, transfer of vertices to the video map and display of 3D objects in space and more. To understand at a low level how the game is arranged, you still have to, even if you use ready-made engines, such as Unity3D.
So he began to study and delve into. Along the way, I had to remember trigonometry and a bit of mathematics, in particular, on matrices. This school program is not over. There is such a thing as shaders, roughly speaking, code that runs on a video card. In them, as a rule, calculations are made over the position and color of pixels. A convenient place to calculate reflections, glare and other things. To do this, I had to study more literature and, in passing, physics.
I myself began with the book “3D Graphics with XNA Game Studio 4.0” by Sean James.
It is well in order decomposed material. Mathematical necessary knowledge is also described, and by shaders. And so, when your cube in space finally appeared on the screen, you begin to wonder what to do next. Along the way, I decided to make a game in the towerdefense genre and in 3D. This genre is easier to implement, and 3D - because I am not an artist and drawing all objects from different angles is a problem. Actually, here and a new task - to study the 3D editor. Well suited and 3Dmax or Blender. XNA is chewing fbx format and these editors have exported models to it well.
And so, all applications and all technologies are known. Everything you need to create a game is ready for use. Armed with books and Google ... I lost all my free time after work.
The first results of effort:
On the video there is a model "dude", which borrowed from the Internet. But as you can then be sure, it is not difficult and interesting to create your own models with animation, even for me a programmer.
Describe in detail how and what was done is not necessary. A lot of material on the Internet. Yes, and on the video you can see my steps. I would like to note one thing. When you write your own engine, your shaders, then you need to spend time on it, perhaps not a little. So, for example, I understood how to make shadows. He studied the technique of cascading shadows (do not be afraid of such terminology, it is not as difficult as it sounds).
How much time I spent so that my shadows lay down like that, I do not remember exactly. Probably a month or two. On Unity3D, all you need to do is just check a couple of checkboxes on objects on the scene.
So, little by little I studied the material and wrote the game. Every day, constantly. The main thing in this business, when you make one game, engine, content and everything, is to train yourself to do it all the time. In such a situation, sometimes you want to do whatever you want, just not a game. Read various articles on "how I wrote my first game." It gives time to relax and be inspired. But abusing such articles there is a chance to remain in dreams, having abandoned the development.
Making my first game, I reached the moment when I would like to launch it already on the device. I did on XNA with the hope of putting the game under the XBOX. At that moment, it turned out that it was impossible to spread my games from Russia under this console. But I can put it in the market for WindowsPhone. I completed the game and put it in the market. I did it as a result of 10 months. From the beginning, as I learned about XNA, and before the release in the market.
It is worth noting one thing. Putting the game into the market is another story. Marketing, promotion. This is the whole article and in a nutshell is not enough.
Everything seems wonderful, the quality of the content in my game is just on the phone (well, not the artist). But the XNA phone has limitations; you cannot use your own shaders in the screen resolution. And what is needed so that there are no restrictions? It is necessary to use a native language for this OS. For these purposes, perfect language C ++, and for graphics - DirectX.
DX11 / C ++
So I decided to feel complete freedom, no restrictions under the platform. Any shaders that I want and can write, any logic. It was very appealing, but I realized how much time I would spend on learning the next language. It was a bit scary, and besides, I already met Unity3D and could appreciate how easy it would be with it. I could already appreciate this after writing my first XNA engine. And here and even lower level, and language, and work with graphics.
After some hesitation, I started doing something in C ++, then in Unity, but then I realized that I would still suffer and want complete freedom. Made up my mind.
In principle, I was already familiar with the basics and with the necessary knowledge of mathematics and physics, plus there was the experience of writing shaders. What I had to learn was the C ++ language itself (especially the work with links) and DirectX. Fortunately, there is a good book on this all: “Introduction to 3D Game Programming with Direct3D 11.0” by Frank Luna .
Armed with a book, Google and perseverance, I began to make the game. Making this game turned out to be emotionally similar to the first. I started it with great enthusiasm, but the way things came up was to give up and rest. The most difficult thing for me was to make models. I just could not think of them. However, to make the model itself even a live character and pin skeleton animation on it is not very difficult:
Psychologically difficult moment, when the engine and the whole logic of the game is written, it remains like a sweet, to make models and everything. However, this is the most annoying. I wanted to spend no more than a day on the model. After all, if you count the number of levels in the game (unique ones), the number of objects, “enemies” and other things, you can go into modeling for half a year. It did not suit me and wanted to complete the project as soon as possible. As reflected in my games. Catastrophically lacked the artist.
As for the first time, with the thought “I will never make games again,” this project was also completed. I have to say that the models could have been even better with my hands, but I’m quite happy with what I did.
As a result, the game I did again, 10 months. This is taking into account that knowledge already existed. A lot of time was spent on your engine. A piece of this article does not reflect the effort spent on developing the game. So, for example, on Unity, you can “sketch” models onto the stage for the day, attach your scripts to them and even use shaders - the level is ready. At this rate, I could make the same game with these models for about three months (by very modest standards). In this case, the game would be not only for WP, but at least for Android.
Unity3D / C #
Having gone all this way (I made games at home after work, sacrificing rest - and so for two years), I wanted to make a game on a ready-made engine, some simple one. To do this, decided to make a game in the genre of "Three in a row." The genre seems to be easier nowhere and it is convenient to play the phone, especially in the subway and with one hand.
The engine itself is intuitive, I would say. Yes, and a large community, you can google almost everything, for a beginner, for sure. If you make the game almost like a constructor - really easy and even pleasant, then I didn’t guess the “genre is simpler”. But this complexity refers to the code of the logic of the game.
So I got an experience I was interested in in game development. Writing your engines makes no sense (against the background of existing ones), and there is no such goal and desire. I now understand how the games are arranged. Writing my games remains a hobby for me. And in the presence of such engines it is almost not necessary to write them. Elementary scripts - that's all. Shadows, reflections, post-rendering, normal mapping, etc. become just a tick. You can calmly focus on content.
Epilogue
For myself, made a couple of conclusions:
If you are interested in thoroughly understanding how this all works and works, there is a desire to communicate at a lower level to the OS, then you can start with XNA or similar tools on other platforms.
If you are focused on earnings, you have a team (artists at a minimum), or you want without going into details “to write in a quick way” your game, then it’s better to start with ready-made engines.