📜 ⬆️ ⬇️

Min-Long Chou: What I designed for Uncharted 4. Part 2

The official release of the game Uncharted 4 has already taken place, and now I can tell you exactly what I was developing for this project. Basically, I was busy creating artificial intelligence for a non-player character (NP) from a single game and for bots from a multiplayer, and also worked on some game logic. In this part of the article I will talk about transport management, the behavior of the NP in the dialogues and the localization of the game in Chinese.




The previous part of the article is here.
')

Doctors


Doctors from multiplayer mode had to set up a completely new type of behavior that is not found in any single player in a single game: watch out for wounded allies and repeat the behavior of the players in the shelter.



Doctors are trying to imitate the behavior of the players in the shelter and keep as close as possible, if necessary, to quickly come to the rescue. If an ally is wounded nearby, the medic will revive him, provided that the player is not injured at the moment. If a player has a RevivePak mod, doctors will throw a first aid kit (RevivePak) before running to the rescue - this helps save time for recovery. When throwing a first-aid kit, the logic and animation of a grenade throw is completely repeated, with the only exception that a first-aid kit is used instead of a grenade.



Stealth


Another novelty in the game is the high grass areas, which increase the player's secrecy and allow you to sneak in unnoticed. We plotted grass plots so that, from the point of view of game logic, it would be clear when the player becomes imperceptible. Initially, we planned to instruct the artists on the backgrounds to create a collision model for grass sections in Maya. But communication between artists and designers greatly increased the iteration time. Therefore, we chose a different approach and stopped at the markup of the plots, as shown below. Designers got a new tag that allows you to mark up areas with high accuracy. Having these additional data, we can also estimate the points of secrecy based on whether they are in the grass or not. This optimizes the behavior of the TM, allowing them to understand when the player enters the stealth mode, and repeat after him.



Alarm levels


Since there is no hearing mode in Uncharted 4, as in The Last of Us, it was necessary to think of a way to inform the player about the threats in order not to take him by surprise. Therefore, we have implemented color alarm indicators, which are based on data about the perception of the environment by opponents. Indicators notify the player that the opponent will now notice (white) or has already noticed (yellow) suspicious activity near itself, or has discovered the player (orange). Together with the indicator, we use a buzzing sound on the background that creates tension, as well as a sharp and short sound (as in The Last of Us), signaling that the presence of the player has become known.



Inspections


This is one of the last major features of the game, in the development of which I participated. There was a period when rallies were held in Naughty Dog almost every week under the direction of Bruce Straley or Neil Drackmann. At these meetings, special attention was paid to the development of AI in the game, and almost every one of them made a decision to change or modify something in the inspection system. With it, we had to go through a lot of iterations, before it turned out that, as a result, it was included in the final version.

When opponents notice something suspicious, they go to inspect the relevant site. Usually this is caused by two circumstances: the found body or the signs of the immediate presence of the player. An adversary who has noticed a suspicious activity will try to call one of his buddies nearby to conduct an inspection together. The one who is closest to the source of suspicious activity becomes an inspector, and the other - an observer. Accordingly, the one who noticed can get any of these roles, and especially for this we have worked through various options for the dialogs: “I noticed something there, I'll go check it out” or “I noticed something there, go check it out”.

To make the beginning and end of the inspection look natural, we varied the actions of the opponents and the time to normalize their alarm indicators. Thus, the inspector and the observer will not act mechanically, simultaneously performing the same actions.



If a body is found, the inspector will immediately understand that the player is somewhere nearby. He will finally come out of the state of rest and tell the others to start looking for a player. The detected body will also be highlighted, so that the player knows exactly what has issued it.



At higher levels of difficulty during inspections, opponents may behave more aggressively, increasing the chances of finding a player who is hiding in the grass. At the Crushing difficulty level, opponents will always behave aggressively during inspections.

Dialogue behavior


Dialogue behavior refers to logic that forces characters to react to each other’s cues in a certain way: with gestures, attitudes, etc. Previously, The Last of Us development team took several months to manually write reaction characters for all dialogues. . But we did not want to do the same amount of work. We had some dialogs with manually-written behavior, but we needed a system that would take care of the other replicas. Animators got the parameters to adjust the speed of turning the head, the maximum angle of rotation, the duration of the look, etc., and in the end we managed to achieve good results.



