The Unit AI

Level 18
Oct 12, 2007
The unit AI is a thing I've been working on for a while, but it's getting pretty neat right now.

Currently every area has a list of things that will keep that area alive. All of those things will start running whenever a player enters the area (to avoid letting units do things when nobody can see it anyway.)

I devided the AI things into subgroups in the map. Not that it matters. It's just the way I handle things and keep it easy to manage. It currently takes nearly no time to add/remove/change something to the AI for units in a specific area.
Here are the subgroups:
- Battlegroups
- Hero AI
- Small Chat Sounds
- Events
- Misc

Battlegroups are groups of units that are ordered to walk a certain path and attack enemies. With a nice system I can order units to walk a specific path with lots of (random) variations in it while they will attack enemies when they come across them. Battlegroups always start with a sound. So per example, if a group of footmen starts to move, their captain will call out something like "To Arms!!!".

Hero AI:
There are multiple Hero's in every area. Usually they're questgivers, which means they would have to stay where they are or always return to that spot when they're done with an order. With this I can make sure Hero's will always return to their initial spot while they don't force this too much. They prioritise enemies above standing ground.
I also added various abilities to each hero. Most NPC's also have a healing ability to heal nearby players that need it.

Small Chat Sounds:
When you click on a computer owner unit you will always hear a sound.
If it's an enemy, it's usually a taunting sound. If it's an ally it's usually something friendly.;-)

Every area has specific events that will be available as soon as a player enters the area. Some events order units/hero's to behave different.

Some things don't happen at every area. Per example: A goblin Thief quest giver is hiding somewere (invisible) next to a tree. Whenever enemies approach him he will remain hidden unless they're low health. Whenever an ally approaches he will become visible; allowing the player to talk to him.
Some quest givers also only stand at a specific spot at night. So some quests cannot be done at day or night time.. Think about some undead classes per example. Some of them would highly prefer the night.;-)

I might come with some movies/screenshots about the battlegroup movement soon.