Sign in to follow this  
StaticVoid

Action RPG AI. Will this work?

Recommended Posts

I creating an action RPG (hobby project) and I'm at the point were I need to consider AI. My focus is on the combat at the moment. I was wondering if you could give me some feedback on this idea? Brief description of game. Whilst in combat the player will have direct control of the main character. The other characters both friendly and unfriendly are controlled by AI. A scenario is described by a number attributes. Character has attributes like health, speed, power and range. I also have character to character attributes like loyalty, empathy and anger. An action is defined by a number of weighted attributes and a threshold. Actions will be kept vey simple. For example attack enemy, defend character, hold back etc. On a characters first turn each action is evaluated according to the total of the attributes for that scenerio. The action with the highest total is accepted. On subsequent turn the current action is executed unless it is under it threshold, in which case all actions are evaluated. Example for character with low health but high power against an enemy with high health but low power. Attack enemy - threshold 2.0 character enemy health 0.2 0.0 (high health is weighted low) Power 0.7 0.8 Total 1.7 Hold Back - threshold 2.0 health 0.8 1.0 Power 0.3 0.2 Total 2.3 In this case the charcter would decide to hold back and will probably continue to hold back if the situation doesn't change substantually. My real concern is that this system would be difficult to balance when a lot attributes are in play. It would be nice if it balance itself. I was good to get that written down even if no one comments. Thankyou if youv'e read this far.

Share this post


Link to post
Share on other sites
Why not split up the attributes into related groups that are easier to balance with each other. The other attriubte groups will be tested either before or after the results of the first group.

If an enemy's health is very low, he may not even want to consider loyalty or range. So, if you can rule out groups of possible outcomes sooner, the less complex (and easier to balance) your final result should be.

Share this post


Link to post
Share on other sites
Perhaps it would be wise to first determine a character's decision to attack/defend/whatever, then his decision on the proper way to go about it, using the same "threshold"-based mechanism - that is, he might first recognize the need to act defensively, and then attempt to figure out which target to defend, rather than weighing down all possible specific actions (attack target X, defend target Y, summon wasp behind target Z etc) during the same thought process.

In order for your characters to perform intelligently, they need to consider not simply their own stats (or those of their target), but also all variables (including the coordinates) related to the individuals involved in battle. I assume the terrain won't be a factor -no bunkers for them to hide in, traps to avoid, trees to climb and so on- which makes this sort of AI easier to code.

When shooting fireballs, for instance, he might try predicting where the enemies are going to be located the moment the fireball hits; this requires some thought, obviously. For instance, is shooting from a distance more effective than running towards the targets and releasing the spell there, if his area-affecting spell travels more slowly than the mage himself? He will need to figure out at which points in the next few seconds the highest number of enemies will congregate, where this will happen, how many innocents or friendlies he might hit, what he can do to position himself so he's less likely to be attacked afterwards, and weigh down the available variables. Perhaps the sum of these variables' influence would be a negative number, giving a malus to his overall decision to shoot fireballs, but ultimately, if his decision to attack has a really big score, and he has no other instruments of war to use than fireballs, the wizard may decide to cast them despite this malus.

A foolish AI would attempt to cause maximum damage; a more intelligent person would, perhaps, attempt to use the fireball's effects to best achieve his tactical objectives, such as defending his team. I'm guessing you won't try to go as far as strategies, though.

You know, come to think of it, you might gain a lot of insight from typical "battle robot" games. Droves of programming schemes have been designed to give these robots an edge in simulated matches, and they seem to fit the primitive "attack/defend/flee" mentality of most RPGs. Then again, in Robot Battle (one of the few robot games I've tried out myself), the critters don't flee - they just go hunt for cookies to rebuild their health.

Quote:
On subsequent turn the current action is executed unless it is under it threshold

Okay, but what happens when the character locates and attacks a target with huge hit points and low power (who will, theoretically, remain over the attack threshold until he's dead), while the character's allies are getting pommelled by medium-HP, medium-power units? I'm guessing the attacker will merrily stick to his animate practice dummy, while his allies are being turned into practice dummies themselves. Of course, no one might notice this in the heat of action-RPG battles, but if the allies can't always take care of themselves too effectively, a number of complaints will result.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this