Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am currently in the middle of creating an AI village simulation in Java. Having implemented a simple rules engine for dialog, I am wondering if this DSL can be extended for AI. I have previously implemented both GOAP and behavior trees, but considered GOAP to be confusing for the average user. Behavior trees may still be an option.

In this case, I expect the AI to be able to control interactions between villagers (covered within the rules system already) and to manage the goals/daily actions of both individual villagers and the village as a whole. Actions could range from gathering resources, to deciding what to build on a broader scale.

However, I have concerns about whether a rules system will be able to manage hierarchy or many complex situations. There may also be some interaction with non technical users, so understandability is important.

The rules engine as it stands currently takes in a number of facts on an event, matches it to the best rule and executes a number of actions.

The outcome of the AI needs to be sufficiently complex as to be believable; for example, there may be many competing desires to relax, work on a pressing task etc. This needs to be able to be managed and prioritized as tasks come up. A village wide AI can assign tasks to individual villagers based on their abilities and the urgency of the task. There are randomized events that can change the priority of certain tasks. My main concern is whether the rules engine will be performant, be able to schedule tasks well and be responsive to dynamic conditions.

Is a rules based engine desirable for this kind of AI?

share|improve this question
1  
"AI" is such a vague concept because it could mean anything from "move towards the player if they are within range" to fuzzy logic based on conversation trees to crowd simulation. What kind of AI? Have you tried it and it failed? Do you have a full spec for what your AI is supposed to do? –  Tetrad Jan 29 '13 at 16:14
    
I have expanded a little; I do not have a full spec as yet. –  Gozzen Jan 29 '13 at 16:23
    
Still looks pretty vague to me. A lot will depend on what form the rules take, how you decide between competing rules, how complex the outcomes need to be, and how you define 'manageable' and 'simplicity'. –  Kylotan Jan 29 '13 at 16:43
    
Have added a little more, can edit more fully tomorrow if required. –  Gozzen Jan 29 '13 at 16:57
1  
What you haven't stated that would useful to know is if your AI needs to plan its moves to be more realistic, or if it needs to react based on the situation. Any STRIPS like planner is meant to plan the AI's moves ahead of time and suffers from trying to describe the world to the planner. A Behavior tree is meant to allow the AI to rapidly react to a changing world but has no means of planning the AI's moves ahead of time since the AI may constantly change its decisions. –  David Young Feb 17 '13 at 0:49
add comment

1 Answer

Yes, a rules engine can be used for complex AI, at least to some extent. Unfortunately, game AI rules engines are apparently rather rare. Most of my Google searches on the subject turned up results unrelated to games or just questions regarding using it in games (including this question). I only found a few games described as using rules engines.

One of them was a real time strategy game called HomeWorld 2. Another real time strategy game that uses a rules engine to a minimal extent is AI War: Fleet Command. The AI for that game is described in greater detail in this series of blog posts by the game's creator.

As for whether a rules based engine would be suitable to your game, I suggest you try to implement a relatively simple rules based engine and test it with your game. If it seems like it would work for your game, then you can expand it. Otherwise, you can discard it and try a different approach.

share|improve this answer
    
+1 proof by example it appears. –  Byte56 Mar 18 '13 at 23:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.