Skyline Game Engine Store uses cookies to store certain information to make your site visit more enjoyable. By proceeding to use the store, you are agreeing to the use of cookies.

AI - Dynamic Scripts Progress

Posted by SolarPortal 23/01/2018 0 Comment(s)

Animal Evade

Had some time to settle down and get some of the character scripts developed. Spent some time on the animal evade script, I had made one in the past but some how it wandered out of my library and got lost. But this was for the best as I had the chance to re-write it and made a better version that could easily be changed into a predator chase script.

So the main thing for an evasion script is to be able to first detect the closest predator target and then through some vector magic be able to steer the character controller in the opposite direction to the chasing turning direction. This ensures that the evading animal always moves out of reach of the predator. 

Here is the magic formula for the evade turning, the var turnVal is used in an entity.turn(..) command.

Lua:

tx,ty,tz = entity.inverseTransform(obj, entity.getPosition(predatorID));
turnVal = turnBoost*50*tx*chase_evade_Flag;

The chase evade flag sets whether to turn away or turn towards predator. ( this is used in the Zombie see down the page)

To see how this is done in Skyline please have a watch of this video:

  

Zombie vs Villager

As part of the character scripting I have written a special version of a predator script based on a variation of the animal evade script, where the character will turn towards a target character and move into attack. A fun turn of events can be had by setting two characters to different query and sensor flags so that they detect and attack each other. I have made a video showing how to set up the zombie script and how this can be used to make a villager character also attack the zombie.

Have a look at the video and watch these two slug it out.

Both these scripts will be available with a patched skyline.exe so you guys can get playing. Last job on the zombies is to get them to attack the FPS player, I will keep you informed on this progress.

Leave a Comment