Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorGathar
    • CommentTimeSep 24th 2017 edited

    I've tried to have a nice random city, but I'm somewhat unsatisfied by the existing tool. I think the cities look too modern, like a suburb where each house is placed along a road, separated from the next one. This is not what I've seen in old, unplanned cities, where everything is much more crammed together.
    So, I wondered why wouldn't I try to make my own algorithm to automatically generate a random ancient city? I will try to avoid roads: Large roads will be drawn manually on the map anyway, and minor roads, from my point of view, don't exist: They are just free space between buildings.

    I want to share with you my progress on this road. It it leads somewhere, I'll try to see how to integrate the results inside CC3+, but first, let's see if I can get something that suits my taste.

    Fist step: Just place buildings randomly, even if they overlap. The goal is just to have the basic elements, the definition of a building, a way to see my results (with zoom & scroll)... So the result is not impressive...

    • CommentAuthorGathar
    • CommentTimeSep 24th 2017 edited
    Second step, this time, we only add a building if it does not overlap another one (I had to implement collision detection to get there). The global algorithm is quite basic (and slow): Try a random building, if it overlaps, forget it and try another one... Once you fail 1000 times in a row, consider your city as finished.

    On the first picture, the algorithm added about 25000 buildings before considering it was done:
    25000 no overlap.png

    The second picture is a zoomed area of the first one:
    zoom no overlap.png

    We can see some interesting emerging patterns on these picture, but it clearly does not look like a city at all. I think it might look like people installing tents where they can during a grand meeting of the clans :)
    • CommentAuthorJimP
    • CommentTimeSep 24th 2017
    Or a typical packed Midievil city, where lanes dead end, etc.
    • CommentTimeSep 25th 2017
    Very interesting, Gathar. That second image, with the thousands of buildings on it, is impressive, proper city or not.

    Personally, I found tweaking the settings of the Random City Generator can yield some pretty nice results. Even if I don't keep them as generated, I can always delete some streets and copy/paste buildings to make areas more packed or random. Still, I'm curious to see where your experiments take you.

    Thanks for sharing,
    • CommentAuthorGathar
    • CommentTimeSep 27th 2017 edited
    Thank you Jim & Dogtag for your comments

    A third step. This time, I only plant a few buildings totally at random (100 seeds, displayed in blue), then when I create the other ones, I align them with the closest seed. This higher regularity allows to pack 30000 buildings instead of 25000.


    And a zoom:


    While I like this direction better, I think the gaps between the buildings are still too large, I'd like most of them to be in clusters of a few buildings that touch each others, and the the clusters positioned at random. I'm going to think how I can get this result...
    • CommentTimeSep 28th 2017
    Looks awesome.
    I like the first city. Really reminds me of Lankhmar. Where over ages the city builds upon itself.
    • CommentAuthorjslayton
    • CommentTimeSep 29th 2017 edited
 is a little old, but it might offer some useful inspiration.
    • CommentAuthorGathar
    • CommentTimeSep 30th 2017
    Thank you jslayton, your link looks quite interesting. I will refrain from reading it just now, as I want to continue a little bit with a fresh mind before looking at what other people did, but I will clearly read it at some point!
    • CommentAuthorjslayton
    • CommentTimeSep 30th 2017
    I certainly understand the desire to explore your own thoughts before polluting them with the thoughts of others. If you get to the point where you might want o look at what some other folks have done, I have a more in-depth set of links that you might find interesting.
    • CommentAuthorGathar
    • CommentTimeOct 9th 2017 edited
    Thank you jslayton, I'll certainly do it when my own ideas will have dried up a little bit!
    Right now, I started to work on this cluster stuff, and I've reached the following result:


    It's been more complex that I thought first, because it's hard to formulate precisely "random, but touching another one". I finally chose this algorithm:
    - Create a random building at a random height
    - Move it horizontally until it touches another building (if there is one at his height, 0 otherwise)
    - Then move it vertically until it touches another one (same special case).

    Next step: Create a city with different clusters (at different angles) and make sure they play nicely with each others. It shouldn't take too long, but I should refrain from starting a new step at 2AM...
    • CommentAuthorGathar
    • CommentTime3 days ago edited
    At first, I just put clusters touching one another, but then I decided I whanted to have streets in the city, so I made sure that buildings from one cluster could not be less than 2 meters from buildings from another cluster.

    And here it is:

    And a zoomed-in version:

    I'm quite satisfied of how it turned out.But I'm partial to the subject, so I'd really appreciate to hear comments and suggestions for improvements.

    Do you think it would be worth integrating this algorithm with CC3+? Does anyone have any idea on how to do it? Can a macro be enough? Do I need to write a plug-in? Or maybe I can generate a file in a format that CC3+ can import?
    • CommentTime3 days ago edited
    Results look quite interesting.

    As for import to CC3+, there are several options
    - Have your program generate a script file that CC3+ can run. This is the simplest option. A script file is basically just a series of CC3+ commands
    - Write a CC3+ plugin. Orders of magnitudes more complicated than the above options, but allows everything to be easily done from within CC3+.
    - Write a program that communicates with CC3+ through intercom. Basically another way to feed CC3+ commands instead of generating a script file that must be manually run, but also way more complex.
    - Make a program that can actually write the .fcw file format. Then you can simply have your program generate a starting FCW for you, and work it in CC3+.
    - Depending on the complexity of your algorithm, you may be able to implement the entire thing as a macro, but there are limitations for what is reasonable to do in a macro.
    • CommentTime2 days ago
    I am super impressed!
    • CommentTime2 days ago edited
    Amazing. *doffs cap*

    So, where's Waldo's house?
    • CommentAuthorJimP
    • CommentTime2 days ago edited
    Dogtag, it's the red house next to the other red houses.

    Sorry Dogtag... my typing goes down hill when I'm tired.
    • CommentAuthorjslayton
    • CommentTime2 days ago
    One way to build from your original concept is to modulate general building size by distance from one of a few initial seeds (subject to minimum and maximum size, of course). That way, you'd get the effect of one or more city centers.