Showing posts with label AI. Show all posts
Showing posts with label AI. Show all posts

Friday, 28 March 2014

Adding enemy AI

The focus of today was adding enemy AI to the game. First I started by adding a bot on the first floor that greets you warmly with plasma shots. I've also added a little Matinee sequence in there to show the player where to find a weapon.

After that I started adding AI to the last floor. The AI in there is spawning randomly and will go after the player. It should be the most difficult fight for the player, as the fog will be limiting the vision and there will be lots of enemies.

I successfully created the code for spawning randomly, but had problems with the AI not moving around. I still haven't figured out how to fix this, at the moment I am trying to copy and paste this level in a new file. I think the problem is in the navmesh, and hopefully creating the level again should solve it.

Enemy AI spawning at random places

Tuesday, 10 December 2013

Enemy Waves

The next bit of programming I learned in UDK was creating enemy waves. The final code looks something like this:

Enemy waves code

Monday, 9 December 2013

Patrolling AI

Now that I can create an enemy bot, the next level of programming is making it patrol an area.

AI bot moving around in a patrol

This is how the code looks like, now let's break it down:

Thursday, 28 November 2013

Adding a bot AI.

These are the steps you need to follow to add an AI bot to you level

 Right click in level where you want bot to spawn, Choose add actor - add PathNode.
 Select the path node and enter Kismet.
 Right Click anywhere- New Event - Level Loaded
 Right Click anywhere again - new action – actor - actor factory
 right click on spawn point (actor factory)
 choose new object var using PathNode 0
 connect Level Loaded to Spawn Actor
 on the actor factory properties (blue arrow) – choose UTActorFactoryAI
 Click on drop down arrow beside Factory
 Tick Force Deathmatch AI
 Set Controller Class - None
 Set Pawn Class – UTPawn
 Tick Give Default Inventory
 click the little Green Cross on Inventory List and select any weapon from the dropdown menu

The final code should look something like this:

Adding a bot 

Then to have the bot re-spawn follow these steps:
  • Add an Attach to Event Node ( New Action -> Event -> Attach to Event)
  • Then a Death Node (New Event -> Pawn -> Death)
  • Right click on the Spawned thingy in Actor Factory and create a new object variable
The code is as follows:
Respawning bot

One extra thing I added, was a delay before the bot re-spawns. To do that, simply right click on the black thingy on the Death Node and add delay.

You now have a fully shoot-able bot, have fun!