Transport management


One of the first difficulties with the driving system, which arose when testing at the level of Madagascar, was that when it collided with the wall or machine of the enemy, the player’s jeep suddenly lost speed. As a result, the player was behind the convoy and lost the level.

I suggested temporarily limiting the angular velocity and changing the direction of the linear velocity in a collision. In the end, this simple solution turned out to be very effective, and now the risk of losing due to a sharp loss of speed is minimal.



Vehicle damage


In Uncharted 4, for the first time in the entire history of the line, it became possible to drive vehicles. In previous parts, the NPs were driving and the movement was carried out strictly along fixed routes.

I helped design the damage system. There are many ways to disable the enemy's transport: shoot at it a sufficient number of times, kill the driver, knock down a motorcycle, or ram and turn the opponent's jeep with your jeep. Depending on the chosen method with passengers, this or that animation will be played. Realistic images are created through the use of ragdolls with all the laws of physics. As a result, the animation goes smoothly into the physical simulation of the wreckage.



To imitate the destruction of a motorcycle from a collision, we used two types of data: the intersection of its invisible frame in the XZ planes (see image below) and the point of contact with the player's car. Based on these data, the system selects one of four animations of destruction.

As for the jeep's coup, for this, the rotational deviation of the jeep from the desired direction of movement is checked with the coup threshold.



When playing a destruction animation, there is a chance that a car or motorcycle will pass through the wall. To solve this, we used a sphere stretched from the point of the ideal position of the transport along the path, as if it had not been destroyed, to the point where the transport itself is located. If the sphere comes into contact with the surface, the transport shifts in the direction of the normal to the point of contact, as far as the degree of penetration requires. All this happens gradually, over many frames, and thus the collision is prevented.



We also developed a particularly spectacular form of transport disruption, for which a number of special animations of destruction, context-sensitive and able to interact with the environment, were created. Animators and designers placed a number of so-called windows along the curves along which the movement of traffic is expected. If a player destroys an enemy transport unit within such a window, a special destruction animation is triggered. One example is the epic explosion of a jeep in demo 2015 E3.

Bayer Matrix and Dithering


We didn’t want the camera to simply cut off objects of the environment when it comes too close to them. This was especially true for foliage. Therefore, we decided to blur pixels in pixel shaders as they approach the camera. Using transparency would be too expensive, and besides, there is a lot of foliage in the game and this could affect performance. We resorted to dithering . When combining the pixel distance from the camera with the Bayer structured matrix, part of the pixels were completely cut off, creating the illusion of transparency.



Initially, we used the Bayer 8x8 matrix, as described here . But it seemed to me that it was too small, moreover, after it, there were artifacts in the form of concentric circles in the picture. I wanted to use a 16x16 Bayer matrix, but it was not found on the Internet. As a result, I tried to analyze and rework the 8x8 matrix pattern and revealed a pattern in it. Of course, you could do it manually, but I wanted to have a little fun, and I wrote a tool to generate Bayer matrices for any power of two.



Replacing the matrix, we have made significant progress in the fight against artifacts.



Delay sound during an explosion


This is a very minor edit, but I would still like to mention it. A couple of weeks before the release of the 2015 E3 demo, I noticed one thing: during the explosion of the tower, the sound from the explosion came immediately, and not with a delay. It was wrong, because Sally and Neith were at a decent distance from her. I reported this miscalculation, and as a result, the sound delay was added to the final version of the video.

Localization in Traditional Chinese


It so happened that I was able to familiarize myself with the localization into traditional Chinese just two weeks before the release of the game. To my surprise, I discovered several errors there. Most of them were due to a literal translation from English, as a result of which the text looked unnatural. I did not expect to complete the entire game in Chinese in such a short time, simultaneously revealing translation errors. Therefore, I asked several people from the QA department to go through separate chapters of the game in Chinese and record it on video. Then I looked through all the videos and noted the errors found in them, after which I transferred all the materials to the localization team. Thus, we managed to correct all errors in time.

That's all


That's all I wanted to tell. I hope you enjoyed my article.

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


All Articles