Log in

View Full Version : AI


Sensath
01-20-2004, 07:26 PM
Well, I just wanted to write some ideas out. I've searched and have not seen any relevant posts on AI and behavioral patterns. So if no one is working on it, I guess I can give it a go.

Introductions first, I'm NEW! :shock:

Ok, so I *use to* develop about 4 years ago (almost to the day!) and do it in my spare time when I feel frisky. I've helped some others develop software during that time (that turned commercial), so I hope I haven't forgotten everything! If I have, feel free to abuse me.

Now, back to the subject at hand. I feel the AI needs a little sprucing up. So if no one is working on it, I think I may give it a go around. This won't be the most brilliant piece of work ever created, but I'm sure the real coders here can fix any mistakes that I may create.

I've got some starting ideas of what I want to accomplish. This is more of a design overview at the moment, until I figure out how to inject the code correctly.

Please forgive me if this seems incoherent, it's just a start.


Random Note#1
I'll have to create a database variable for each creature called Wanderlust. This would give each creature type a psuedo random variation in the amount of time they stood still. An example of this would be:


Wanderlust = 0.50
Global_Wanderlust_Time = 60 // (seconds)

Wanderlust_Time = rand(Global_Wanderlust_Time * Wanderlust)



Random Note #2:
Assume that we have obtained a bearing (from true north) of the last route the creature walked. It would be randomally initialized on Spawn and updated once a creature started taking moving.

Let's tell our NPC that we want it to start walking away from (approx) the direction that it was just heading. The below line gives the NPC their next bearing of 180

Muuss
01-20-2004, 10:16 PM
what about walls, trees that are on the npc's path ? will just pass thru them ?
the ground isn't flat either, so you ll have to take care of the z axis.
if you dont implement this in your algorythm, your npc will only be able to move on a flat rectangular surface without nothing on the floor. :roll:

Sensath
01-21-2004, 06:07 AM
I don't think the Z axis will be much of a problem, in that the code that processes the NPC movement will handle that. But I will have to determine if the destination coordinates are within the Zone boundaries and are accessible. I realize that this is the major part of the problem, but it'll have to be done sometime won't it?

Do you code much? I imagine that you do since you've replied to my thread. I assume that you've coded in an organization that has processes for design and development. If you have, then you surely realize that in order to achieve a goal you must have a baseline to work with. I'll have to take this in stages of course and the first stage is to actually get the AI moving.

Once they are moving, I'll have a baseline to work off of that I can upgrade to include pathing (i.e. walls, dungeons, trees, terrain features). Let's take this in stages shall we?

kathgar
01-21-2004, 07:30 AM
Yeah on the walls and trees..that would require serious changes a more CPU and memory usage. If you do do it.. make sure it's easy for use to diff in and use a #define. The server as of now, knows nothing about the zone makeup. You also /do/ need to worry about the z coord. Stairs, guk? Kedge? And it's not really AI...

Beers218
01-21-2004, 03:11 PM
You would almost have to make a map for each zone, defining lines and no-wander zones. Memory and CPU intensive it would be, but it would probably be the easiest way.

-Beers

Muuss
01-21-2004, 08:21 PM
Once they are moving, I'll have a baseline to work off of that I can upgrade to include pathing (i.e. walls, dungeons, trees, terrain features). Let's take this in stages shall we?


You'd better start to think how you ll implement the zone geography before thinking how to make mobs moving. Once done, you'll realize that choosing randoming a heading will lead you nowhere.
Honestly, the pathing grid available for npcs will be far more efficient that any pseudo AI code of that kind.

smogo
01-21-2004, 09:09 PM
Muss wrote :
Honestly, the pathing grid available for npcs will be far more efficient that any pseudo AI code of that kind
It is sound. And it is a way of mapping, anyhow.

However, pathing grid could be used in some situtations where IA still fails (it fails in EQ Live too, anyway), i.e. when mobs are fleeing, or trying to get to a point where direct route is not shortest route.

Pathing grid is currently used for roaming. But just consider netting the zone, with straightforward ways between to connected points. You get a graph for travelling the whole zone. Finding the best path is then a base compsci question.

Most nodes might be already defined in the various path grids, so the main thing is to connect them, weight the links, qualify nodes ('safe', 'hunting grounds','friends there'), merge the code, test.

Sounds easy, huh ? :?

Muuss
01-22-2004, 12:42 AM
Yah its everything but easy. Fleeing mobs gonna be a big pain to implement, the idea to have nodes the mob would try to reach then use as escape path or rescue is good. Its just something that deserves a lotsa reflection before being written :)