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: Node Trouble

Previous Thread :: Next Thread 
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
30 Dec 2011 08:41 PM
I'd consider this advanced enough to be here. I am working on a way for my script to find what nodes have a path to each-other and which ones don't. I'm getting REALLY odd output.

http://www.roblox.com/Working-with-AIs-place?id=12401170

There is a script in the workspace. It has really odd output. Too much to post, sorry...

~Read Between the Squiggles~
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
30 Dec 2011 08:48 PM
"I am working on a way for my script to find what nodes have a path to each-other and which ones don't."

What? Until you make connections between them they aren't really nodes at all, just points. The whole reason you call things "nodes" is that you have stored a set of connections between them.

Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
30 Dec 2011 08:51 PM
They'd be nodes if the script worked...

~Read Between the Squiggles~
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
30 Dec 2011 09:14 PM
Anyone notice any errors on my part?

~Read Between the Squiggles~
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
30 Dec 2011 10:08 PM
You're going about it the wrong way. Don't pre-make nodes and then try to make connections and then try to do your pathfinding algorithm on those. You want to create the nodes as you're using your pathfinding algorithm.
Report Abuse
Shobobo99 is not online. Shobobo99
Joined: 30 Dec 2008
Total Posts: 5754
30 Dec 2011 10:10 PM
What is wrong with premaking nodes? :P
Then the most lag you face is when they are made.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
30 Dec 2011 10:11 PM
@shobo
He's placing parts and then trying to find connections too them. Not making a grid where or something where you can already see the connections.
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 Dec 2011 09:09 AM
You don't see what I'm doing do you? My goal in all of this is to create an AI capable of using weapons and that is smart enough to hid behind barriers.

And, by using a grid like this, it can be modified for use in many different places. This system, with some improvement from the "paintball stage", could lead to better war game AI. And, you know, this isn't meant to be a RTS and many RPG style games make their AI path-find with this type of system with manually set nodes.

~Read Between the Squiggles~
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 Dec 2011 09:33 AM
Well, this is the code:

--[ NODE CREATION ]--

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

for i = 1, #Dots do
--------------{Position x, , Position z , Safe?, Accessible?, Node's Neighbors}
_G.Nodes[i] = {Dots[i].Position.x, Dots[i].Position.z, true , true , {} }
end
end


--[ TABLE TESTING ]--

function TableTest()
for i = 1, #_G.Nodes do
for o = 1, #_G.Nodes[i]-1 do
print( _G.Nodes[i][o])
end

for o = 1, #_G.Nodes[i][5] do
print(_G.Nodes[i][5][o])
end
end
end

--[ NODE NEIGHBORS ]--

function NodeNeighbors()
for i = 1, #_G.Nodes do
Counter = 1

for o = 1, #_G.Nodes do
if i ~= o then
Difference = Dots[o].Position - Dots[i].Position
ray = Ray.new(Dots[i].Position, Difference.unit * Difference.magnitude)
Hit, where = game.Workspace:FindPartOnRay(ray, Dots[o])
if Hit == nil then
_G.Nodes[i][5][Counter] = o
Counter = Counter + 1
print("Yes" .. i .. " " ..o)
else print("No" .. i .. " " ..o)
end
end
end
end
end

--[ FUNCTIONS TO RUN ]--

CreateNodes()
NodeNeighbors()

game.Workspace.Nodes:Remove()




I can't post the output though... WAY TOO MUCH o.O

~Read Between the Squiggles~
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 Dec 2011 09:58 AM
:'(

~Read Between the Squiggles~
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 Dec 2011 11:12 AM
I fixed it with help from 1Ra.

~Read Between the Squiggles~
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
31 Dec 2011 11:56 AM
I would also suggest storing the adjacent nodes in this format:

node.adjacent[an_adjacent_node] = distance_to_that_node

Then you can easily iterate through the list using pairs() and already have the distances and nodes right there, and you don't need to calculate any extra stuff while pathfinding.
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 Dec 2011 12:15 PM
Wait, how?

I think I finally understand how it works so I'll stick to that way...

~Read Between The Squiggles~
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
31 Dec 2011 12:34 PM
I'm telling you. You're wasting too much effort just placing nodes at random and then trying to use a script to find which ones are adjacent to them. Either store the nodes in a way where you already have their adjacent nodes or create the nodes while the algorithm is running.
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 Dec 2011 12:41 PM
Have you ever heard of path-finding while using arbitrary grids? That's what I'm doing.

I'm no making an AI that will travel from point A to B. It will shoot at point B from point A 1/2 and take cover ect. This will be much more advanced than you are thinking.

~Read Between The Squiggles~
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 Dec 2011 12:52 PM
The script uses nodes places by the user and creates a 2D grid with them. It allows the user more control over points. And, this will be used with a special AI that is meant to be able to look at nodes around it and check for cover(can it be seen by enemy). I would rather use a grid of 60 nodes places where they are useful than a bunch of random ones.

~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