top of page

Internship - Week 3 - Road generator

Hey there,

I started working on a city map generator. My first goal was to program an algorithm that would produce a believable road system. The algorithm starts off by choosing a random position on the map. From this position it will start to create roads. Each road has a start and end point. When a road is created, its end point will be transformed into a start point. The algorithm will then try to create roads from this new start point. This cycle continues until the whole map is filled or the algorithm runs out of start points.

But now I hear you ask "How can it run out of start points, would it not fill up the whole map each time?". The answer is no and let’s see why. There are certain conditions that need to be met before a road can be created. It is impossible to create a road when there is another road near its start point. This would create a city block that is not big enough to support a building. For the second criteria, it needs to meet a certain random change. The user can set how likely it is for a road to be created. Only when the random change meets this user set criteria, a road can be created. Because of these criteria, it is possible that the algorithm runs out of start points.

Now let’s have a look at the finished results of this week's effort.

As you can see, they look quite nice but it still has some minor problems. There are a couple weird looking dead ends that could prevent the creation of buildings. These dead ends should be removed or connected to nearby roads. The second problem is that it creates very small roads in the corners of larger city blocks. This seems to be a bug in the code where it detects nearby roads. These roads should not be created because it looks ugly and might prevent the creation of buildings.


Featured Posts
Recent Posts
Archive
Search By Tags
No tags yet.
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

Lars Temmink

Game Programmming Portfolio

bottom of page