Prolog and decision making in RPGs
Members - Reputation: 481
Posted 28 January 2009 - 01:20 PM
Members - Reputation: 157
Posted 30 January 2009 - 04:18 AM
You'll find more easily suggestions of rules to use for your agents on internet. Using prolog or a custom made inference engine is just a matter of implementation.
Members - Reputation: 122
Posted 03 February 2009 - 11:01 AM
Prolog is not exactly a language of choice. Like lisp, it's popular in AI courses in college but not in the real world, which i suppose includes the video game world. Prolog is a logic-based language and there is some work on logic-based AI for games. The best known is Soar, which is used at USC and UMichigan. Again, this is academia, but academics, unlike most game studios, are happy to publish lots of papers on their work
Inference engines are not popular in games (i only know of two games that claim to have one of them, and i know one of those was wrong). There are various Web sites that will tell you how to build an inference engine. i'm personally working on an inference engine right now for my employer and was on a rule-based reasoning in games committee but my personal opinion (not shared by my coworkers, obviously) is that it's no better than hand-writing logic in a scripting language. It's not fast compared to compiled code, it's hard for most programmers to think of their programs as a set of independent rules, you either need to manage your rules closely with guard clauses or deal with conflict resolution (which is a fairly complex issue in itself) and it's non-trivial/obvious how to write anything that deals with more than one object (meaning, if you have three enemies and need to decide who to attack, there's no obvious way to decide which is the best)
As an aside, there really isn't such a thing as "NPC AI". One of the big problems people have entering the AI world is thinking too vaguely. They think "i want AI, i should find what technique to use to make AI", which assumes that AI is one big problem, which it isn't. It's a lot of small and normally very simple problems. It's pathfinding, steering, target selection, weapon selection, magic selection, personality, memory, dialog, inventory management, trading and all sorts of things, each of which might have its own solution. How you decide which target to attack is not necessarily how you'll decide whether to attack, heal or run away. You probably know that (since you're asking for a tutorial, not a technique) but when solving AI, my opinion is that it's best to first figure out how you want your AI to behave, then decide what types of decisions are being made or problems solved (and literally write them out and number them) and only then try to figure out how to solve them. Some you'll realize you can solve with common sense, others you'll realize need a solution tailored to that specific problem, something that won't work for the other problems. Of all these, doing a good job on step 1 is probably the hardest
But if you want to go the rule-based route for NPCs, take a look at Soar (although they haven't done much RPG work) and maybe Peter Spronck's work on rule learning (he tested some logic approaches to combat in a Baldur's Gate clone)
Members - Reputation: 1172
Posted 03 February 2009 - 09:21 PM
Original post by baylor
... Peter Spronck's work on rule learning (he tested some logic approaches to combat in a Baldur's Gate clone)
To aid your Googlu-fu, that's Pieter Spronck. In further research he also set up a self-learning combat AI in Neverwinter Nights, using an approach dubbed Online Adaptation. Unfortunately he moved to another university (booh! [wink]), but it looks like his research can now be found over here.
Like baylor mentioned, this is just a part of AI that focusses on NPCs learning to make optimal use of their talents/skills in combat, so it doesn't magically provide overall intelligent behavior for NPCs in other areas. To get a life-like NPC, you'd likely have to combine multiple domain-specific techniques (combat, pathfinding etc) and tie them together somehow. Based on my (very!) limited experience, I'd agree with baylor that manually written scripts are the most flexible and reliable glue to implement this general behavior in NPCs.
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
Members - Reputation: 481
Posted 04 February 2009 - 05:31 AM
I probably should have given more detail as to what I wanted to accomplish with an inference engine. Applying it to an agent's decision making is my goal and only at the highest level.
Certainly, it is possible to categorize and enumerate a list of possible NPC actions. Travel to a location, pick up an item, steal an item, kill another agent, drop an item, craft an item, kidnap an agent, etc. Since NPC's drive the plot, actions that allow for Propp's functions to be constructed is my starting place. NPC's actions like traveling to a location would then be delegated to a path-finding engine, kill another agent to a combat engine, and so on and so forth.
AI is not my forte, but I'm trying!