World of Tanks Blitz — how developers made dynamic suspension for tanks
The Big World of Tanks continues to develop actively — the game often receives updates, including both something related to the gameplay (new maps and tanks, game modes and seasonal events, crew skills and field upgrades) and something purely technical.
For example, the use of new graphics technologies. If we are talking about a PC, then there are many flexible settings here so that you can comfortably play with a beautiful picture, and the PC itself does not burn down.
In the case of mobile devices, everything is a little more complicated, and graphics updates are not carried out so often.
In this post, the render developers of the Wargaming MS-1 mobile development studio Ramil Kudashev and Alexander Babiy will talk about what is new (and beautiful) in the summer release of World of Tanks Blitz.
Careful, there are heavy GIFs inside.
We well remember how vividly the introduction of realistic physics in the big WoT was greeted. Remember, up to this point, tanks drove as if on rails, without leaving the ground. And when trying to run up and jump off a cliff, the tank instantly stopped at the edge. It was not the instinct of self-preservation of the graying crew — it was just that there was no physics then. But now it is there, and if you want to go somewhere with acceleration or jump from somewhere (and on someone), you can.
Mobile tanks have lacked such graphic dynamics for a long time, and we began to implement it with perhaps the most difficult thing — a dynamic tracked suspension. For each tank.
One of the most difficult moments here was not so much to draw everything and make it move beautifully, as to minimize the time that the artist would spend on adjusting the suspension of a single tank.
To do this, we refused to create a new geometry of tank tracks. In general, for dynamic suspension, flexible tracks are needed, which are easy to model from scratch. But this would require a redesign of the chassis on each tank, and there are many of them in the game.
So we decided to implement a modification of the geometry of the tracks programmatically.
That's how it works.
1. Based on the lateral projection of the original caterpillar, we build a contour - a closed polygon.
2. Its edges are divided into links with the help of additional points, at the output we get a closed circuit, which describes the contour of the caterpillar.
3. From the bottom of the original caterpillar, we take and programmatically cut out a piece of geometry — it will be used to fill in the links of the resulting chain.
4. The generated caterpillar is rendered in one rendering call. In this call, the cut geometry is repeated many times thanks to instancing. The transformation for each instance is calculated in the vertex shader based on the positions of the points of the chain passed there.
5. After all this action, we get a flexible caterpillar consisting of links. We can already simulate its physics - stretch or bend it as necessary, changing the positions of the points of the chain.
The rinks are the first to move when simulating chassis physics. We identify objects under the tank using raycasts, and then change the positions of the rollers so that they go around these objects. After that, the track chain adjusts to the new position of the rollers, taking into account this envelope.
There are two types of dots in the chain — attached to the rollers themselves (red), moving after the nearest rink, and free (white). It is the free points that form the movable segments - the parts of the chain that will stretch (like the nerves of the mechanical drive), bend or spread out on the wheels, depending on the location and direction of movement of the tank.
Thanks to all these transformations, the artist sees a generated flexible caterpillar. Actually, the only thing he needs to do is to correct the positions of the points attached to the rollers. And then, if necessary. Here the artist simply drags the desired points with the mouse.
And in order for everything to be absolutely beautiful and realistic, the artist needs not only to correct the points of the flexible caterpillar, but also to prescribe the parameters of the rollers. Everything is more complicated here than putting down the flag "So, this thing will move". It is necessary to determine which rollers and for what maximum permissible distance they will move, and then prescribe for them the parameters of deflection and spreading of the caterpillar: strength and speed.
This approach allows us to set up a dynamic chassis on one tank by one artist in about 20 minutes. For the 8.0 update in question, we have configured 456 tanks.
How it works in Large Tanks
For the older brother, Softskinning technology is responsible for the dynamic chassis and the beautiful curve of the caterpillar guitar. It is excellent, but much more demanding of hardware. If we used it on mobile phones, it would be difficult to play Blitz. But it's warm.
In fact, the main difficulty of the whole process for us was the large number of tanks in the game. It was also impossible to set uniform settings for the tracks, as with the magic "Make beautiful" button. It was not possible to take into account all-all-all cases that need to be processed in the code. The players are very creative. Very.
Therefore, edits were constantly made to the generation of the tracks themselves, and to the simulation of the physics of these tracks.
PBR — physically based rendering
In addition to the chassis, the game has a new physically reliable rendering of materials and lighting equipment. It uses the principles of light propagation in the real world.
Thanks to him, it turned out to make metal, rubber rims of ice rinks, various covers and other materials look much more realistic.
In addition, a global lighting scheme is applied to the tanks, which is unique for each map.
He is also responsible for the external changes of the tank, depending on what he is driving on — you can noticeably get dirty on a number of maps, then drive into the water: the dirt will wash away, and your combat vehicle will be clean and shiny for a while until it dries.
All these graphic settings can be changed. Of course, it's not as flexible as in large Tanks, but it's enough to comfortably play Blitz on a budget smartphone. Different settings have different "weights" — for example, the PBR described above does not affect performance so much. But the high quality of shadows is already significant.
And then we will try to continue updating the application in a timely manner as new technologies are released in order to maintain the visual component of the game at the proper level. On any devices. According to the developers.
Here in 5 minutes you can see a detailed overview of the 8.0 update.