This is a strange one-off, since I have not talked about generating cities before, and I can't promise I ever will talk about it again.
The fitness-based approach works opposite to a normal generation method. Usually, you might try to figure out an algorithm. Here, instead, one needs to figure out what is desired, first. So we need to ask - what is a city?
A city here is a collection of roads that creates a certain shape. This shape is a bit difficult to explain. You would not expect two roads that are almost parallel to cross each-other - instead they would remain parallel. On the other hand, two perpendicular roads indeed meet, and would not, as it were, end just before meeting.
Then, there's a hierarchy. Wide roads that allow easy traffic from one end of the city to the other. And small roads would then fill out the different parts of the city. Perhaps it would be fine to have less- and more developed parts of the city. Some dense, some more sparse, and perhaps some space for rivers and parks.
But all this is a bit vague. We will still have to translate this into code somehow. Some parameters that assign a higher value to the kind of cities we would like than the cities we would not.
Here, the fitness depends on how much new terrain, the road opens access to. This is what is shown with the lighter green areas around the road. Anywhere that is dark is more likely to have a new road built into. Parallel roads are possible, then, as long as they are far enough apart to not encroach on each-other's areas. Perpendicular roads will meet up, since they quickly jump through the repellant light-green area.
There are some other rules. New roads spawn perpendicular to their source. Roads end when they meet an old road. Any road that travels just a single step before meeting another road is discarded. Of course, the fitness described above is not the only important part of the algorithm. But it is what makes this a city algorithm instead of just a random line segment algorithm.
The above is an example of what happens when the fitness-approach is discarded. Well, sort of.
In the original animation, for each new road added, 750 different suggestions were tested to find the one most fit. In the above animation, the fitness approach is still used, but only 10 roads are tested for each one allowed. Still, look at the difference. The above is not a city.
Another example of the effect of the fitness-approach can be seen in the first animation (sorry, you'll have to scroll up again). You might notice that the first and second half show different sorts of roads. First, long winding roads into new territory, then small, interconnecting roads. Really, there is very little difference between the two parts - only how much value is based upon meeting up with another road versus finding new terrain. Oh, and if the roads change direction or not.
In conclusion, I found this to be a pretty simple way to create cities that show a certain shape. I could go into a lot more examples of how the cities looked before I settled on the final algorithm. Really, there are a lot of different ways to make a city. I hope I picked the right one.
The fitness-based approach works opposite to a normal generation method. Usually, you might try to figure out an algorithm. Here, instead, one needs to figure out what is desired, first. So we need to ask - what is a city?
A city here is a collection of roads that creates a certain shape. This shape is a bit difficult to explain. You would not expect two roads that are almost parallel to cross each-other - instead they would remain parallel. On the other hand, two perpendicular roads indeed meet, and would not, as it were, end just before meeting.
Then, there's a hierarchy. Wide roads that allow easy traffic from one end of the city to the other. And small roads would then fill out the different parts of the city. Perhaps it would be fine to have less- and more developed parts of the city. Some dense, some more sparse, and perhaps some space for rivers and parks.
But all this is a bit vague. We will still have to translate this into code somehow. Some parameters that assign a higher value to the kind of cities we would like than the cities we would not.
Here, the fitness depends on how much new terrain, the road opens access to. This is what is shown with the lighter green areas around the road. Anywhere that is dark is more likely to have a new road built into. Parallel roads are possible, then, as long as they are far enough apart to not encroach on each-other's areas. Perpendicular roads will meet up, since they quickly jump through the repellant light-green area.
There are some other rules. New roads spawn perpendicular to their source. Roads end when they meet an old road. Any road that travels just a single step before meeting another road is discarded. Of course, the fitness described above is not the only important part of the algorithm. But it is what makes this a city algorithm instead of just a random line segment algorithm.
The above is an example of what happens when the fitness-approach is discarded. Well, sort of.
In the original animation, for each new road added, 750 different suggestions were tested to find the one most fit. In the above animation, the fitness approach is still used, but only 10 roads are tested for each one allowed. Still, look at the difference. The above is not a city.
Another example of the effect of the fitness-approach can be seen in the first animation (sorry, you'll have to scroll up again). You might notice that the first and second half show different sorts of roads. First, long winding roads into new territory, then small, interconnecting roads. Really, there is very little difference between the two parts - only how much value is based upon meeting up with another road versus finding new terrain. Oh, and if the roads change direction or not.
In conclusion, I found this to be a pretty simple way to create cities that show a certain shape. I could go into a lot more examples of how the cities looked before I settled on the final algorithm. Really, there are a lot of different ways to make a city. I hope I picked the right one.
Comments
Post a Comment