Store all overlapping neighbours

For questions about using Classic.

Post » Thu Mar 05, 2009 9:18 pm

If I add a hash table to a Object "Node"

How can I fill that table with all the Objects that overlaps.
(it could be a list and not a table)

What I want to do is to build a graph of connected nodes and be able to do different graph traversals of that graph. So beginning in one Node how do i do a depth first search and a breadth first search.

Normally in other languages I would pick a starting node and then recursively visit all of its neigbours. (depth first) Any idea on how to do this?

And any sugestions for the breadth first search?

And finaly.... preferably all these different traversals should be done in one frame. I have one implementation that visits the nodes one by one but only one in each frame.


I hope the question is interesting enough to generate som answers :-)
B
4
G
3
Posts: 46
Reputation: 992

Post » Fri Mar 06, 2009 6:43 am

I'm not sure what you mean by overlap.

It sounds like your trying to create a network system for paths, so you might have p1, p2, p3, p4, and p1 connects to p2,p3, and p2 connects to p4, and p3 connects to p4, etc. And you want to store the information about connections?
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Fri Mar 06, 2009 9:07 am

Assuming all objects are of the same size, you could just use a collision mask to get the data.
[url:7s0plhdi]http://www.mediafire.com/file/gigwzdfw1mt/collisionmask.cap[/url:7s0plhdi]
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Fri Mar 06, 2009 1:34 pm

[quote="David":14gsbf2w]I'm not sure what you mean by overlap.

It sounds like your trying to create a network system for paths, so you might have p1, p2, p3, p4, and p1 connects to p2,p3, and p2 connects to p4, and p3 connects to p4, etc. And you want to store the information about connections?[/quote:14gsbf2w]

This much like what i have in mind. Im just dont know how to set it up
B
4
G
3
Posts: 46
Reputation: 992


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests