Approaching RPG Enemy AI

Started by
1 comment, last by Phil123 11 years, 8 months ago
So I've got my text-based RPG and what have you, and I'm looking for different ways to implement an enemy AI system (or a series of functions that determines what the enemy will do). I'm sure I could create an AI system with a series of if statements for various test expressions but I feel as if there's a MUCH better/creative/cleaner/more efficient way of going about this (and I'd rather have a few ideas in my head before I go ahead and implement one, only to find out I don't like it).

Any ideas?
Advertisement
Sounds like a good project.

There are a lot of existing 'toolbox' methods for AI to deal with certain problems, but each game always seems to need a slightly different approach.

Can you give a very rough outline of how the game works? That might help people to suggest relevant ideas. For example, is it room-based, where you type commands to perform actions? I'm assuming turn-based?

Can you give a very rough outline of how the game works? That might help people to suggest relevant ideas. For example, is it room-based, where you type commands to perform actions? I'm assuming turn-based?


Yeah, basically the world map is room-based (like a grid system). Assuming the area permits it, you can move north/east/south/west and when the player moves into a new room, through basic file input and a little randomization the program will determine if an enemy attacks or not (as well as what enemy). And yeah, you do type commands to perform actions and combat is most definitely turn-based.

As for the combat phase, the player can basically attack (physical or magic based - the player will be utilizing both of these as enemies resistances' are drastically different from one another), use abilities, use spells, or to spend that turn increasing his energy (you can call this mana if you'd like). Otherwise, if the player attacks, he gains 5-10 energy (somewhat random, lower energy returns are more common than higher ones) and from there, the player can utilize that energy for more powerful abilities and spells. (as of now there's 6 different resistance-based direct damage abilities/spells, as well as abilities/spells that increase various stats or decrease various stats - for a significant energy cost)

The twist that comes in is that as the battle progresses, both the player and the enemy attacking the player get stronger (this is only temporary - stats are reset after the battle). One out of every 4 rounds of combat is spent increasing a stat of the player's choice (the other 3 rounds are spent attacking, of course), as well as a stat of the monster's choice (so, if a player is taking a little too much damage, then he can choose to increase his defense).

So why not have a long drawn out battle as the player - because the way I've currently designed it, enemies grow in strength quicker than the player (for example, choosing to increase your offense will increase it by say, 7%, where as an enemy's offense would increase by 10%). My goal is to encourage offensive play, rather than having the player simply spam heal himself (through abilities/spells/potions) in between his attacks until the enemy is dead. So while this won't be a big deal for regular mobs, fighting the high-risk high-reward mobs should feel like you're fighting against time (at least that's my goal anyway, it isn't like I've done this stuff professionally haha).

Hope that's a clear enough of a basic description. Enemies' strength is also partially based on player strength (which varies depending on what's in the monster.txt file), so if a player wants to customize their character to be more on the glass cannon side of things, then the game won't punish him for it.

This topic is closed to new replies.

Advertisement