City Generator -- Free Procedural City Generation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello ladies and gentlemen mike here at game from scratch today we're going to be looking at a really cool tool and one of those things that's all the rage right now is procedural generation so what we're looking at today is the procedural city generator now what this one looks like from you know a thousand miles away is a 2d map generator but there's oh so much more to this one so what you want to do if you want to check this one out is head on over to your web browser and head to itch io specifically to probable train dot itch dot io forward slash city dash generator of course i will link that in the linked article down below this one is an open source project we'll get back to that in a little bit if you like what they do they're also being supported on patreon so when you first see it it looks like it creates simple 2d maps and actually yes it does that it actually uses a procedural generation algorithms to create cityscapes with roads and buildings and parks and rivers and lakes and so on but you can also use it to export out 3d models which is actually something we're going to look at in this video as well so when you are ready just go ahead and hit that run generator and it will bring you to this form uh now what you're seeing here is a bunch of tensor fields and these are so you sort of see your city center being generated here we can kind of drag it around and really influence on how our city is going to be created also the level of zoom the amount that you are zoomed in is going to determine the um the level of detail on your city so the more you zoom in the smaller your city blocks are going to be but what you can do is basically drag around these tensor fields and it will influence the flow of the city itself you can sort of see like a top level effect of these fields in action right here but when you are content with what they have done and all these various different other options here there's a recommended order on the website basically uh start with the water make sure you like it then move from there and then city buildings and so on all i'm going to do is drop a bunch of tensorflow in and then click generate so what this is now going to do is procedurally generate me a city uh we almost always seem to be a city by the shore so i guess this one is like uh i don't know kind of like toronto we got the waterfront here we got a little bit of a lake coming in here we got a couple of roads going on here um and you know what if you don't like this you could just basically create a brand new one you could also zoom out generate it create something a little bit bigger uh you can swap out with how the water is being done so for example if you find there is too much water in this one you can drop down here go to water and you can generate it again and really this is kind of where they recommend start with it's also really lightweight so you just keep hitting until you get a nice amount of water going on like so because our last one we actually had a fair bit of water you also got control over coasts and rivers etc so you know we'll go ahead with this one you got the same thing you could do for uh parks in the lands so we could set some parkland up in here uh major and minor entries and then when you're happy go ahead and click generate again and it will use those preset settings for you so here is a result sort of see like a classic spoke wheel hub as things evolve and then the natural lead out from it now this particular style can be changed obviously we can come over here and you see color scheme it's a strange name there because there's more to it than just color scheme uh right now we're on default it's sort of like a hand drawn we can also go to a more hand drawn kind of like that uh we can have it look like apple maps we can have it look like uh google maps or we can actually even have it look like google 3d here and as you zoom in and out you're getting the 3d models that are generated so that is how you go about generating your cityscape and then again if you just want to do this and save it out as an image so you see download here but you just save this out as a ping file so if you just created like a 2d level map uh you could just create it in various different ways here various different styles or looks uh or you could create it like a paper drawn map you got all kinds of 2d options available here but what you could also do is spit it out as a height map which you could then extrude out in your program of choice but what we're going to do instead is bring this one out kind of like this we're going to bring this out as stl files now this is going to be a little bit annoying to work with at times but i'm going to showcase how to do this so go ahead grab the stl file let me drop out of the so you see right there it is downloaded called model 2. let's go ahead and show that in the folder and we'll extract that out so extract the contents of that guy uh to get model 2.zip sure good to go so here we go and what you see is we've got a number of different layers for our model so let me just change that so the name doesn't get confusing later on for me all right here we go so we've got all the different layers we're only going to use a couple of them mostly for time's sake and to put these together i'm going to use blender now there's instructions for this unfortunately they use blender 2.79 and one of the the few real regressions that happened with blender 2.8 is they took out the boolean tool that this used so the instructions won't work for you if you are using blender 2.8 however blender 2.91 which is currently in beta has a new blender feature so that's what we're going to look at today so we're going to use blender 2.91 for this hopefully this will be released very soon otherwise you have to use blender 2.7 something 2.79 or later so here's our scene let's kill the default cube and now we're going to start bringing things in so go in here go file import stl and the first one you're going to want to bring in is the domain so let's go ahead and find that guy that's downloads let's model oops i missed model 2 model 2. okay so what you see here is domain you can think of that as all that i survey is my domain all right so there is our domain uh it's pretty basic it is basically uh uh well it's a flat rectangle so now what i'm going to do is a little bit of work to get this looking good so first off hit tab to go into edit mode and then i'm just going to go ahead and do an extrude and then hit enter now normally what i'd like to do is just extrude and pull it out along a certain direction unfortunately you can't extrude z-axis of a zero width object i just discovered that by the way which is annoying but now that i just extruded out we got a new face then i'm going to hit the g key the z key and then one so what i did is i just moved our freshly extruded faces out one in the z axis so you can see here is the end result we have a bit of a square hit tab and we're going to leave it so there is our base model so now what we're going to do is bring in the water so we're going to do this by going file import stl and that is called c so this is like the big water here you can see how it is cut out so now i'm going to do a couple of things here first off i want it to be slightly elevated so that it goes beyond the bounds of our map so when we cut it out it will cut everything so i'm going to hit g and then z and then 0.1 and that just moved it up really really slightly so now i'm going to hit tab to go into edit mode hit extrude and then enter and then i'm going to a g a z and then one so what i've just done is basically extruded so i moved it up just slightly and then i extruded all the faces up a little bit more actually i could go a little bit more so i'm going to do g 0 1.1 instead so g 0 and since i've already done it so 0.1 all right there we go so we're slightly out of the bounds of our original shape and then now hit tab to move out of that so there we have our two objects working together there is our domain and there is our c now what we have to do is subtract our c from our domain this is where the blue booleans come in so select the domain like so go to the modifiers this little wrench icon right here and just go ahead and then uh we want to do a boolean so this is what was added in 2.91 is this new functionality so exact is slow but accurate so what i'm gonna do is with different selected go ahead and pick c so now what we've done is basically cut the c from our domain and we can go ahead and there's the end result uh i actually did that backwards there we go so c is gone domain is there so now that's what we've got so what if you really want to at this point time you can hit you can select the c and just delete it and you can repeat this process for the other thing so for example we come in here there's also import uh stl you'll see here you have the rivers so for example i could bring this river in uh and once again we could go ahead and edit it extrude uh let's do zed 1.1 went the wrong way but you see basically you you bring your rivers in and then you start cutting them out uh one thing i find once again you cannot do an extrude on a zero width z axis it's very irritating it's going to make this process really annoying what you do is basically just keep bringing these in and then differencing them out there's also one there for coastline and you do the opposite on that one so what you do with the coastline let me just get out of edit mode here uh with the coastline you bring it in but when you do your boolean on that one let me just show you in the boolean what you're going to do is add it instead so add a union and then select your coastline so once you've got all those various different things brought in uh so let's get rid of that guy right there so we're happy with our world and the way things are set up we come back in here we can start importing the other stuff now one of the more exciting ones is going to be the building so i'm going to come in here stl and then let's grab the buildings the buildings don't actually require any work uh we basically just have to go grab z one and then bring them flush with our because i moved the whole city up by one or sorry they'll hold the main up by one so there you see now we have our buildings are on top of our city some really cool stuff okay so we're almost there uh we got our cities brought in so you see here we've got some uh we got some spaces here for parks that were set up and so on uh we have that river that cuts through i didn't cut it out so that's why you're not seeing the mesh go down here but if we'd imported the river and cut it out this would be an empty space here and then we would have bridges that came across speaking of bridges let's bring the rest of the stuff in so come in here go to import stl so you can think of the stl's just basically pancaked layers of data so we've got the coastline split up there rivers roads and so on so let's bring the roads in seriously the roads let's go ahead g zed one move them up and flush we could go ahead and apply a material to our robe let's make our roads black okay sounds good to me so there we now have roads in the environment yeah that might be a little too drastic there's our roads running through this network let me just go back to this look better uh now what we could do is go ahead and bring in the one last component we've got going on so file import stl and then we've got uh the blocks and we can bring in the blocks and then once again uh g zed one enter and then some of these things if you want them to look a little bit better what you might want to do is go back into edit mode so again hit tab do an extrude enter and then a g z and then the amount you want to move it up by so 0.1 there we go so our blocks are moved up slightly you could perform the same thing on the road because i just moved our roads down a little bit so what i could do is come down here and go uh g zed 0.1 moved our roads up like so and there's everything in here to get oh i'm in edit mode still object mode all right and then there what you're seeing here and let me just go into fly mode here is a city procedural generated ready for texturing exporting and so on all of the roads are in place everything is ready to go all you need to deal with basically is again i didn't cut the river out so this space would be empty because the river would carve it out if i'd done that process and then there's also if you imported this the shoreline it wouldn't drop off like it does here into the the great unknown divide otherwise you have a procedural city in what would one you know once you know what you're doing here literally take just a few moments time now the only downside to this process and i i know there are tools out there for this but i don't particularly know uh which one is our problem is we still have our buildings here so for example whoa whoa whoa don't hit tab don't hit tab let's go back up downside to flight mode is when you hit the uh the tab key before leaving flight mode it lets gravity take its place all right so here we go so we're in the environment uh switch to building mode right here you can see these buildings are all sadly untextured so what we kind of need to do at this point in time is start texturing them and unfortunately this process is where i don't know a perfect way to do this yet go into face mode for example it's really easy to texture an individual building so basically grab all the faces grab the faces on all four sides and then what you can go ahead and do is something like um unwrap uh we could do uh cube projection right there and then we could go ahead and start assigning materials to it for example i've got uh let's go here new use nodes sure sounds good to me uh go over into your shader editor like so bring in some kind of a texture so i got one right here-ish uh [Music] where did you facade okay oh no that's a zip i want the color all right there we go so we could bring we can bring in our texture maps like this and then we can apply them like that so then we have a texture in our world the problem is we now need to um get the texturing to work right for all of the individual buildings so here you see we just textured one building actually i textured one side of one building so there has to be a way out there to basically say take all the selected buildings and wrap them in this texture i unfortunately don't know what to do on that regard i think the easiest way would do to be is to actually probably write a script to do this but as you can see you can start bringing in a number of different textures and applying them in really fast the catch is i don't know the ultimate way to actually showcase to you right now so you're going to have this process the one thing that's missing from this is texturing your stuff and if you have a good suggestion the best way that you come in and texture your procedurally imported 3d buildings i'd love to hear them because uh i again i don't know a wonderful way of doing this and doing each building by hand like i just did that one single building that'll be painful again i think it's kind of one of those things that you should be able to get into a script so you can go here uh we can we can go in edit mode we can go to buildings we can hit a select all the buildings and basically there's got to be a script out there that says wrap these as if they were a building i just don't know that script so if you have a suggestion for a script like that i would love to hear it because once you get the texturing down you're done you're ready you can start using these in your game of choice and you can easily use a tool like this city generator to create 3d assets that can then be exported into your game engine of choice some really powerful stuff unfortunately the stl process is a little clunky it'd be kind of cool if you just exported this out as a single obj file that you could import in and go go from there but um you know it's not that painful for the most part especially because the buildings and all that stuff kind of come ready to go by the way with the buildings since we've got all these polygons selected right here at any time i could have just done like a scale zed and we could start moving you know so if you wanted to resize your city uh you can easily do so the defaults you you're not particularly stuck with so you can change things around however you wish and you can create some really cool cities really really fast using this tool or again like i mentioned earlier on you can use this to create 2d style maps or rpg style cities if you wanted to and you know the sky's the limit on this one also as i mentioned earlier on this is an open source project it's under the gpl three license uh there's definitely some encumbrances with gpl so do make sure uh you check that license out if you're working on a closed source project or you're going to change the code in any way you're basically going to have to contribute your changes back up to the project if you make any changes that's one of those natures of gpl now you should be able to use the contents that you create using map generator uh in a closed source project no problems there it's just involved if you're using the source code so if you want to use city generator in your own game for example like the actual code then you would have to make your own code also gpl v3 so it's one of those things to be aware of but if you're just using the raw generated assets you should be fine there's no base mesh or anything in in action here so you should be completely good in that regard so anyways that is a city generator one of those cool procedural tools that are all the rage these days let me know what you thought and once again if you've got a cool suggestion for quickly texturing box texturing a selection of buildings i would love to hear it talk to you all later goodbye
Info
Channel: Gamefromscratch
Views: 306,411
Rating: undefined out of 5
Keywords: City, Generator, Procedural, Procedural Generation, City Generator, GameDev, Game Development, 3D, Map, Blender, Game Design
Id: ligKs9aXKsA
Channel Id: undefined
Length: 16min 17sec (977 seconds)
Published: Sat Nov 21 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.