Freitag, 25. November 2016
Developer Diary 44 Why this Code Changed my Life
Soldiers patrol through the maze. They are as large as buildings and destroy everything in their way. A tree is no obstacle to them, neither is a house, a tower or any kind of structure. But because of their size they are able to travel vast distances in a short amount of time.
The distance is too large for any navigation volume to work properly. So after weeks and months of trying to figure out a way to deal with AI while excluding navigation volumes I finally found the answer:
I set the AI movement in the Behavior tree to "Move Directly To". This way of movement causes an AI to move directly towards a specified goal, but it will also cause the AI to float, or fly through the air if it is following a player character which is currently moving up or down hill. The AI may also get stuck when colliding with obstacles, but since the soldiers are too large to collide with anything this is not a concern.
By implementing a Line Trace By Channel that starts 500cm above the pawn location and extends 5000 cm below the pawn location and ignores the pawn, all other blueprints and objects except the landscape itself, it is possible to get the landscape Z coordinate at the pawn's location. This Z value can now be used to "tie the AI down" to the desired location by using the "Set Actor Location" Node.
The AI will now move through the landscape while staying on the ground and follow the player everywhere independent of any navigation volume. If it collides with trees or objects such as houses, a collision volume near the pawn's base will trigger a Blueprint containing a destructible mesh to spawn at the object's location, identical to the original object in size and appearance. By applying radial damage in the Event Graph of the blueprint the mesh gets destroyed. These two little tricks save FPS and revolutionize AI navigation for large creatures.
I'm happy!
S.M
Mittwoch, 16. November 2016
Developer Diary 43
It's been a while since the last update, but I implemented some massive improvements. I recreated all Interaction-blueprints, because they were tied to the BP Event tick causing a major drop in FPS, added a new Game Over FX Volume and did some fine-tuning on the overall gameplay. Currently I'm rebuilding the AI Blueprint for the soldiers, so they will move through the world without the use of Navigation Volumes. On Monday I worked on the impact FX of the soldiers projectiles. It now causes a massive explosion close to Jonah, with smoke and a hail of rocks raining down on him during escape. For some reason he appears to get stuck in the ground when he's registered to chase the player ... can't figure out why. Worst case scenario I'll have to rewrite the behavior tree.
Abonnieren
Posts (Atom)