📜 ⬆️ ⬇️

Falcon anatomy


We recently announced the development of the Falcon Age game about growing an adult bird from a falcon chick and jointly opposing forces seeking to colonize the planet. Falcon Age will be released in 2019 on PS4 and PS VR.

Last week we showed the game on PAX and got great reviews, especially about the falcon itself. Let's take a closer look at its design, animation settings and rig, AI and navigation, technology for creating feathers and sounds of a predator.

Falcon design


Chandana Ekanayake and Derran Coldbath are told.


The design of the falcon combines different types of birds of prey. Our falcon is the size of a golden eagle, it fights like a hawk, resembles both an eagle and a hawk, has a topknot like an owl, and care of it is carried out like a falcon. She is one of the last representatives of her kind in our world, and we wanted to make her appearance unique and suitable for the plot. At the same time during the game process it should stand out against the sky and deserts.


One of the first sources of inspiration for creating the Falcon Age was video of golden eagles hunting large mountain goats. We began to conduct research on falconry, and we had the idea of ​​taming a falcon and creating a mechanic and gameplay based on this. In the early stages of development, we created a rough prototype to test our concepts. As soon as we whistled the bird for the first time in VR, and saw how its scale was changing, it approached us and sat on our hands, it became clear to us that this could become the basis of a unique game.

Animations and rig


Says Aung Zaw Oo.


Falcon paw tracking

There are a lot of animation options, but none of them could solve our falcon paw tracking problem in a simple way. Systems with inverse kinematics, root motion and other complex plugins would allow us to cope with the work, if we had a bigger team and enough time. We wanted to achieve a more predictable result, so we chose a solution based on the set of poses created in 3dsmax.

However, the most important reason for rejecting IK was that it was the best solution that I found in a couple of days. At the beginning of the project, we assembled a prototype so quickly that we did not have time to consider other available solutions. It was the most reliable and least awkward way I’ve found, so since then we have been sticking to it. No need to repair something that is not broken.

This is how I imagined mixing the movement of bird claws in real life. A ball is a fist attached to a VR motion control device. This method has limitations. The claws should be able to bend around most of the fist, and the fist posture should be as spherical as possible.



Note that the head and legs are at the same level of hierarchy in the pelvis. This simplifies masking bones and creating separate blend trees. Do not pay attention to the word "eagle" ("eagle") in the title. It was just the name of the temporary asset before we decided on the design of the bird.


A short version of how this was done: the fist is a ball, and the paws rotate around the ball with 30 poses of mixing and prancing through the paws to bring them back to the center when the ball (moving hand) turns too far.


30 Blending Poses on a ball


Animation of stepping allows you to return the paws to the center.

Mixing begins again after a short animation of stepping out of a new turn of the hand. According to our programmer Justin, he implemented it with the usual quaternion formulas and linear algebra. And I use the three float values ​​that it gives me, and pass them to these animation blending states.

In the chick, the second joint of the index finger is treated as a ball.


The only borderline case in which the ball idea does not work is when the glove is pointing straight down, as shown in the figure below.


We could cope with this case in various ways. One solution is to add a collider to the part of the glove on the forearm collider so that the bird takes off when a collision with it occurs. But in the end they decided to leave everything as is. This is more player-friendly: you can scratch your left thigh, and the bird will not fly away in VR. In addition, most people never tilt their hands while playing.

Only if they for some reason do not play, standing on his head.

In the headstand, all animations will look incorrect or broken.



Falcon Head Tracking


Briefly tell how we have achieved this; The head (bone_Head) is the first child of the topmost object in the bird's skeletal hierarchy (bone_Root).

The position (not the rotation) of the Bone_Root follows the position of the motion controller and the bone_Head counteracts this movement. In essence, this is a two-object hierarchy in which position mixing is used to counteract the movement of the parent object in order to preserve the global position of the child object. The rest of the bird's body uses a mix of 27 poses for the most natural position of the bird.


