Skip to main content
added links, fixed comment attribution
Source Link
Pikalek
  • 12.5k
  • 5
  • 45
  • 52

To elaboratefollow up on the commentcomments by @Ranth & @JackFrost, a breadth first search spreading away from the point of origin should give you the desired result. When doing so:

  • Use an 8 way neighborhood (I.E. allow diagonal search movement)
  • Use a Euclidean metric for distances to encourage 1 diagonal movement over 2 cardinal movements
  • Limit the search by whatever you want the maximum radius to be
  • Make obstacles impassable or increase the movement cost of their cells

Because the search will need to either wrap around obstacles or move more slowly through them, you won't get a perfect circle around your point of origin. If things still look too smooth &/or you have an area without obstacles, you could always add some fake obstacles for the running the city perimeter search.

As with most PCG stuff, you'll probably need to experiment a bit to find what you want. I like to use Perlin Perlin / simplex noisesimplex noise &/or Poisson disk distributionsPoisson disk distributions for that sort of thing, but to each their own.

To elaborate on the comment by @JackFrost, a breadth first search spreading away from the point of origin should give you the desired result. When doing so:

  • Use an 8 way neighborhood (I.E. allow diagonal search movement)
  • Use a Euclidean metric for distances to encourage 1 diagonal movement over 2 cardinal movements
  • Limit the search by whatever you want the maximum radius to be
  • Make obstacles impassable or increase the movement cost of their cells

Because the search will need to either wrap around obstacles or move more slowly through them, you won't get a perfect circle around your point of origin. If things still look too smooth &/or you have an area without obstacles, you could always add some fake obstacles for the running the city perimeter search.

As with most PCG stuff, you'll probably need to experiment a bit to find what you want. I like to use Perlin / simplex noise &/or Poisson disk distributions for that sort of thing, but to each their own.

To follow up on comments by @Ranth & @JackFrost, a breadth first search spreading away from the point of origin should give you the desired result. When doing so:

  • Use an 8 way neighborhood (I.E. allow diagonal search movement)
  • Use a Euclidean metric for distances to encourage 1 diagonal movement over 2 cardinal movements
  • Limit the search by whatever you want the maximum radius to be
  • Make obstacles impassable or increase the movement cost of their cells

Because the search will need to either wrap around obstacles or move more slowly through them, you won't get a perfect circle around your point of origin. If things still look too smooth &/or you have an area without obstacles, you could always add some fake obstacles for the running the city perimeter search.

As with most PCG stuff, you'll probably need to experiment a bit to find what you want. I like to use Perlin / simplex noise &/or Poisson disk distributions for that sort of thing, but to each their own.

Source Link
Pikalek
  • 12.5k
  • 5
  • 45
  • 52

To elaborate on the comment by @JackFrost, a breadth first search spreading away from the point of origin should give you the desired result. When doing so:

  • Use an 8 way neighborhood (I.E. allow diagonal search movement)
  • Use a Euclidean metric for distances to encourage 1 diagonal movement over 2 cardinal movements
  • Limit the search by whatever you want the maximum radius to be
  • Make obstacles impassable or increase the movement cost of their cells

Because the search will need to either wrap around obstacles or move more slowly through them, you won't get a perfect circle around your point of origin. If things still look too smooth &/or you have an area without obstacles, you could always add some fake obstacles for the running the city perimeter search.

As with most PCG stuff, you'll probably need to experiment a bit to find what you want. I like to use Perlin / simplex noise &/or Poisson disk distributions for that sort of thing, but to each their own.