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

Previous Thread :: Next Thread 
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
03 Jun 2012 02:30 PM
So, I have one table that is full of all the nodes and every node has its information (position, neighbors, F, G, H, ect.) in it. I was thinking that my OpenNodes and ClosedNodes tables should only have the position value of the node and not replicated data but I'm not sure how I would be able to remove the node numbers from each of the tables without going though and looking for the position with the actual value. I'm thinking that the position will already be known because you have to find which node you are dealing with already but it would be another variable I would have to worry about handling. What do y'all think is the best way to do this?

~Read Between The Squiggles~
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
03 Jun 2012 02:31 PM
ROBLOX does it liek this:

local G = {}
local F = {}
local H = {}

And then reference it to a 'Node name'...
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
03 Jun 2012 02:36 PM
"ROBLOX does it liek this:"

Wut?

I do this:

function CreateNodes()
_G.Nodes = {}
Dots = game.Workspace.Nodes:GetChildren()

for i = 1, #Dots do
--------------{ Position x , Position z , Node's Neighbors
_G.Nodes[i] = { ["x"] = Dots[i].Position.x, ["z"] = Dots[i].Position.z , ["Neighbors"] = {}
--, Parent Node , F Score , G Score , H Score }
, ["Parent"] = nil, ["F_Score"] = nil, ["G_Score"] = nil, ["H_Score"] = nil,}
end
end


~Read Between The Squiggles~
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
03 Jun 2012 02:37 PM
I'm tired of the forum eating the white-space... THEY REALLY NEED TO GIVE US A [code] tag or something....

~Read Between The Squiggles~
Report Abuse
lah30303 is not online. lah30303
Joined: 15 Feb 2008
Total Posts: 10027
03 Jun 2012 02:39 PM
I think I would do it Quenty's way.

There have been a lot of pathfinding threads lately, maybe we should make one thread to discuss anything that has to do with pathfinding. Including ways to tweak it for different kinds of games.
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
03 Jun 2012 02:40 PM
Why his way?

~Read Between The Squiggles~
Report Abuse
lah30303 is not online. lah30303
Joined: 15 Feb 2008
Total Posts: 10027
03 Jun 2012 02:43 PM
You can sort the table of f-scores easier which is useful for making it more efficient. That's just opinion though, there is probably a way to make yours efficient, too.
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
03 Jun 2012 02:45 PM
"You can sort the table of f-scores easier "

Then how can you tell which f-score goes to each node?

~Read Between The Squiggles~
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
03 Jun 2012 02:46 PM
I would store all the scores as as an Int/Number Value because that makes things simple, in my opinion.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
03 Jun 2012 02:46 PM
That is ROBLOX's way.

My way is generally creating a table so I can do..

Node.F
Node.H

ClosedSet[#ClosedSet+1] = Node
OpenSet[NodeIndex] = nil
Report Abuse
lah30303 is not online. lah30303
Joined: 15 Feb 2008
Total Posts: 10027
03 Jun 2012 02:48 PM
You can keep a separate table for each of the nodes that tells which position in the F table that the node's F score is in. Then whenever it's position in the table changes you also change the value in the separate table.
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
03 Jun 2012 02:51 PM
I'll just do it my way...

~Read Between The Squiggles~
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
03 Jun 2012 02:56 PM
Try to use local variables, not stuff in the _G table for efficiency.
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
03 Jun 2012 03:01 PM
The only times I use Global are when I am saving all the nodes into the _G.Nodes and when I am copying them all into a variable for use in the individual AI scripts.

~Read Between The Squiggles~
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