Taking into account the size of the adult bird, moving 12 cm across all axes (cube size 24x24x24) turned out to be ideal for obtaining a stabilizer effect without pulling the neck out too much. The head will move on the border of this range, and when the hand with movement tracking stops moving, the new position will be considered a new center around which another cube with a side of 24 cm is created. From a mathematical point of view, head stabilization is just a vector transformation with many different appendages to limit the speed, start and end of the transition, move the stabilization point when it is too far from the body, and the bird is still in the area.


Navigation and AI birds


Justin Lovely narrates.

When the bird is bored

Most often the falcon obeys the orders of Ary (the main character of the game) and follows her. If it is too long to stand in one area, while the bird just flies in circles, or if you let it go without giving orders, then it will start to look for work in the area itself - usually to hunt or land on various important points of relief. She also takes the initiative when she sits on the Are and someone tries to grab her, and likes to show Aare the next hole while playing lightning golf.

The sun blinding the victim

Some prey species, such as rabbits, are very shy, and when they see a falcon diving in the air, trying to grab them, they run to the nearest hole. It is much more difficult for them to notice the Ary bird when it approaches from the sunny side, so you can simplify the capture of prey if you pay attention to where the light falls from and send the bird from this direction. On the other hand, it may be quite enough to just dive down from a height, because the bird will be able to gain more speed before it is noticed, giving the victim less time to escape.


We go quickly and from the sun to accurately grab the prey.



Falcon 3D navigation

Usually, in the standard set of the game engine there are no mechanisms for reliable movement of a flying animal in 3D space, which in this case would look natural. We have about three levels of bird navigation logic, performed to move the bird from point A to point B, so as not to complicate the system too much and not get stuck in the corners.


For high-level navigation, which allows you to find a route around the world, we build a 3D navigation graph and use the A * algorithm to find the path. In this implementation, it is rather unique that to perform all operations on finding a path using the A * algorithm, we use a fairly new Unity task system. It provides a fast search, not loading the main thread, which leaves more time for AI, physics and other aspects. Most of the graph is generated automatically, and for passage through narrow openings, for example through windows, the connections are placed manually, because they are small or require landing at a right angle.


The purple line is an approximate way to fly around large rocks in the middle, where the falcon begins to fly and Macaw stands. The bird does not seek to follow this line especially closely; if that were the case, she would have made very strange and abrupt turns, so if you can get to the next part of the journey without hindrance, then she will go there.


Sometimes on the way she may come across small or moving objects. A falcon looks forward and flies over or near these objects. The rock is big enough to navigate around with the usual A * algorithm, but I made it “forget” about it for now. Here, in order to go around the rock, the bird turns left - the red lines show where it looked in the last few frames. I usually try not to do that, but A * navigation can make a bird fly under arches or bridges.

The last level of bird flight logic is the logic of maneuvering itself, the choice of how quickly a bird decides to fly, how much it needs to climb or descend, how to turn quickly, how it applies physical acceleration, what restrictions are placed on its actions to get to the end point. This data is transmitted to the system of animations, informing how actively the bird works, what type of pose it should be in, whether it should turn, etc. This system is quite closely related to avoiding objects, but all navigation A * is completely separate. It uses a large amount of mathematics and logic.

Feathers and Rendering


Says Ben Golus.

The small feathers on the body, or the contour feathers of our bird, sway in the wind and react to the player's smoothing hands to add a deeper sense of tactile interactivity. The way PAX was implemented in the demo was a hack, so I hope to replace it before the game is released. (Of course, this means that exactly this solution will be implemented in the finished game.) In short, each small bird feather is considered to be several shaders of grass or vegetation. To calculate the simple noise of vibrations of feathers, several superimposed sinusoids are calculated, which gives the feathers a natural look. Their temporal changes are offset by a random value for each pen, stored in the vertex color, and the swaying motion is also scaled according to the vertex color. This means that the base of the feathers, unlike the ends, does not move. It also means that long feathers move more than short ones.


