AI? how do they work?

yep i want to ask abt how ai work in panda3d.
is there any other way to script them instead on FSM?
:question: :question: :question:

the AI’s will work the same way in all engine and you would have to write it. FSM is more of animations.

Most of the AI in games are agent AI where you have analyze the world and do some thing every frame. Other types of AI include goal optimizing ai’s like chess. Which exactly are you looking for?

for me,
i just want the AIs to move towards the character and attack when within range.

what kind of attack? I will just use print here.

def ai(badGuyNodePath)
 if (badGuyNodePath.getPos()-badGuyNodePath.getPos()).length() < 5 :
   print "attack!"
 else:
   badGuyNodePath.lookAt(goodGuyNodePath)
   badGuyNodePath.setPos(badGuyNodePath,Vec3(0,1,0))

[/code]

Just a small modification to the above code:

def ai(badGuyNodePath) 
 if badGuyNodePath.getDistance(goodGuyNodePath) < 5 : 
   print "attack!" 
 else: 
   badGuyNodePath.lookAt(goodGuyNodePath) 
   badGuyNodePath.setPos(badGuyNodePath,Vec3(0,1,0)) 

thx