AI Movement on ground

Blitz3D Forums/Blitz3D Programming/AI Movement on ground

xmlspy(Posted 2006) [#1]
I want to keep my AI from running into objects, and importantly I want them to not go off the floor mesh. The floor mesh is basically the ground where the AI can travel around.

My steps:
Once finished moving, do a idle until a new target point is chosen. To choose a new target point, the AI will select a random target within a radius. Once the new target point is chosen then the AI will check for a few things, is the path clear of objects? if it is, then let's get the needed y position of the floor and start the AI turn toward target point, and then move towards it.
Two line picks are done... one horizontal and one vertical.
What do you think? is my system over complicated? is there an easier and faster way to do it?

Here's a screeny to visualize it.


Note: I'm not using Blitz Terrains.


Danny(Posted 2006) [#2]
Hi,

Sending charactes simply in a random direction will quite possiby give undesired results (depending on your game) since they'll seem like brainless zombies and behave like blind robots :)

With pathfinding you can define a destination which creates a series of waypoints which you can then travel along - taking into account any obstacles between A and B (a house, tree, stack of crates). During the travel you'll do periodic tests to make sure he sticks to the ground and to prevent him bumping into other moving obstacles/characters.

Bottom line is that there's no 'easy way' of doing this. Check out some of the path-finding code & discussions in the forums. Experiment and decide what works best for you..

D.


xmlspy(Posted 2006) [#3]
Waypoints seem to do a more "zombie" like movement. The playes can tell that the npc is following a certain path, after a while it will get boring as heck. I want to have that "random" feeling, like if the npc has a life of it's own.


b32(Posted 2006) [#4]
What if you combine the waypoints and the random method ? Say, instead of one route around the house, you make 10 and the npc can choose between them along the way. It would give a move random 'feel' and have the advantages of using waypoints ?


Danny(Posted 2006) [#5]
I know what you mean, I'm working on something similar myself. If you want things to seem more logical and have 'a life of their own' you'll have to define more about the scene they walk, create certain area's or locations where it would make sense for them to go. A farmer would walk to the house to sleep or eat, then to the field to work, go off to take a leak in the river, go for a drink etc.

I'm trying to do something like that with some AI which has many possible random triggers, like when two npc's are close they attack (enemies) or talk (friends) or ignore each other. They weigh and decide what's more important to do (go home, go to work, hit the pub or bleed to death).
But that's a whole different ball game! And can grown into a seriously complex monster you might not want to get into.

It's probably easier to pre-script several options (paths/activities) and randomly mix between them?! So you'll have full control over what they do and how they do it, whithout necesarily be predictable WHEN they do it..


xmlspy(Posted 2006) [#6]
You could start doing AI from zero knowledge to a smarter way.

AI
Wander
When wander if entitycollided(found) then learn what is that object(water).

In future - if AI thirsty then find water
If touching water, then drink, thirst goes to zero. Wander again.

However, sometimes you might like your AI to have a certain amount of knowledge already( a more mature AI, and you could add water = waterplane)