We want the feathers not to move in random directions, as in most grass shaders, so you cannot use the directions of the world or local space. Plus, they are on the skinning mesh, which makes the direction even more dynamic. Therefore, I used a combination of normals and tangential vertices of feathers so that the feathers sway in and out, as well as in different directions relative to their orientation. The system is not very accurate, but with such small movements the errors will almost not be noticeable.

For processing interactions with the hand in the player's hand, there is a script that tracks the bones and creates a list of capsules that follow the shape of each finger, and a sphere is used as a palm. If the hand is in the area of ​​action, then the vertex shader bypasses the list of capsules and finds the shortest distance to one of them, and then smoothly scales the fluttering if the capsule crosses it. In addition, feathers pressed to the body. The capsules have an increased size, because the overlay checks are soft, that is, they switch not abruptly, but with a smooth transition. All this is set up approximately so that when the visible finger touches the pen, it would completely stop and hang down.


Here is a test of the earlier version of this system. You can see how the feathers react to the sphere even before they touch it, but the interactions still look convincing.



For the final release of the game, I want to create a system with a geometric or computational shader that would solve some of the problems arising from touching only one of the feather tips and eliminate the fact that the illumination normals of the feathers do not change when they are touched.

Falcon Wound Information

We wanted to somehow show when the bird was injured, and not to use health bands or similar mechanics. To show that the bird is tired or hurting it, animations are used, but we still could not quite clearly convey to the users that it had taken damage. In order to clearly convey her condition, we decided to show her physical injuries with blood and disheveled feathers. The obvious solution would be to replace the materials. However, we wanted to show a gradual increase in damage, not just a hard “eat / no”, and did not want to create many different cards. We also had a problem with the fact that most of the feathers use the same UV coordinates, that is, the whole bird will be covered with bloody stains.

As a result, we came to a two-part solution. The first was feather damage and shabby. The alpha channel of each pen is configured in a special way so that the damaged and intact versions are in alpha with different opacities. To switch between two states of pens, alpha values ​​are used (in fact, this is alpha to coverage). 50% of opacity means normal health, and 25% of opacity means wounds.


For blood stains, the bird has the second UV coordinates of the blood texture, so we do not need to reuse the UV coordinates of the texture of the pen itself. The blood is mixed on top of the base texture. As a result, we need only one set of basic textures, one set of blood textures, and this is enough for obtaining different effects of wounds on the bird.




Sounds of a predator


Says Rob Pearsall.


We did not want the bird to be different (for example, to be futuristic or magical) from any other bird in the world, but simply combined in it the different features of several flying predators (they only added a hat to it). Therefore, there was no point in creating for her a voice that sounded "with cinematic quality" - it is enough that he worked and was believable.

In other words, I could “borrow” the cries of any predator that would convey to the player information about different moods, feelings and responses of the bird. I listened to sounds made by predators. To my surprise, the largest and most impressive predator, the eagle, was the worst sound of them all. He was the first in the list of "better not to use."

Hawk is always a great choice. Everybody loves the hawk to scream. I used to think that all sound producers have one record of hawkish gibberish, and that all hawks have the same sound in all films. But it is not. As it turned out, these hawks all sound the same. Almost no difference. Don't get me wrong, the sound is excellent, so ... yes, for our bird, we also used it. But that is not all.

Best of all, I was not obliged to confine myself to one particular species of falcon; And there are a lot of these kinds. Therefore, I could choose for my taste any suitable sounds emitted by any falcon, which would resemble a kind of emotional statement of a bird.

It is very convenient that the range of emotions was limited. I will call them bird messages:


It is very easy to record the sound of an annoyed predator; it is enough to appear on its territory with recording equipment, and it will already be annoyed. Therefore, there are many materials where predators sound angry and angry. They are suitable for the sounds of "pain." The sounds of the hawk came up for responses in flight and reports of an attack. With the sounds "all is quiet", there are difficulties. I had several types of twitter, but then I had to edit many different types of messages in order to get partial, short, shrill cries corresponding to twitter, and they were suitable for playing.

Tracking the bird in a game of sound is a completely different story for another article.

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