Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


thefollower

Member Since 16 Feb 2008
Offline Last Active Private

Posts I've Made

In Topic: Simplify nodes in a grid

28 January 2015 - 02:20 PM

Yes but also get rid of unnecessary nodes. 

The paths can go in 8 compass directions up, down, left, right, and the 4 diagonal directions at 45 degree angles. Between any two nodes its always a straight line.


In Topic: Simplify nodes in a grid

28 January 2015 - 02:17 PM

I just told you how they do it  you click on the map drag the road across horizontally and when you let go the road is built. Currently there is no game logic to update the nodes correctly so they wouldn't be "connected" like an intersection - you would get a path for the horizontal road like this:

 

var path    = [];
    path[0] = {'x':1,'y':3,'linksTo':[1],'id':0};
    path[1] = {'x':1,'y':4,'linksTo':[0],'id':1};
    path[2] = {'x':1,'y':1,'linksTo':[3] ,'id':2};
    path[3] = {'x':1,'y':0,'linksTo':[2] ,'id':3};

//horizontal path
    path[4] = {'x':10,'y':2,'linksTo':[5] ,'id':4}; //new
    path[5] = {'x':1,'y':2,'linksTo':[4] ,'id':5}; //new

Notice it is not connected to the vertical road yet because thats what i have difficulty understanding how to connected it all.


In Topic: Simplify nodes in a grid

28 January 2015 - 02:08 PM

Its built like a city builder when building roads in simcity for example, by the user clicking and dragging a path through the original path to create a  + shaped path.


In Topic: Simplify nodes in a grid

28 January 2015 - 02:03 PM

The first image shows the original nodes.


In Topic: Simplify nodes in a grid

28 January 2015 - 01:58 PM

"as simple points with the minimal amount required for any combination of path." - in your case it's not the minimal amount, I could get the same image without the node in the middle, so you actually want intersection to generate nodes at the intersections? "As you see if a user builds an intersection" - define builds an intersection - does he build it manually, or do you mean that by defining 2 roads that intersect - the program should recognize this intersection? "2 nodes are removed, one is added in the middle of the intersection, and 2 are added to the horizontal path." - I lost you here, I think I get how you get the central node, but why do you remove nodes and why do you add 2 nodes to the horizontal path?

 

Without the node in the middle i don't see how a given sprite would know to change direction if it was for example a corner, you need to know the node location so once the sprite hits that point you can go in a different direction. Thats why the middle node exists.

 

Why would i not remove the original nodes they would be useless to the new intersection? And the end nodes represent the end of the path so nodes need to be there to know where the path ends.


PARTNERS