generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Pathfinding optimization?

Previous Thread :: Next Thread 
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
21 Feb 2016 01:08 AM
I have the following code in all the NPCs in the game. Here are the server stats for it:

prntscr.com/a60mlc

Script:

http://pastebin.com/2FAKBnJt

How can I optimize this to get it to a low activity percentage so they it doesn't take a second or two for NPCs to take a mere step in your direction?
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
21 Feb 2016 01:26 AM
bump

urgenttt
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
21 Feb 2016 10:12 AM
bumpppp...
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
21 Feb 2016 10:15 AM
What are u trying to do with the npc's? btw can u make the code into a model because i dont use pastebin.
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
21 Feb 2016 10:25 AM
make them follow any given nearby player..and okay..

http://www.roblox.com/asdf-item?id=367216938
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
21 Feb 2016 10:29 AM
When a player gets near? Or the CLOSEST player?
Report Abuse
Itius is not online. Itius
Joined: 19 Nov 2015
Total Posts: 244
21 Feb 2016 10:29 AM
I made a zombie using the pathfinding service, it always freaks out every now and then. More often towards the last few points. It'll quickly jolt from one side to the other.


Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
21 Feb 2016 10:31 AM
the first player that gets near.
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
21 Feb 2016 10:33 AM
its like this:?

>Zombie
->Script
->Humanoid (named zombie)
->The zombie (parts)
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
21 Feb 2016 10:36 AM
yeah.
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
21 Feb 2016 10:39 AM
hmm, well trying to fire it ONLY when u need to helps but when it gets closer* to the player that becomes irrelevant.

Try firing it only so often from a distance but when they get close, fire it more often.
Report Abuse
RulerOfTheFree is not online. RulerOfTheFree
Joined: 11 Mar 2015
Total Posts: 56
21 Feb 2016 03:27 PM
Try casting a ray or two beforehand, and only using path finding service if there's an obstruction. It helps to only move to every second or third point on the path, but sometimes they get hung up on corners doing that.

Why are you using RawPath instead of SmoothPath?
Report Abuse
crashproof is not online. crashproof
Joined: 18 May 2013
Total Posts: 250
21 Feb 2016 03:55 PM
set log to 4*x of cancel position. that should work..


yes my siggy
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
21 Feb 2016 04:06 PM
Use this instead of continiously checking the distance with that while loop:
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/MoveToFinished
ex.
local reached = script.Parent.Humanoid.MoveToFinished:wait()
if reached then
-- continue pathfinding
else
-- MoveTo didn't work, abort pathfinding
end

And also, use something like this to check for path timeout, instead of a loop:
delay(waitTime, function()
-- stuff
end)


Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
21 Feb 2016 04:12 PM
thanks for the input, filip!
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
21 Feb 2016 04:15 PM
No problem.
Remember, avoid loops if you can, use events whenever possible.
Doing something very processing intensive is fine though, as long as you don't do it too often :)


Report Abuse
Daftcube is not online. Daftcube
Joined: 10 Jan 2010
Total Posts: 275
21 Feb 2016 04:36 PM
For "optimal" pathfinding, you can always implement your own version of A* or F* ;)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image