Advertisement

NPC AI in RPGs (2)

Started by July 01, 2000 02:42 PM
40 comments, last by Nazrix 24 years, 4 months ago
Dwarfsoft, I think the key idea for that is having nice simple methods that become complex through massive emergent behaviour. I don''t think it''s necessary to have any high level functionality just a small number of interacting rules that give the impression of complex relationships.

I''ve always loved the idea that a new NPC could be born with certain set concepts because of their background so that each time they meet any other agent in the game (player or NPC) they start up a new node in a relational database based on their preconceptions. i.e. a dwarf might be initially wary of elves but absolutely hate goblins, so that as soon as the dwarf met a goblin they would try to kill it or at least stay away from it. Every time the dwarf interacts with another agent their relationship would be updated based on events that occur (I think an events handler is a more accurate name than a message handler), obviously in the case of a goblin it would take less for the dwarf to be pushed over the edge and kill the goblin than it would for them to become lifelong friends. However, if the dwarf liked one goblin it would probably make them less hateful of other goblins (though not by much) and, maybe, in turn, having another dwarf see them being friends might affect their general concept of goblins. Either that or make them hate that dwarf for being a traitor.

If this sounds complex then try breaking it down into simple rules that make sense in your social context. People really aren''t that complicated you know ;-)

(Not that I''m suggesting you weren''t doing all of this anyway, I just thought I''d put my ideas down here for imminent flaming)

Mike
quote: Original post by MikeD

I think the key idea for that is having nice simple methods that become complex through massive emergent behaviour.


I really agree with this point, and I think its important for all of us trying to build complex NPC or agent behavior to keep this point at the forefront of our design considerations.

Look at nature, and one can see numerous examples of complex behavior that emerges from simple (yet unrelated) rules. Craig Reynolds'' work with flocking aptly demostrates how such behavior can be codified.

In a FPS, I was able to get NPCs to flank their opponents in a firefight, simply by seeking a non-LOS path (ie. a path where a node was given a bonus if it was not in the LOS of the opponent) to the opponent. From an observation point of view, it looked like the NPCs were actively flanking, but they really were not.

I think this key point that MikeD raises, means that one should focus on identifying the simple rules, and not the complex behavior.

Eric
Advertisement
quote: Original post by Geta

In a FPS, I was able to get NPCs to flank their opponents in a firefight, simply by seeking a non-LOS path (ie. a path where a node was given a bonus if it was not in the LOS of the opponent) to the opponent. From an observation point of view, it looked like the NPCs were actively flanking, but they really were not.


Yes! Lots of people forget that the lovely part in a path-finding routine that calculates the ''cost'' is not restricted to physical obstacles! As you stated, enemy line-of-sight is a good one for certain units. Territory ownership might be another, to avoid violating treaties, or you could generate an influence map and use that to keep non-combat units in ''safe'' areas, etc etc.

quote: Original post by Nazrix

Every NPC has an x and y value that tells them where to be at each hour. So, once the hour changes it scans through every NPC and compares their current x & y to the x & y they''re supposed to be and moves them there. It holds everything in arrays. If I want to change where they go, I just change the values of those arrays.

Crude, but effective.


Ultima VII does this. Although I think it is in 3hr slots, not hourly slots.

http://www.udic.org/ftpud/unsorted/schedule.txt

For my next job I''m going to wait until I find a company that''s writing a real time strategy game. As Kylotan says there''s so much that can be done with simple pathfinding it''s unbelievable.

Just giving the path finding function for a harvester a set of heuristics that demote nodes on a partial path if they are near a firefight would be fantastic. Giving different troops specific commands as to where they should or should not go on the map by dragging a no-go box over certain areas or setting a level of agressiveness is a simple improvement that would take away so much of the frustration of current RTS games.

Btw Geta, I like what you said about flanking troops in an FPS but I partially disagree. If the plan was to flank then the actions to carry out that plan for real people in a real situation would be, move to a specific point while keeping out of their LOS. Perhaps you didn''t have the planning layer but that doesn''t mean they weren''t actually flanking :-)

Mike
Here''s my quick thoughts on the subjects.
Might be a long post, but will try to avoid that.

AI Schedule/engine:

Concept:
Giving the world dynamic and living pattern by using actives NPC using a Schedule and/or a need based system.

Methods:
-Weekly based Schedule (Updated every hour).
(Weekly to avoid seeing to much repetition in the NPC activities)
-Optionaly using a need based system.
-Setting up a NPC MAnager to avoid consuming to much CPU cycles managinf off screen NPC.
-Creating a sector updater, to update the NPC status when entering a sector.
(the engine will compute what the NPC have to do, and compute the result of the need based system)
-Schedule modification following the result of the need based system.

OR
-A weekly schedule with a need system.
(In this one, the Schedule is only used as a general behaviour thing)

OR
-Need based only system.
(But giving the NPC a way to solve his problem, a job, and various other stuff)

TODO list:
-Basic need based system with simple needs (food, drink...)
-Not to forget special behaviour (in case of fire what to do..)
-Basic Schedukle system
(I think Nazrix already have done such a thing )

Discussion on the concept, methods is welcome
(It''s time to sleep here in FRANCE, so see you tomorrow)






-* So many things to do, so few time to spend *-
-* So many things to do, so little time to spend. *-
Advertisement
quote: Original post by MikeD

Btw Geta, I like what you said about flanking troops in an FPS but I partially disagree. If the plan was to flank then the actions to carry out that plan for real people in a real situation would be, move to a specific point while keeping out of their LOS. Perhaps you didn''t have the planning layer but that doesn''t mean they weren''t actually flanking :-)

Mike


A "planning layer" is a whole different issue, than generating complex behavior from simple rules (ie. emergent behavior), which was my point by including this example.

In the case of the FPS mentioned, there was no plan for the NPCs to flank their opponents. There was only a plan to survive any firefight, neutralize/kill their opponents, and move on with the mission, and accomplish its goals. The "enabling" of the non-LOS effect to pathfinding was the extent of the "flanking" plan in that particular game.

Eric
quote: Original post by Kylotan

Ultima VII does this. Although I think it is in 3hr slots, not hourly slots.



Cool...I'm glad to hear other games have used that method. It gives the idea some validity for me. I really need to play the recent Ultima games sometime soon


"The road of excess leads to the palace of wisdom." --William Blake

Edited by - Nazrix on July 5, 2000 1:55:41 AM
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
My need based system is based on my economics lessons at university

There was a needs/satisfaction explanation.
The system was basic but efficient, so very good for a computer game.

I think this system is/will be used in Black & White.

Nazrix and dwarfsoft, what about my previous post ?
Which system do you prefer ?


-* So many things to do, so few time to spend *-
-* So many things to do, so little time to spend. *-
I have not really considered the economics side, but if you are trying to simulate communtication, then the easiest way I can think of is messaging. There are probably other ways that this could be handled, but I still think that if you are going to have communication simulation then you need to have some kind of messaging. Deduction should not cover it.

I have heard a lot of good ideas from this group, I hope that you guys can give me a few more to try and stick in my game . I still have to get the UI up and running, but it is looking good .



-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
and our eGroup:
http://www.egroups.com/group/dwarfsoft

This topic is closed to new replies.

Advertisement