📜 ⬆️ ⬇️

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

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. I will not dwell on things that were not included in the final version, and on minor features that are too long to write about.



This article is part of a series of publications called My Career .

Point system


First, I would like to talk about the point system used to navigate the NP. I did not develop its basic logic, but I helped with writing some client code using this system. Points are a kind of position, scattered around the space available for movement. As a rule, they are generated and arranged using special tools, but in some cases, designers add them manually. We have created several different selectors that identify these points (for example, a battle point selector or climbing points) and evaluate them differently. Points with the highest score value are used to indicate to non-player characters the path of movement.
')


Player following system


The NP following player system was taken from The Last of Us. According to its principle, NPs are chosen behind the player, followed by them, a certain position from several possible ones. The system considers only those positions that pass a series of straight-line clearance tests: tests are straight from the player to the position, from the position to the directly projected position and from the directly projected position to the player.



In The Last of Us there is no possibility of climbing on vertical surfaces. To properly implement it in Uncharted 4, we added a climbing point selector. He chooses climbing points for non-player characters to climb, following the player.



But it turned out to be more difficult. You can’t just give a command to follow the player when he goes, and use the climbing points when climbing the wall. If a player quickly changes the plane of movement from horizontal to vertical, the NP starts to move in spurts, unable to choose one of two states. Therefore, we added a slight lag to the logic of NP behavior, so that they change the state only after the player himself changes the state and thus overcomes some distance. Reception with a lag on the whole helps well to cope with jerks in the behavior of the NP.

Player reference system


In some episodes, we needed the player to follow the NP, and not vice versa. To do this, we borrowed the player’s management system from The Last of Us and changed it slightly. Routes of movement were marked for NP by complex curves.



At levels with more than one route, designers placed several curves that are turned on and off using a script.



The position of the player is projected onto the curve, and the leading reference point is located ahead at a distance set by the designers. When this benchmark passes the control point on the curve, labeled as a waiting point, the TM will go to the next waiting point. If the player goes in the opposite direction, the NP will return after him only when the point of the leading reference point is too far from the farthest point of waiting, which was overcome in the last stretch. In this case, we also added a lag to the logic of the NP behavior in order to avoid the jerks mentioned.

We also implemented a dynamic speed of movement. Taking into account the distance between the NP and the player, we have broken the curves of the routes into speed segments. NP can move in three speeds: walking, easy running and fast running. Depending on which speed segment the player is on, the NP chooses the appropriate driving mode to keep at a certain distance ahead. Designers can enable and disable these speed segments at their discretion. In addition, the speed of the animation motion of the NP can vary slightly, taking into account the distance from the player. This is necessary to minimize sudden changes in the speed of movement of the NP when changing the mode of movement.



Shelter behavior


The system of behavior in the shelter in the game The Last of Us has an interesting feature: the player can freely walk near the NP, and at the same time both of them will remain in the shelter.



This is also convenient because it allows Joel to stick to the wall, as if covering for himself Ally and Tess, who are much smaller. But in Uncharted 4 it would not look so good, because Nathan, Sam, Sally and Elena have a similar constitution. In addition, the pace of this game is much faster, and if Nate will have to stick to the wall in the same way while moving to the shelter, it will interfere with the smoothness of his movements. Therefore, we made it so that the NP simply pressed against the wall when Neith wants to pass by:



The logic is very simple: if the player's projected position, based on his speed, fits within the rectangular border around the NP covering point, the character changes his behavior and quickly presses against the wall, as in the picture below.



In the next part of the article we will talk about transport management, the behavior of NPs in the dialogues and localization of the game into Chinese.

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


All Articles