How do I connect a set of nodes?

0 favourites
  • 4 posts
From the Asset Store
Node Downloader 2
$9.60 USD
40% off
Node Downloader is a plugin for download file for Construct 3 and construct 2 game engine
  • I am currently able to generate a random set of nodes in my project.

    The problem that I have is I don't know any efficient way to connect nodes and store their connection data. For example:

    The selected node would be #1 and the selected path is in blue. I would use the arrow keys to toggle between the paths and the selected path/connection would change. I would also want the player to be able to select paths behind them to move back (using the same method to toggle between different paths). The nodes have a varying number of connections so I feel that using instance variables for each node would not work well in this case.

    Another problem I have is with the random generation not mixing well with the paths/connections. The paths should be evenly distributed so that there aren't nodes with too many connections and there also shouldn't be nodes with no connections. Right now I just have nodes being connected to whatever is closest.

    The FTL sector map is how I envision the final result for this project just to give an idea as to what the map is for. Thanks in advance for any help that someone is willing to give.

  • One approach, since you are drawing/showing the connections anyway, is to store the end point nodes of a connection in two variables in the connection object (A and B in the example I added). When you arrive at a new node (via FTL jump, portal or whatever) you store all the connection where your current location is one of the end points in an array (A = node or B = node). Then all you need to do is cycle through the array's indexes based on input.

    Capx example using arrows, the random generation is a bit crude (in the way that the paths cross unlike in FTL). But you are more interested in how to store connection information and how to cycle the chosen paths from what I understand.

    https://www.dropbox.com/s/be1lanyiv7fe6 ... .capx?dl=1

  • One approach, since you are drawing/showing the connections anyway, is to store the end point nodes of a connection in two variables in the connection object (A and B in the example I added). When you arrive at a new node (via FTL jump, portal or whatever) you store all the connection where your current location is one of the end points in an array (A = node or B = node). Then all you need to do is cycle through the array's indexes based on input.

    Capx example using arrows, the random generation is a bit crude (in the way that the paths cross unlike in FTL). But you are more interested in how to store connection information and how to cycle the chosen paths from what I understand.

    https://www.dropbox.com/s/be1lanyiv7fe6 ... .capx?dl=1

    Wow, thank you so much for helping me with this. The example is easy to understand and does exactly what I was looking for. I will try and improve upon the generation and upload a capx for anyone who might want to see the finished product. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's another implementation that matches the ftl generation best I can tell. The idea used is very similar idea to Pulstar's, it's just another way to go about it.

    https://www.dropbox.com/s/yyqwtx8pwnw8t ... .capx?dl=1

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)