CityScaper is a procedural city generator script that attaches to a GameObject and makes use of the libnoise engine to create dynamic cities that include your own models.
Originally created as a simple tool for a WIP Game Project, CityScaper was designed to create varied city backgrounds for level to level sidescrolling city gameplay. It’s since been improved to be capable of much more, and we’re sharing it with the Unity Asset Store to help us fund our current game project, and begin releasing new assets, some of which seamlessly integrate into CityScaper.
Rather than rendering geometry for you, CityScaper takes meshes you create, and assembles them in city formations. The generation system is based on a 5-point concatenation, similar to a smooth voxel engine. You have direct control over the look and purpose of the city. This can currently all be done through the Inspector after attaching the script. View the sample video and check out the Asset Store for a short tutorial on using the script.
Features:
Works with Procedural Materials from Substance Designer 4
Exposes the powerful libnoise engine
Can be rendered with or without colliders
Buildings can be built within 3 sizes
Uses density values to give you control over where buildings are placed
Can generate any type of heightmap terrain
Intended Uses:
Generate cities for background or interactive purposes
Generate and save cities for further detailed editing
Generate cities during load times through scripting for procedural levels
Creative Possibilities:
Generate procedural caves, dungeons and mazes.
(We apologize for the audio quality, this video is only temporary)
A growing set of street possibilities to create more complex shapes including:
a. A highway system.
b. A railway system.
Full-Size Editor
Note before purchase:
This generator only comes with 8 basic building models, and basic street meshes. You are intended to fill it with your own 3d content.
This program contains support for Substance Archive files from Substance Designer, however it currently only randomizes exposed colors, further functionality is planned in the near future.
This program currently renders a high amount of draw calls in large cities. An integrated Atlas Creator is planned, but until then solutions are still available for free and at a premium in the asset store.
We’ve had very little opportunity to properly QA this product, please report any errors you encounter or features you think are missing.
Please post suggestions and requests! Help us improve this product!
I’m personally quite anxious to see what people make with this script, I encourage posting pictures of your results!
ChangeLog
Initial version: Please post all suggestions and requests here on this thread, or email them to thetiki@gmail.com with the subject “CityScaper - Request”
Version 1.0.1: Asset folders repackaged to follow Asset Store’s folder structure. Added Tutorial Video and Support thread to Asset Store Description.
Version 1.0.2: Code has been cleaned and optimized slightly, small edits to the demo scene for quality purposes.
Version 1.0.3: Noise-Based District/Density System. Fill Blocks Option.
Version 1.0.4: City Smoothing Option. A slider that integrates diagonal and curved roads to smooth your city around the edges.
Version 1.0.5: Terrain Generation added. Select “Generate Terrain” to see more options. Multiple noise functions exposed. Terrain presets for Hills, Valleys, and Mountains are included.
Version 1.0.6: Fixed bugs related to scale and position, particularly with Terrain alignment.
Capped LibNoise references to avoid compatibility errors.
Added labels to fixed lists so it’s easy to identify which entries need which street pieces.
Added a basic error reporter, advised to simply copy the debug logs and email them instead. Updates below are pending review: Updates below are being packaged for review:
Version 1.0.1: Asset folders repackaged to follow Asset Store’s folder structure. Added Tutorial Video and Support thread to Asset Store Description.
I’ve also started a blog I’m going to keep updating, which will follow the whole experience we’ve been going through, as well as leave tutorials and other useful information for other developers.
Feel free to take a visit over at: http://tikihubgames.blogspot.com/
At this point I’m going to begin working planned features until I can stir up some community feedback. Please remember I’m looking for requests, if you purchased the product already, please let me know if you need any help or have any concerns/comments/suggestions/requests.
I had originally posted that there are a large amount of draw calls, but I had honestly only been assuming this as I’d not performed any major optimization on that end. I had not anticipated the power of Unity’s current batching system. There are still a large number of objects, but only if you’re rendering a very large city. Currently it’s batching about 40%* of the draw calls due to my use of .sharedMaterial
I still plan on building a custom atlas system for CityScaper, but any existing program that automatically creates Atlas’ would also work. For now I’m moving on to optimizing the generation and thoroughly cleaning the code of excess comments, unused variables, reiterated processes and other nuisances that may weigh down the already fast generation process. I’d like to be able to send that update by the end of the weekend to ensure it reaches the store this week.
By the end of tonight I should be finished with that and beginning work on an integrated terrain generation that will allow you to render mountains and rivers within your city’s pattern. I hope to update that by the end of the week, and get it to you (on the store) sometime around Friday or the following week.
As I finish any of these updates, if you can provide me with your invoice #, I am glad to provide you with these updates directly, as well as any other updates or requests you may need.
Version 1.0.2: Code has been cleaned and optimized slightly, small edits to the demo scene for quality purposes.
General Optimization is finished, there wasn’t that much to do. Mostly reducing declarations and removing extra lines. Next is the integrated terrain generation, I think that’s something that will really add to the effect of the scene. The idea is to introduce a patch of procedurally generated terrain with an adjustable size that will integrate with the shape of the city. I’ve already built a small voxel engine in Unity, it should be relatively quick to accomplish. The next post will be pictures of the result. This should allow for the formation of coastal, river side, mountain base, florida-flat and other city types, before you even begin introducing your models.
On a side note, I’m looking for other ideas, if anyone has any requests for other scripts, please let me know.
I haven’t had any feedback, I’m not sure if that’s good or bad, but please feel free horde us with questions and comments!
For instance, if I replace the streets meshes with a castle-type dungeon floor, and instead of buildings, I place walls
e.g instead of 6x2 I place an wall 6 x 0.5 for coridors,
3x2 I place walls for a room 3 x 0.5 (wall width 0.5)
and if this package would help by placing the wall type symmetric along the floor - I think this is a good start for a dungeon.
Is it possible to have stairs, bridges, the floor on 2-3 levels, and definition of starting room and goal room like in the package named DunGen (Dungeon procedural Generator)? If this would be possible, I am more than interested in buying this.
I the future I’d like to make CityScaper do quite a number of things. One would be to allow you to create a terrain of your own, and attach the script to that terrain. It would then map a city out over this terrain with your models (This would be after the current planned features are completed). So I suppose you could create a terrain to properly manipulate the script into doing something like that once the script reaches that point. Otherwise, I’d also like to create multiple states for this script to allow better toolsets for dungeon and terrain/foliage generation, but the dungeon functionality would be one of the later projects unfortunately, and I’m unsure (at this point) if I would simply convert it and post it as a new asset, or integrate it into CityScaper. How far in the future that is would be something I can’t tell you yet.
I began work on the terrain generation, but at the suggestion of goat, I plan on integrating a noise based district system today, and then beginning to add options allowing you to leave the current city structure, with main streets and the buildings along them (ideal for aesthetic purposes like skylines) or start to fill out more buildings (better for interactive cities, first person or strategy). I’ll post an update as soon as I’ve got some visual progress.
How is it possible that your asset is approved to be sold in assetstore while its using libnoise?
Many packs were declined because they were using libnoise.
I dont know why, but mine and many other peoples assets which using libnoise ports were removed from the store before.
And i want to know if this has changed now.
I’m very curious about this myself. I had actually left a note about it when submitting the asset. It’s an incredible tool, and meant to be used for purposes like this. It seems a shame to deny that kind of evolution for it.
Also, this is not technically using LibNoise. It is LibNoise.net, which is a port to C# by Jason Bell. I will update that in the description.
I didn’t get as much time as I’d like to work on the program today, between running errands and answering emails, I was consistently distracted. I did get the base for starting the district system built, and even started adding new features using the base. There’s now another Toggle option that allows you to fill in the tightest blocks completely. Not necessary for a skyline, but when setting up districts, it’s better I integrate this for interactive cities now. Here’s a screenshot:
The last few days I’ve been setting up a nested list in the Custom Inspector, something I’ve been challenged by since I first started toying with Unity quite some time ago. After three days of troubleshooting and stupid mistakes, I feel I’ve got a very firm grip on nesting lists in the Editor interface as many times as I’d like. Here’s a little info on what I’ve been going through.
Anyway, I’m just getting to the density set-up now, after having completed new interface, block types included. You begin without block types to edit, once you insert your first building entry, block types will show up. I’m finishing the final functionality right now, which is to allow the block types to filter the available buildings by their density, making them easier to modify visually. Once that is done, I get to actually incorporate these arrays to make the blocks identify themselves as one of your block types, based on the noise function already being used, then fill in buildings associated with that block type. Any streets not part of a block will generate a density value of their own, and apply appropriate buildings, preventing the “too uniform” predictability that would otherwise arise.
Another update. I’m preparing this one for upload, which may take another day due to debug system requirements. Don’t want you guys creating infinite loops because you haven’t filled all the density values. Included is the Fill Blocks option, and the density system. This should add a lot more control to the look of your city, as you can directly influence where buildings appear in your city. Here’s a screenshot to give you some idea. The update I’m packaging won’t include a more sophisticated example just yet, but my designer has been doing some great things, and I’m excited to get this engine’s example scene really showing off what it can do. For now, here’s a great example of how far the engine has come in just a couple of days. Please leave suggestions!
Think of each repeated building as an archetype, which you can fill any number of buildings into to make the city look how you’d like. Of course, this pattern is just a result of the 6 noise variables and random chances.
I’ll spend some time tomorrow integrating diagonals. Curved roads will take more time, they require a bit more in the way of pattern recognition, but I’ll start on it. I’ve got the terrain generation pretty far along, but it’s not calibrating correctly yet, I’ll pick up on that when I’m done experimenting with the rest of my road concatenation possibilities.
Alright, I’m getting to work now on diagonals and small curves. The generation system is based on a 5-point concatenation, generating the world in a similar fashion to that of a smooth-voxel engine. The diagonals and small curves come from two easily identifiable permutations, and should not take long to integrate, however I will have to make a couple of new models and textures to represent them as well, I’ll put up another post when I’ve got some pictures.
Update: Got a lot of other stuff done today, mostly errands and personal stuff, but I haven’t started coding in the diagonals yet. I have finished writing up the generation steps for them though. I’ll have to create the new models first, so I’m going to get those finished up tonight, and tomorrow I should be able to get them integrated by the end of the day.
It’s been too long since I could get an update up here, and I’m about to post to the blog with a longer description of what exactly I’ve been up to this week. In a nutshell, I spent a good chunk of time approaching the diagonals from what I would not call the wrong approach, but managed to set up a neighboring array as a result which will make pattern recognition a breeze from this point forward. The only hard part will be figuring out how to pin down a pattern possibility exclusively to integrate large curves and more organic shapes, I’ve got a nice headstart already as a result of the “wrong approach”.
Meanwhile, I took what I would call the right approach, and now there is an City Smoothing option to move between three values in order to smooth out your city with diagonal street meshes. Here’s a preview of the 2nd and 3rd option, as the first you’ve already seen. The chances on the 2nd are about 80% sharp, 20% diagonal.
These diagonals will have buildings next to them, and then I’ll be integrating a 4th and 5th option that allow for small curved roads which don’t generate buildings. This update will be uploaded by the end of the night, so expect 1.0.4 to hit the asset store this week or next.
Lastly, I’m leaving the current start to the terrain generation with the interface toggle commented out. If you purchase the product and have coding experience with terrain generation in Unity, you have the tools to generate what you’d like available until I finish that addition as well.
As I continue to work on more creating more complex shapes, does anyone have any suggestions or requests related or unrelated to CityScaper?
Version 1.0.3: Noise-Based District/Density System. Fill Blocks Option.
Version 1.0.4: City Smoothing Option. A slider that integrates diagonal and curved roads to smooth your city around the edges.
Terrain Generation is up next! There’s is a bare bones code snippet accessible by uncommenting the editor lines for “Generate Terrain:” included in 1.0.4. This version gives you significantly more control over the look of your city, have fun experimenting with the density values!
Regardless of your interest in purchasing the product - Does anyone have any suggestions for CityScaper? I’m down to just a few modifications on the board, and once I hit the end of them I’ll be switching to another asset I’ve got nearly complete already. I’d like to gather as many ideas and suggestions as I can in this early stage of my game’s development.