Battler AI

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
During my time spent developing a battler AI system I've taken several different approaches before settling on what I have now. Action patterns were too restricting and the AI scripts I tried weren't a good fit, so I coded my own. Due to my battle system's mechanics, battlers needed to have timing and situational awareness. Also, since skills are modular, writing an AI for each individual actor/enemy (there's a lot of them) was too tedious. I opted to design the AI around the individual skills instead. Based on situation, each skill is given a different value and battlers will choose the skill with the highest value during their turn. These values range from 0 to 100 and have a bit of variance to curb predictability. That's the gist of it anyway.

I'd like to know how the rest of the community handles AI in their games (if at all). Hypothetically, how would you handle the AI within modular skill system were you can't prediction the exact skills available in any given encounter?
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
Personally I opted for a completely random system.
I want to avoid experiencing the frustration of the gamer who complains about the AI misconfigured or cheating.
In addition, this make possible to have constantly random and non-redundant combat.

Here A old video i made, which shows the prototype that I wish to apply to my Battler AI engine ..
It is far from the result I want, but it makes it possible to imagine
 

TheTitan99

Veteran
Veteran
Joined
Nov 2, 2015
Messages
190
Reaction score
87
First Language
English
Primarily Uses
RMMV
I have individual AIs for each enemy and boss. Typically, the enemies don't have too much smartness in 'em, usually capping around 4 moves. There's no hard and set rule, I just figure if there's an encounter of 5 enemies, they should probably be fairly simple or else the player will feel overwhelmed. This guy revives. This guy attacks low HP actors. And so on. Easy to understand, though difficult to battle.

Bosses and special enemies, I typically give them a theme, then write an AI off of that. Let's say the boss' theme was healing. Just flat out heal heal heal is pretty boring. Just becomes a health wall to break down. How about if the boss is paired with an enemy that knows a move that's stronger when it's at high HP. And there's also a 2nd enemy that knows a cover skill, and takes the damage that this guy receives. Now the healing boss is more dynamic! No complex AI, they literally only know 1 move each, but there's still a team strategy.

The AI doesn't need to be super complex if the idea behind it is fun and interesting. Hammer Bros. in Mario are one of the most memorable enemies of all time, but their AI is very basic. Shoot hammers, jump, walk back and forth. (I think they can charge you also if you take too long, but I've never seen it.) Very, very basic, but very fun because the core idea is good.

As for how I'd design an AI like your's? ... Uh, I probably wouldn't. I can't wrap my head around that type of stuff, haha. Weighing odds and judgement calls. Too complex for me. I fully support you in going for it! I just know I'd fail at it hard.
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
I see. I suppose it depends on the core battle mechanics and skill complexity.

@Jonforum A completely random skill selection isn't something I'd see myself doing, but I can see it working for a more simplistic low tension battle system, especially if combat isn't the primary focus of the game.

@TheTitan99 Your approach is very similar to how I've done things in past projects. Enemy serve to provide a specific type a challenge with very prominent strengths and weaknesses. I agree that AI doesn't need to be too complex to generate a decent strategic challenge.

Let's say you're creating a game composed mostly of single enemy encounters, and every enemy is a potential ally. How would that change your approach to building AI, if at all?
 

TheTitan99

Veteran
Veteran
Joined
Nov 2, 2015
Messages
190
Reaction score
87
First Language
English
Primarily Uses
RMMV
I suppose in this new setup, it depends on if these enemies turned allies are meant to be simple or complex. When I hear "Turn any enemy into an ally", I hear super simple opponents that have 1 role, but you get a lot of them, so their huge holes in what they can and can't do is filled up by team composition. In that case, I'd stick to writing a simple AI for each, 'cause they'll only have a few moves.

However, if you want these enemies to be more dynamic, like Pokemon where any given one can potentially know 100+ moves depending, then maybe it would be best to switch to a more AI system, rather than individualized AIs.
 
Joined
Oct 26, 2015
Messages
541
Reaction score
1,062
First Language
English
Primarily Uses
I find its easier to control AI by limiting the use of the skills themselves than trying to tell the AI who to use them on. For example, I'd rather make a poison spell unable to target any actor who is poisoned than to try and tell the AI not to poison someone already poisoned.

Then there's cooldowns/windups, by giving these to a skill I can control the minimum downtime between casting the same spell twice and from what turn it can start casting. Whereas the default turn counter thing for AI confuses me and seems to be a lot less flexible.

So to sum it up. My AI itself is super simple, a stringent list of priorities with a few extra triggers such as health and states. The bulk of the brains come form the skills themselves, they won't cast if they don't have a valid target. Usually the skills with rarer conditions are put much higher on the priority so as to guarantee it goes off when applicable.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
((I see it's been a little over 2 months since the last reply; I hope it's okay to post here since Battler AI is such an evergreen game design topic and the thread isn't so old as to be long lost from peoples' memory :) ))

In my own games so far, I mostly stick to the standard "weighted random" behavior of the RPG Maker engine, and I take special care not to make any of the enemies' standard moves too absurdly different in power than another move that the enemy may use. This keeps things unpredictable while also allowing me to keep things rather fair despite particularly 'lucky' or 'unlucky' spins of the AI Roulette. My enemies also have a lot of special moves that depend on the current status of battle, allowing the player some control or at least visibility over when they will happen:
  • Enemies that require MP will only use MP-restoring moves when their MP pools are low.
  • Very powerful enemy attacks require 2 actions to execute: a first action that "charges" the attack and a second action that "unleashes" it on the party. To keep things from getting stale, the boss enemy won't always unleash the attach the turn after they charge it, so you have to decide whether it's worth guarding or risking taking the attack full force.
  • Several bosses have special attacks that can only be used under certain conditions, such as a certain minion is still alive. The player can remove the boss' access to that attack by destroying the appropriate minion.
I think it's admirable to go above and beyond to design enemies which have the ability to make intelligent decisions ("timing and situational awareness") like you are describing, @Rinobi, but I think that even beyond the considerable work you've certainly had to do to create that, it's also worth considering whether this actually makes your game more fun to play. If I were playing Final Fantasy or Star Ocean or even to some extent Disgaea and the enemies were able to dissect and exploit the flaws in my strategies, I'd be seeing a Game Over every time the AI outplayed me, and I would probably find it a lot more frustrating than fun!

On the other hand, in games like Civilization, Age of Empires, Chessmaster or League of Legends, players want AIs that can make intelligent decisions, react to situations wisely, and ultimately outplay most players on harder difficulties. I think this has to do with the core aesthetics of play in these games being competition and challenge, rather than narrative and exploration. It also probably involves the fact that if the AI beats you in Civilization, the next thing you do is start an entirely new and different round of play, probably having learned something from your defeat. If the AI beats you in Final Fantasy, the next thing you do is reload your save and basically replay the same hour of gameplay you just played.

It's for this reason that I think some games (think Super Mario) work best with extremely predictable AI patterns, some games (think Final Fantasy) work well with unpredictable but essentially "dumb" AIs, and some games (think Civilization) work best when the AI can think with the awareness and cunning of a human. I could definitely see the case for an RPG which is better for having extremely smart AI, but I think that such an RPG would be one that does not strictly gate your progression through the game by your ability to beat the AI in combat.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top