Artificial Intelligence is one of the single most complex elements of game computation, it requires many checks and calculations regarding real-time positions, facing angles,
damage/health calculations and many other variables.
This Tutorial is going to go over how we can make an efficient AI using GUI in the World Editor that will be able to interact with an RPG/ORPG as a professional human player (who happens to make no mistakes, ever) would.
So What should it do?
Basically, in a typical RPG/ORPG, a player will need to do the following:
- Attack opponents
- Follow a movement structure
- Cast spells
- Buy new items/abilities
- Use provided methods of transportation
- Collect gold
- Interact with other players
Sidenote
For obvious reasons i.e. so that the AI doesn't actually do any hard work for the players or alternatively so that the AI doesn't steal the players job, I have chosen to leave Completing Quests out of the list.
How can we go about resolving each of these problems using GUI?
Believe it or not its actually really quite simple; lets go through the list and look at what the possible solutions for each scenario might be:
Attacking Opponents | To make a computer controlled hero attack we need to check for nearby enemies, we also need to insure that the hero does not openly enter a fight with a foolish amount of health or mana. It's important to include in our attacking triggers some sort of a retreat option for when health is too low to continue safely.
To make our hero AI somewhat even more professional we should try to make sure it does not enter into stupid fights, for example where the opposition has 10x the hero's health, but we must also take into consideration the abilities the hero has.
Sidenote
Attacking is one of the more difficult problems with GUI AI however when thought out right and executed nicely, it can really enhance the fun factor and challange in a game.
|
Movement Structure | It doesn't take much effort to make a functioning movement system in GUI, the trick is to make sure its not buggy. Sure just about anyone can make a hero go from one location to the other at certain times in the game, when certain conditions are true. However it is such an enhancement when the movement isn't stopped bacause the hero encountered an enemy on the way or something like that.
For movement systems i generally will link my attack trigger in with some basic movement or vice versa to optimize. This also gives the advantage of being able to detect when the hero should not move due to obsticles etc..
A problem that is almost always encountered, is that destructables or doodads will often block the path and of course doodads are undetectable via GUI. It doesn't matter so much with destructables and it can actually add to the game experience if the AI actually destroy inanimate objects such as tree's gates etc.. |
Using Spells/Abilities | Obviously and classically; Abilities and Spells are usually linked with attacking triggers. This makes the most sense as they will generally be used in combat.
However not all spells are indeed used in combat, some, i.e. healing spells are used afterwards, or others such as an adrenaline spell, i.e. roar are used at the begining of a battle or indeed just as a method of moving around the map faster.
So Spells are not contained in any single trigger but should be distributed among the attack and movement triggers. However it is also wise to have a trigger devoted only to spell useage, for spells like healing for example when a hero's health drops below a persentage boundary, similarly with escapist spells like blink. |
Purchasing Attributes | Although not all RPG's involve purchasing skills/attributes, its something to bare in mind. A computer player cannot be ordered to buy an item from a shop, it must be totally triggered from the payment to the item creation to the adding of skills.
It depends really on what kind of purchasing system you have, for example a dialog system is a big No! In fact dialogs just look ugly and generally should not be used in RPGS or in my oppinion any maps. However a favoured method that also makes AI easier to provide for is that of the buying items that are individually triggered to a spell. |
Using Transportation | This is perhaps the most simple and yet most complex to understand for those new th the ideaology. All that needs to be achieved in this problem is to get from one point to another. However if there in no route that will provide passage to the location then other transpotation is obviously needed. Its up to us to insure the hero knows when to use transpotation, and which to use.
Sidenote
To make sure its obvious; by transportation methods i mean triggered routes that will allow a player to get from one unreachable spot to another. For example a teleport system or a triggered train/aircraft system that can move your hero.
Particularly on large open maps with different islands or cliff levels the algorithms behind checking path mapping are particularly important to understand. This will be a big topic and difficult for many to understand but it will be explained later in full. |
Earning Gold/Income | Very basic idea and implementation, however there are many ways to allow a computer player to gain gold. A periodic income, Orders to slay creeps for a bouty or even actaully sending the hero on a quest and giving rewards, such as items which can also be sold for more gold.
Sidenote
Referring to what i said earlier, in this tutorial i will not be showing how to send the AI on quests as that skill should come to you from everything else i'm showing. Also its not somehting i think should be done on a personal preferance level.
|
Player Interaction | You may have figure that this is indeed the most difficult problem but the idea behind getting it to work is to provide the players more oppertunities to interact with the AI giving the illusion of a more interactive AI. Also commonly AI's are given phrases that they can use to ask the players for help depending on their circumstances, i.e. low health, low gold etc..
Sidenote
To solve this problem you need to think creativly about things that players would normally do and incorporate the same things but for a preset AI.
|
|