Jump to content

Lua AI (editor) - 50 crawlers and a question to go


shadmar
 Share

Recommended Posts

LE_AI.jpg

 

Here are 50 animated crawlers wandering randomly about, they are afraid of the camera and will freeze and then run away from it if I get close (flee)

 

They have small randomness to them so they doesn't look uniform even if you line up all 50 using the same idle animation.

 

But as I let them wander about, some of them keeps walking into the sides. I want to have them change direction if their speed is low (almost stuck).. But how can I determine the moving speed of each?

 

I'm using the editor and the crawlers AI is selfcontained in it's own lua script.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Without knowing your final goal I would say you are starting to get into pathfinding and object avoidance. If you did pathfinding and used a grid of some kind to show the crawler where it could walk, you'd already have it predetermined that certain heights aren't reachable and therefore your pathfinding code would never allow the crawler to even approach those areas. Pathfinding is in itself a big topic.

 

That being said if this is really all you need to do you could cast out a ray at maybe mid level of the controller/character for a small distance (2 or 3 or so maybe) and if it collides with anything but another character then you know you are getting close to something you don't want to collide with so then you can randomly change direction or go back the way it came. [edit] I wouldn't do this every frame to save some processing power.

  • Upvote 1
Link to comment
Share on other sites

Here are 50 animated crawlers wandering randomly about, they are afraid of the camera and will freeze and then run away from it if I get close (flee)

 

But as I let them wander about, some of them keeps walking into the sides. I want to have them change direction if their speed is low (almost stuck).. But how can I determine the moving speed of each?

You might be able to use GetBodyVelocity, I'm not sure if that works with a controller which is a kind of modified body, but failing that record the previous and current position and time interval between them every call of your update routine and and you can calculate the speed. Ricks ray cast might be a better solution as this avoids the actual slowdown and makes the agent look 'more intelligent'.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...