SPECIALIZATION

AI Bird Companion made in Group Engine "Dog Engine"

My goal with this project was to create a companion, that felt like a real bird following you. One problem I needed to solve was that birds always need to move in the air and I wanted it to move naturally, not just moving in a circle around the player. I also wanted it to seem like it had a mind of its own, taking detours and interests in the environment.

Beside following the player, I wanted the bird to be able to guide the player through objectives. Not deciding how you complete the quest but helping you to find the way.

Development phase

Follow Player

I started with adding a circle that follows the player.

The companion follows a position, that it determined from an angle that is scaled by time. When the companion reaches its heading position, a tick function is called which gives the companion a new position on the circle.

The next step was to get more circles with intersection points where the companion could change which circle and direction to follow.

I made it possible to ajdust the number of circles and each circles size and rotation. I did this to make it easier to get a good result.

Here I changed how the companion moves. instead of just setting a position, it moves in a forward direction. This makes the companion movement more smooth and less circular. I added a noise and used amplitude to make the y-axis non-linjar. I also adjusted the circles it follows so that it can not fly outside the screen.

I changed the speed of the bird to be higher when it flies downwards and slower upwards. The small yellow spheres are positions that the bird uses to rotate towards. It does that sometimes, to make it look less like an airplane. I also made the bird look up or down depending on its direction.

Guiding different objectives

I started with making it possible to choose how many objectives and how many guiding points there should be for each objective.

I made the companion fly straight towards the next guiding point when the player got within a certain distance of the current guiding point. When the bird reaches the next point, it "alarms" the player  with a red sphere expanding.

Then I added a Takeoff, InAir and a Landing node in the behavior tree. The takeoff and landing node use curves that the bird follow. The curve is adjustable. Between takeoff and landing it just flies straight.

I updated the movement between guiding points. Now the whole path can be change using a curve tool.

I use the value on the curve to calculate what y-position the bird should have. The bird also rotates up and down depending on if it is going to fly upwards or downwards.

Implemented wander behavior so that the bird does not fly straight to the next guiding point.

Idle Behavior

The player has a circle around him that updates its center postion when the player moves outside of the circle. If the player stays inside the circle for a little while, the bird will land on the ground. As soon as the player moves outside the circle and it updates its middle position the birds start following the player again.

If I Had More Time

Collision Detection

If I had more time I would make the bird avoid other meshes. My first approach would be using raycasts in front and on the sides of the bird. If they hit something of a certain layer, I would have increased the rotation speed and got a slightly narrower curve to avoid the obstacle.

Wander Behavior for Guiding

I would have spent more time polishing the wander behavior when the bird flies between guiding points. I would start by using perlin noise that I can use with an amplitude to offset it horizontally. When it lands I would lower the amplitude value to get it to approach its target more accurately. The same would go for taking off from a point, so that it would not get too much offset in the beginning. Then, as I do now, I would use an adjustable curve to determine the height of the path.

Idle behavior

I started on a behavior that makes the bird fly and land on the ground if the player is within a certain circle for a while. With more time, I would have worked on the movement when landing and taking off. Also been able to tag "landing spot" positions in our editor on for example trees, signs etc.

Curve Tool and Debug Drawer: Filip Tynell  

Player Character
Player Model: Ditte Frederiksen
Player movement: Simon Broqvist

Player Animations: Jacky Coh