Generation city (procedural)?

Map
2D.
There is a level square grid (green field) dimensions X*Y.

Objects
There is a set of objects to be tiling different types:
1. Construction - 3 figures, consisting of squares (analog: from "Tetris").
2. Trees - 3, size: 1x1, 2x2, 3x3
3. Road - size: 3x3 (for one lane).
4. Pedestrian road - size: 2x2.

Conditions:
1. Any surface can get any building and trees.
2. You can not only pass through buildings and trees 1x1.
3. Any impassable objects are not adjacent to each other.

Question: as a procedural pave a given area so that it was like the city?
How to make these criteria for generating the structure of the city?
April 19th 20 at 12:32
4 answers
April 19th 20 at 12:34
Solution
Cool task.
I would have lots of (most likely hands - that was nice) a lot of templates - a La "neighborhoods" talk less, then they already pasted the city.

If you just need procedurally it is necessary to begin probably with roads - they have clear requirements, a La graph, where vertices are regions (probably).

Well, a couple of articles:
https://habr.com/ru/company/piter/blog/455004/
https://habr.com/ru/post/320140/ (Yes, it's a maze and not the city - but there are some common features)
Thanks, I will look! - Litzy.McKenzie47 commented on April 19th 20 at 12:37
to generate blocks you can use something like this - jefferey.Bednar84 commented on April 19th 20 at 12:40
@edyth.Bednar84, Yes, I agree! - Litzy.McKenzie47 commented on April 19th 20 at 12:43
@Maurine.Daugherty82, so... understand a little.
We need to create for each object its set of superpositions and their circular hash to ensure diversity. - Litzy.McKenzie47 commented on April 19th 20 at 12:46
PS: @Maurine.Daugherty82 it modellity easier to the algorithm to debug? How are you doing? - Litzy.McKenzie47 commented on April 19th 20 at 12:49
@Litzy.McKenzie47, I did not do )))
But yuzal would have known his own tools. In the same unity can be a prototype to stack - Maurine.Daugherty82 commented on April 19th 20 at 12:52
@Maurine.Daugherty82, take JS at once and at the same time navigable Modeler pocket) - Litzy.McKenzie47 commented on April 19th 20 at 12:55
April 19th 20 at 12:36
Solution
I think the collapse of the wave function can help you.
Briefly but accurately! - Litzy.McKenzie47 commented on April 19th 20 at 12:39
April 19th 20 at 12:38
nuuuuu, you need a separate article on the topic, and not here to ask. Because the topic is very extensive (if you want something really similar to the city, not just randomly scattered objects).
If you don't care how it will look in the end, we may immediately, without thinking, to offer 2 options:
1) to dance from place to randomly house and then lay randomly the road between them, parallel to the scattering trees around
2) to build roads, and the roads ponastavili houses, among themselves, to link walking paths, and the trees peakedat randomly on empty plots
Almost there!

Remains of the "along the road to ponastavili house" to get inside the road "Islands," were home, too, and all this would not be the same type, and free space there would be optimal: not enough and not many. - Litzy.McKenzie47 commented on April 19th 20 at 12:41
@Litzy.McKenzie47, intersecting roads form blocks. That was not the same type of blocks, can fill their homes, using a simplified version of Poisson Disk Sampling - the houses are randomly generated inside the block, but no farther and not closer than a certain distance. Thus the house will be placed, not as in the grid and random, but at a certain each other the distance - jefferey.Bednar84 commented on April 19th 20 at 12:44
@edyth.Bednar84, the road grid - I do not need.
It is necessary that all generated randomly, but how would I manually put this: that all would be harmonious, as in a normal template and not the city. - Litzy.McKenzie47 commented on April 19th 20 at 12:47
Dance IMHO better from the road ) All the same, they are supposed to be all connected. And then there will be a pillar in the middle of the road... - Maurine.Daugherty82 commented on April 19th 20 at 12:50
@Maurine.Daugherty82, not because the road is always possible to define the distribution of the "energy chain" in one straight line: the longer the path is, the probability of rotation increases.
After any twist - lock ring only in the direction of rotation.
A new ring adjacent to the rotation (extending canvas) to a straight road (the canvas side). - Litzy.McKenzie47 commented on April 19th 20 at 12:53
@Litzy.McKenzie47will not receive then the "donut" with nothing connected? ))
Well, that is if the goal is to get from any point to any point using only the roads and sidewalks better IMHO from the roads dance. Or complicate generate an not roads. - Maurine.Daugherty82 commented on April 19th 20 at 12:56
@Maurine.Daugherty82, Well, you need to consider how to collect and superposition criteria.
Weight and criteria, roads and other facilities - are two different things.
Ie, something like the wave cascade is necessary.. - Litzy.McKenzie47 commented on April 19th 20 at 12:59
@Litzy.McKenzie47, the so-called "simplified version of Poisson Disk Sampling" good for random placement of trees or buildings in the quarter. You specify only the density of"development" and the trees (or houses) themselves are scattered randomly according to a given density parameter. I wrote something similar recently - ben98 commented on April 19th 20 at 13:02
@ben98, there's a little something: chaotic - I don't need.
You need to be beautiful: to the city - was a city (as if I handed him bildil). - Litzy.McKenzie47 commented on April 19th 20 at 13:05
April 19th 20 at 12:40
The city looks like a city when the houses and neighborhoods there are angles close to 90 degrees. Such is the fuzzy crietria.

I think this problem can be solved by the genetic algorithm just throwing at the map of the random polygons of the houses and then the selection to select those which are most parallel or perpendicular to the roads.
On a square mesh and so all the angles are 90 degrees.
And how is this grid to create a city - that is the question.
Where to start, etc. - Litzy.McKenzie47 commented on April 19th 20 at 12:43
I would start with the historical background. The city is built as 1 big main street. It has a Station. Town hall. Pharmacy. Bank. Further from the main street - side streets. All randomly. Random length. Further houses are built. The trees along the roads. - Wava_Donnel commented on April 19th 20 at 12:46
@Wava_Donnel, Main street - can be an intersection with 4 outgoing rays.
And an l-shaped angle, and a U-shaped road.
It all depends on the landscape and existing historic buildings.
Therefore, the decision to always use one big main street - is clearly the template.

It has a Station. Town hall. Pharmacy. Bank. Further from the main street - side streets. All randomly. Random length. Further houses are built. The trees along the roads.
I understand. The question was: how to automate the building randomly? - Litzy.McKenzie47 commented on April 19th 20 at 12:49
Great. In the first step we randomly select form the main street. G shaped. U-shaped. Video. And then again in my algorithm. - Wava_Donnel commented on April 19th 20 at 12:52
@Wava_Donnel, the Algorithm will not work: after road - home to arrange so that was fine. - Litzy.McKenzie47 commented on April 19th 20 at 12:55
But as happens in real life? - Wava_Donnel commented on April 19th 20 at 12:58

Find more questions by tags Development of gamesAlgorithms