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 » Scripting Helpers
Home Search
 

Post processing a path

Previous Thread :: Next Thread 
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
07 Aug 2013 04:48 PM
Hey guys. I've built a fast A*-like pathfinder (faster then the one in my free models) that's runs quite nice. The problem is that I was a path that doesn't wait till it runs into a wall to turn. I have two options to fix this. First, if I want to do this in the pathfinder, then it will run much, much slower. Second, I could use a technique called post-processing to edit the path. Post-processing is much faster so I'm going to be using it.

The post-processor I have built has some glitches, and I'm not sure what is causing them. The path that it outputs is not what I wanted from it. Here is some basic information about what I want from it:

PURPOSE:
To take out all of the "extra" positions in the path, while shortening it. In affect, it optimizes a given path.

INPUT:
A list of vector3's representing a path. Each position is adjacent to the position before and after it in the list. The list goes in order from 1, 2, 3, .. #list. The start position of the path is the first index, and the finish is the last index.

DESIRED OUTPUT:
A list of vector3's representing a path. Each position has no parts between both it and the last position, along with it and the next position. It also is not visible from any positions farther in the list then the next one.

HOW I TRIED:
I started at the first position, and tested to see if a brick wasn't between every position, starting from the last position to 2 positions in front of the first position, and the first position. If there wasn't a part in the way, then I removed all of the positions between from the path. That optimizes the path. Once I have tested starting from the first position I move onto the next position, and test from the finish to it. I do this until the next position to test is 2 positions away, because once it is so close, there is nothing to remove.

HOW YOU CAN HELP:
I have a place set up called: "Test Lab" (http://www.roblox.com/Test-Lab-place?id=125625913) that has a script, and a few parts in it. I ran my pathfinder in the place, and stored the output in a script. I then put the post processor, and two loops into the script as well. The loops make bricks so that you can see that was generated by the pathfinder, and the path after post processing. The Post process function prints the results from running the post process script. Open up my place in edit mode, and check it out. Let me know about any bugs you find that may be causing it to not run correctly, or create a script that works.

For all those who want to take a quick peek at the post process function, this is it. Note that if you want input to test it, then you will have to visit my lab, stated above under "How You Can Help."

local function PostProcess(Path)
print("Post-Processing.")
local Start_Ptr = 1
local Finish_Ptr = #Path
while Start_Ptr < #Path - 2 do
while Finish_Ptr > Start_Ptr + 2 do
local b, d = Workspace:FindPartOnRay(
Ray.new(
Path[Start_Ptr],
Path[Finish_Ptr]
),
Ignore
)
print(b, d,
"Start: <", Path[Start_Ptr], "> ",
"Finish: <", Path[Finish_Ptr], "> "
)
if not b then
local NewPath = {}
for i = 1, Start_Ptr do
NewPath[i] = Path[i]
end
for i = Finish_Ptr, #Path do
NewPath[i] = Path[i]
end
Path = NewPath
Start_Ptr = Start_Ptr + 1
Finish_Ptr = #Path
break
end
Finish_Ptr = Finish_Ptr - 1
end
wait()
end
return Path
end



If you don't want to read everything above go here:

http://www.roblox.com/Test-Lab-place?id=125625913

and edit it, then run the script. Note that the white thingies are the problem, then look at the purpose of the Post process function above, and continue reading down from there.

Sorry I wrote so much, but thanks in advance for the help,
~ The Arbiter Of Death

Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
07 Aug 2013 04:50 PM
I saw atleast three #1s

Half life 3 confirmed
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Aug 2013 04:51 PM
@Infocus: VALVe lost the 3 button on their game keyboard.

So we are stuck with Half Life 2 Episode 2 Part 2 for now D:
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
07 Aug 2013 04:52 PM
I guess theres no reason to live anymoar

*grabs balloon snake*

bro, u dont evn know
Report Abuse
Xtreme101 is not online. Xtreme101
Joined: 03 Jan 2009
Total Posts: 4385
07 Aug 2013 04:52 PM
Half Life 2 Episode 2 Part 2 Segment 1: The Story of the Borealis Part 1 of 2
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Aug 2013 04:54 PM
Half Life 2: Episode 2: Part 2: Segment 1: The Story of the Borealis: Part 1 of 2: Chapter 1 of 2: Scene 1 of 2: Hour 1 of 2

I win
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
07 Aug 2013 04:59 PM
There is four actually. >.<

Anyways, anyone have a good fix?
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
07 Aug 2013 07:04 PM
Bump
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
07 Aug 2013 09:55 PM
bump again, any help?
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
08 Aug 2013 01:06 AM
Bump
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
13 Aug 2013 10:33 PM
Bump be de bump bump?
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
14 Aug 2013 12:01 AM
*Yawn* Last bump before I give up.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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