Advertisement

AI for RPG

Started by September 10, 2003 11:57 PM
1 comment, last by Raeldor 21 years, 2 months ago
I want to implement some simple (but not too simple) AI for my RPG. Would I be correct in assuming that the best way to do this is to use FSM''s for my basic high level AI. Then integrate this with calls to pathfinding routines (such as A*) and the combat engine? I am very new too AI, but have been doing a lot of reading and am beginning to understand the concepts, I just don''t have the experience (yet ). Also, for a second phase, does anyone have any ideas how to get enemy NPC''s to act in groups. Ie, to try and surround the player(s) etc. This does not seem to be covered in any of the texts I have been reading. Thanks all Rael
You are mostly correct on your first point.

Regarding group tactics, that is a bit of a more complex problem and one that has not often been done well. One method would be to utilize a "playbook" wherein each agent gets a role in an attack situation.

Another, simpler method may be to use an algorithm that spaces the agents out while also trying to get close to the target. The result would be a circle around the target. You can use a variant of a flocking algorithm that combines a strong attraction to the target and a weak repulsion from their fellows. The agents would then tend to spread out somewhat and would eventually start to wrap around the sides of the target area.

To be honest, don''t worry about that until you get the rest of your AI done. That is fluff you can add later.

Dave Mark - President and Lead Designer
Intrinsic Algorithm - "Reducing the world to mathematical equations!"

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
If you''re interesting in some FSM stuff, I recently made a tutorial on my site with code =)

One of the ways I thought about doing such tactics as you mentioned is to set dynamic waypoints to the NPC characters. So if you wanted to close in on a target while surrounding them, you would give them waypoints to first circle them, having NPCs who are already at their waypoint wait for the others or adjust if the player moves. When the other NPC players reach their waypoint, they would collectively start to move in.

Also, you wouldn''t always have to wait for all the NPCs to get in formation first. In a diamond formation, the NPC who needs to travel to the back will require the most time (you can find out who this NPC is with a simple dot product), so if the other 3 are setup, they can charge in, while the agent running in from behind will sneak up. Of course the player could charge and break up their tactic, but that''s a reality =)

This topic is closed to new replies.

Advertisement