Simple City Generator


Been working on a city generator system that instantiates along a grid. Its called by one line of code and generates the city at run time. Look intresting to anyone? Would it be worthy of putting on the asset store? Suggestions? I have it create cars and fire hydrants that line the streets. Everythings pretty blocky since I have one type of tile.

It could be extremly usefull, however you will need better models.

And better texture, but could be usefull…

what would really make this tool useful is the customizable parameters that it could have such as how large the city you need generating is, the ability to swap out the models for higher quality models, a changeable cars per block setting, the ability to add more generators for other objects that might need to be generated in someones game, a range parameter for the buildings stories, and generally just customizable control over the generator. Without the control i don’t think this tool will be particularly helpful or make much if any money on the asset store. because its called at run time it seems like it would be impossible to add things in that have to be in particular locations. that being said i think you are on to quite the handy tool here. if you keep plugging away at it i think that this very may become quite an attention and money grabbing asset.

+1

Could you make it run, save everything the generator does, disable it, then work on the city it gave you?

Yeah the models are really just for this small webplayer I’m building. If people where intrested in this I would work on the option of letting people simply drag and drop their own buildings instead of having use my own. That way they could have one city that would look completely apocalyptic, and the next scene futuristic, so on and so on.

Right now the only way to do that is call the city generator, have your scene play, copy all the elements of the city while the games playing, stop playing your game and paste everything back into the scene, and delete the line of code that calls the city generator

CityGenerator.BuildCity(cityWidth,cityLength); is what the line of code thats being called to create the city. the integer you use is how many tiles will be created ( so (3,5) will give 15 tiles). I understand I’ll need more customization than that though.

I was going to allow people just to use their own models to customize there own citys if people thought this idea was good.

I was thinking of the option of letting people take control over an entire tile in the inspector, either specifying the location or having it random. One example is specifaclly having a tile that shows one building that is city hall. Another example is having a park take up a tile somewhere at random.

Thank you very much for all the sudgestions! I’m probably going to be implementing many of them.

This can be very helpful for my project.
You have the base concept that is very interesting, but yeah, as other people mention, you need to make it more attractive.

Its too rough at the moment to sell anything on the asset store yet.

Yeah, you don’t need to provide high quality model, thats our job to replace it with our models.
You only need to focus on the city regerator tool.

Yeah, for example, adding any kind of object or special tile would be cool.

So based on a grid, we can make any object, respect the size of the grid, and add it in the array map wherever we want.

I am very interested in this, so please, update this project !

Is it possible to release the current code? I’d like to have a look at it, I’m trying to teach myself some procedural generation techniques :slight_smile:

The grid idea is a good concept, however in order to make a realistic city you will have to think of the structure of a city more. Usually there will be at least one main road going through it leading to the town center or central business district. All of the commercial buildings will be on this road. And then there’s a bunch of roads branching off the main road that usually goes to residential areas. Residential buildings should outnumber commercial or industrial buildings. The city forms around main roads and they sculpt the shape of it. Main roads are also like the arteries of the city while the branching roads are the veins.

If the main road get to packed with commercial buildings, then the city might construct another main road that goes through the city in order to improve traffic flow. Then more commercial buildings start filling into the new road and you end up with a old part of town and new part of town.

When building a city, think about how it started and how it grew. You can get a lot of ideas by looking at google earth and studying the structure of cities. In some areas they even have a time line slider that lets you preview how the city looked like 20 years ago and progress to present day to see how the city changed.

@roger0

Dude, i totally agree with you, but the point is making this kind of city you describe is totally painful and take so much time to accomplish…
That’s why i talked about a modifiable grid on top of the City Generation tool.

But, yeah, its complicated to make a generated city that looks realistic and not lifeless…

Eli Davis should bring more idea about his concept anyway.

how did you made that city?

@ Eli Davis

no problem im glad that i could give you some ideas on where to go with this. im quite interested in this tool and ill be checking in on it as frequently as i can to find out how it is going along and maybe provide more feedback. the grid system seems like it could work fairly well for making objects stay in particular locations. I am not sure how but it would be good to script out a way to save the city into an empty folder with all the necessary pieces in order to save the city as XNiinja described. people are far too lazy to save every piece out while the game is running.

@DLGScript

I wrote a short post kinda showing how I did the city, along with alittle bit of code. My code would be of no use to you because It’s calling upon multiple factories and a Manager. I hope this blog post helps out. It atleasts gives a fair idea on how the city is acomplished

@Suctioncup
You can look at my blog post, but this guys thesis is much better if your wanting to teach yourself some procedural generation techniques

That’s a great idea, a smart city that constructs it’s self based on size. The grid concept should make it easy to do this also. Thank you for your input

Is this project still alive?

Looks extremely useful, definitely put it in asset store.