Shooter template

Top  Previous  Next

This month's shooter template introduces the AI-based, human-like enemies. There isn't too much empty space in the level, but I have managed to include 3 different enemies that patrol on their paths. You don't need to use patrolling paths if you don't want to; the enemies will stand still, playing their "idle" animation if they can't find a path nearby. By the way, the code allows you to use up to 1,000 enemies per level.


Run the template script, jump on one of the wooden poles, and then on the roof of the building.




Move close to the fence and you will be able to see the first patrolling enemy - he won't see you.




It's not a good idea to meet this guy if you didn't bring a gun with you; a few of its shotgun bullets will kill you without too much effort.




The path finding uses an advanced bread crumb AI algorithm; the player leaves invisible footprints in the level and the enemies use them to find him if the player isn't in sight. If the invisible footprints disappear (they only last for 60 seconds), the enemies will stop chasing the player and will explore their surrounding environment, looking for paths and being able to attack the player if it happens to return to the same area of the level.


The action attached to the enemies is fully customizable - see for yourself.




- Alert_dist sets the alert distance. If the player comes closer to Alert_dist to the enemy and the enemy can see the player, it will attack the player;

- Crumb_range gives the enemy's sensitivity to player's invisible footprints; if one of player's footprints is closer than 1,000 quants to the enemy (default value), the enemy will chase the player using its invisible footprints;

- Running_speed sets enemy's running speed, used when it chases the player;

- Walking_speed sets enemy's walking speed, used when it patrols on its path;

- Dist_to_ground sets the distance between enemy's feet and the ground; you might need to change this value, depending on the origin of your enemy model;

- Health sets the number of health points (default = 100) for the enemy;

- Bullets_freq sets the frequency of the bullets; a smaller value will make the enemy fire more often;

- Bullets_vertex sets the firing vertex for the enemy. The default value makes the enemy fire bullets from its 700th vertex (the shotgun, for my model);

- Falling_speed gives the speed with which the enemy falls from a higher area to a lower area.


That's all for this month!