Need a large scale city generator

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Tue Oct 22, 2013 00:16

I saw your chat on IRC and was about to encourage you to use on generated instead :)

My flatten mod solves some of your problems, on a chat command it searches through the perln values of distant parts of the map to find higher ground, to avoid a flat area being created out in the ocean, it then chooses the flat area centre co-ords and knows what chunks to flatten around that, all this before any player gets near the location to generate the flat area 'on-generated chunk'.

I have an interest in big cities and the knowledge of flatten mod, i would be interested in helping you out by creating a new version of flatten mod that flattens and creates road systems 'on-gen'. You then could add code that adds the buildings in each chunk.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Tue Oct 22, 2013 00:24

For roads i suggest a city grid pattern that matches the 80x80 node chunks, the roads are around the edge of a chunk and buildings placed in the central area of the chunk. Not all 4 perimeter roads are generated though, to avoid a complete grid, the number of perimeter roads could be reduced from city centre to city edge.

When your code adds structures, it will know where the chunk is in relation to the city's centre, so you will be able to adjust city density to create a centre that also has the most roads.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Tue Oct 22, 2013 00:40

paramat wrote:I saw your chat on IRC and was about to encourage you to use on generated instead :)

My flatten mod solves some of your problems, on a chat command it searches through the perln values of distant parts of the map to find higher ground, to avoid a flat area being created out in the ocean, it then chooses the flat area centre co-ords and knows what chunks to flatten around that, all this before any player gets near the location to generate the flat area 'on-generated chunk'.

I have an interest in big cities and the knowledge of flatten mod, i would be interested in helping you out by creating a new version of flatten mod that flattens and creates road systems 'on-gen'. You then could add code that adds the buildings in each chunk.


I heard about this mod but didn't try it yet. Sounds good... might solve some of the problems indeed. Does it work with any mapgen, and is it safe to assume future mapgen changes won't break it? Also, are there any screenshots of how exactly it creates a flat area?

A version adapted for my mod would be appreciated! Perhaps you could extract the basic functions and pastebin them in a simple form, so I could integrate them myself. But no... no need to add the road pattern into it. I prefer keeping that separate and am fine with it as is.

The only thing I need help with are areas of the world being flattened before they are generated, precisely to fit a rectangular area of a given size (between about 300 and 1000 nodes). Whenever a flattening takes place, I need to know that rectangle (under the form start_x, end_x, start_z, end_z) and of course the height of the floor. Optionally, I'd also like the function to return the type of node it fills the flattened area with... so when normally it's dirt_with_grass, in a desert it would be desert_sand, in a mountain dirt_with_snow, etc... since I use this to bind cities to various environments. Hopefully I could also adapt it to work in underground zones, since I'll also want underground temple cities in nether-like realms at some point. If you could help with that it would be awesome and highly appreciated!
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Tue Oct 22, 2013 01:16

This blends perfectly with mapgen V6, but in 'indev' the biome surface materials go increasingly out of alignment towards the world edges.
> is it safe to assume future mapgen changes won't break it?

Haha funny :)
The first image in the flatten thread is all there is to see, it just generates like that with a smooth transition into the surrounding terrain, it was inspired by and partly intended for Sokomine's village mod. The flat area can be 1km no problem.
> Whenever a flattening takes place, I need to know that rectangle (under the form start_x, end_x, start_z, end_z) and of course the height of the floor.

No problem, those are set by parameter in flatten mod, the flat area can be geometric or organic in shape and can be squashed in x or z size.
> Hopefully I could also adapt it to work in underground zones, since I'll also want underground temple cities in nether-like realms at some point.

It would have to be integrated into the realm's own mapgen, you would program the realm mapgen to create flat areas, instead of flattening existing terrain.
Last edited by paramat on Tue Oct 22, 2013 01:17, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Tue Oct 22, 2013 03:04

Flatten mod lua voxel manipulator version is here http://www.mediafire.com/download/wmt2sbssl188f9c/flatten041paramat.zip (requires latest git) The version at github is the non-LVM version 0.3.1 for 0.4.7 stable.
Flatten mod is in a fairly simple form, but one thing you might want to remove is the wheatfield generating option. If you get stuck understanding part of the code i am happy to explain.
Last edited by paramat on Tue Oct 22, 2013 03:05, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Tue Oct 22, 2013 06:32

About the idea of spawning the city by parts, it is exactly was mg does. Furthermore, since mg is a mapgen by itself, it can flatten the area on its own (so I can't help you with that one). What could interest you is how the places for cities are determined. For that, there is a random probability that a city spawns in a block, and the city really spawns only if there is no other city spawning next to it (that way, there is no city intersection). You should look at the "villages.lua" file in mg code, since it is there that the positions of villages are determined.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Tue Oct 22, 2013 11:26

@ paramat: I saw the flatten mod's thread after my last post here. Nice stuff indeed! I think I'd like something like this but with square shapes instead of rectangular... should be easy enough.

The voxel manipulator version would interest me most. I looked in the code of the version you linked, and although it might take a bit to understand exactly what it all does it looks good. First thing I'd like to change are node types being hard coded in the script, as I prefer it works for custom biome definitions without having to edit the mod for each.

Thankfully v7 is the only mapgen I'm focused and interested in right now, since it allows Lua biomes. Sucks that Indev's perlin scaling breaks it, but that could be lived with. v7 is also how I plan to add nether realms, so I couldn't program them into the flatten script.

@ Nore: Your idea sounds tempting and good too! Problem is, I'm not sure about making my mod a Lua mapgen. I wanted to keep it compatible with all mapgens, and aim at using it with v7. Last I checked, Lua mapgens were slow and barely worked... unless there's now a Lua interface to call a C++ mapgen. I shall check your code as well.

What I'd really like were it possible, is if the Lua API allowed modifying the perlin noise at a certain location, rather than just reading it and using the voxel manipulator to edit. We have get_perlin, so why not also a set_perlin?
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Tue Oct 22, 2013 20:19

That LVM version i posted is untested by me (waiting for 0.4.8 stable) and may have bugs (testing and error messages will be much appreciated).in MGindev not only do the biomes expand but maximum terrain height creeps up beyond y = 47 into the chunk above. MGV7 has high terrain too. So to make it compatible with 'indev' and MGV7 i will have to rewrite it, i don't mind doing this because i want flatten mod to be more universal. Because i use 0.4.7 stable i will develop and test it in a non-LVM form and convert it when i'm happy with it, assuming you have latest git i will need you to test it for me.
Concerning your screenshots, how did you get dirt and grass added into MGV7? In 0.4.7 stable MGV7 it's just stone terrain.
I'm also interested in what latest git MGV7 does when you use the MG flags 'mountains' and 'ridges'? I saw these flags in the code. 0.4.7 stable MGV7 has mountains occasionally up to 500m, how high does latest git MGV7 go in your experience? Having terrain up into higher chunks might make it impossible to blend the flat area into the surrounding terrain perfectly.

EDIT In flattenLVM the manual flattening: chat commands 'flattencen' and 'flattenchu', probably wont work, i think they need a different use of LVM.
Last edited by paramat on Tue Oct 22, 2013 21:59, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Wed Oct 23, 2013 00:32

I always use latest GIT, and am not even following the release history. Yes, mgv7 generates a nearly perfect world for me... and I use a biome script that's months old too. For some reason it stopped spawning deserts and snowy areas however, so I should ask hmmm for an updated script. And yes, I can help test the mod if you wish... please poke me about it later though.

Anyway, today I readied the code for a system that could spawn areas in sequences. After the calculations are ran, the result is a single table of tables, each of the form { name, position, angle, size }. It would be piece of cake to store the table in memory, and have on_generate loop through it and only spawn the entries with "position" in its range. But I won't do that right away... I worked enough on refractoring for over a week. I'm finishing the road system, then I'll keep looking around for solutions on this terrain issue.

Some screenshots of buildings without the border, spawning closer to each other. Makes towns have a more "at home" feel to them. The current design won't last for long however, since I plan to enhance the default town too and add improved versions of the buildings.

[spoiler]Image

Image

Image

Image

Image[/spoiler]
 

User avatar
Chinchow
Member
 
Posts: 683
Joined: Tue Sep 18, 2012 21:37

by Chinchow » Wed Oct 23, 2013 00:49

MirceaKitsune I wish you much luck on this project and am looking forward to it.
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests
 

User avatar
Neon
Member
 
Posts: 119
Joined: Thu Aug 15, 2013 02:03
In-game: Neon

by Neon » Wed Oct 23, 2013 07:42

Those latest screenshots look really good. It looks like your hard work is starting to pay off!
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Wed Oct 23, 2013 18:30

Good work, looks good packed close together, my work on a universal flattening mod is going well.

EDIT Here's what i have so far, still testing https://github.com/paramat/uniflat
Last edited by paramat on Wed Oct 23, 2013 19:38, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Wed Oct 23, 2013 22:38

Today I added support for drawing the intersection points as well, and finished the road system. Roads are now in the master branch of the structures mod! Here's a city with roads fully drawn seen from above:

[spoiler]Image[/spoiler]

And now for something, completely different:

[spoiler]Image

Image

Image[/spoiler]

No, those buildings aren't single structures. They're the default example of another system I coded today, which allows buildings to have multiple floors. When enabled, the building requires a start, end, and middle schematic. Start is placed at the bottom, middle is looped X times upward, and end is placed at the top. Eventually I plan to randomize it, so each instance has a slightly different number of floors... but for now it just spawns the amount of segments you tell it to in mapgen.txt.
 

User avatar
Inocudom
Member
 
Posts: 2889
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Wed Oct 23, 2013 22:46

MirceaKitsune wrote:Today I added support for drawing the intersection points as well, and finished the road system. Roads are now in the master branch of the structures mod! Here's a city with roads fully drawn seen from above:

[spoiler]http://i40.tinypic.com/14t50zr.png[/spoiler]

And now for something, completely different:

[spoiler]http://i40.tinypic.com/sotl77.png

http://i42.tinypic.com/29w76eh.png

http://i41.tinypic.com/de1p8i.png[/spoiler]

No, those buildings aren't single structures. They're the default example of another system I coded today, which allows buildings to have multiple floors. When enabled, the building requires a start, end, and middle schematic. Start is placed at the bottom, middle is looped X times upward, and end is placed at the top. Eventually I plan to randomize it, so each instance has a slightly different number of floors... but for now it just spawns the amount of segments you tell it to in mapgen.txt.


Have you tried making those cities in the custom mapgen linked to below?
https://forum.minetest.net/viewtopic.php?id=7366
The custom mapgen was made by paramat and uses the terrain of mapgen v7.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Wed Oct 23, 2013 23:43

Inocudom wrote:Have you tried making those cities in the custom mapgen linked to below?
https://forum.minetest.net/viewtopic.php?id=7366
The custom mapgen was made by paramat and uses the terrain of mapgen v7.


Interesting. Didn't try it yet though. I prefer sticking to the hard coded mapgens for now, but those would be worth trying as well.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Thu Oct 24, 2013 00:43

Ah those apartment blocks are awesome 8) multiple schematic massive architecture is something i want to work on.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Thu Oct 24, 2013 10:54

paramat wrote:Ah those apartment blocks are awesome 8) multiple schematic massive architecture is something i want to work on.


Thanks. Yeah, this is exactly that. But only used to generate multiple floors, I think otherwise buildings are best kept as one schematic.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Fri Oct 25, 2013 14:22

I announced the new version of the Structures mod today, after I finished adding the final touches and fixing remaining bugs. What's been done seems to work perfectly well... but the group spawning architecture remains a huge problem. I'll eventually see how the flatten mod or a custom mapgen can be integrated to add progressive spawning. Once that's done, this will indeed be able to spawn enormous cities, and the fun can begin.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Fri Oct 25, 2013 22:15

The latest commit of 'uniflat' mod has a chat command search function for 0.4.7 stable MGV7, which automatically searches for a location with epic terrain (it actually searches for a high terrain persistence which creates rough terrain and high mountains), you can see the result in my latest screenshot. Since MGV7 has been re-written since 0.4.7 stable i need to add another search function for 0.4.7 dev MGV7, and also MGindev. Then i will convert it to LVM for you to test and edit to your needs :)
Last edited by paramat on Fri Oct 25, 2013 22:18, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Sat Oct 26, 2013 00:41

paramat wrote:The latest commit of 'uniflat' mod has a chat command search function for 0.4.7 stable MGV7, which automatically searches for a location with epic terrain (it actually searches for a high terrain persistence which creates rough terrain and high mountains), you can see the result in my latest screenshot. Since MGV7 has been re-written since 0.4.7 stable i need to add another search function for 0.4.7 dev MGV7, and also MGindev. Then i will convert it to LVM for you to test and edit to your needs :)


Not sure if that's actually what you meant, but now that I remembered: I would also prefer a function that can detect flat areas rather than generate them. Generating means more work and extra formulas that could become incompatible. I'd like it if perlin noise could be used to spot areas of X width / length that have Y terrain roughness at most. I'd still have to fill the empty space, but it would be easy to do it with the buildings in this case.
Last edited by MirceaKitsune on Sat Oct 26, 2013 00:42, edited 1 time in total.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Sat Oct 26, 2013 04:54

Detecting flat areas may be possible, although naturally generated flat areas will probably be too small for any city (apart from 0.4.7 stable MGV7 which has huge flat areas), so some sort of flattening is inevitable in an existing core mapgen. The current MGV7 search looks for a rough mountainous area but only to provide an epic surrounding for the flat area, and possible floaty bits above.
Detecting smooth / low persistence areas is totally possible, although this may not necessarily mean flatness. Again such smooth areas will be too small for any large city.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Sun Oct 27, 2013 07:23

Here's the search function for 0.4.7devMGV7 that searches for areas of *low* persistence, these will be smoother and possibly flatter.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_chatcommand("uniflatserv7dlop",{
    description = "Search Ongen Centre 0.4.7devMGV7 Low Persistence",
    privs = {privs=false},
    func = function(name, params)
        local perlin2 = minetest.get_perlin(perl2.SEED2, perl2.OCTA2, perl2.PERS2, perl2.SCAL2)
        local player = minetest.get_player_by_name(name)
        local pos = player:getpos()
        local plax = math.floor(pos.x + 0.5)
        local plaz = math.floor(pos.z + 0.5)
        local plaxq = (80 * math.floor((plax + 32) / 80)) - 32 -- quantise to chunk minp
        local plazq = (80 * math.floor((plaz + 32) / 80)) - 32
        local serzdis = 80 * math.ceil(AVRAD / 80) + 240 -- distance to search area
        local serzmax = plazq - serzdis -- search starts at a distance southwards
        local serzmin = serzmax - 1280 -- search a rectangle 2560 x 1280
        local serxmin = plaxq - 1280
        local serxmax = plaxq + 1280
        local suichu = 0 -- suitable chunk counter
        for z = serzmax, serzmin, -80 do
            for x = serxmin, serxmax, 80 do -- loop through all chunk minimum points in search area
                local noise2 = perlin2:get2d({x=x+40,y=z+40}) -- persistence noise at chunk centre
                if noise2 < -1.0 then -- if low persistence then
                    suichu = suichu + 1
                else
                    suichu = 0
                end
                if suichu == 3 then -- if 3 suitable chunks in a row then define ongen centre in middle chunk
                    flax = x - 40
                    flaz = z + 40
                    print ("[uniflat] ongen centre defined x "..flax.." z "..flaz)
                    return
                end
            end
            suichu = 0
        end
        print ("[uniflat] no suitable location found")
    end
})
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Sun Oct 27, 2013 10:24

Thanks paramat, that might be very useful. I've worked hard for two weeks on the mod however, so it will be a while till I get back to it. But I'll save that function and consider integrating it.
 

jenova99sephiros
Member
 
Posts: 158
Joined: Sat Aug 03, 2013 15:16
In-game: Jenova

by jenova99sephiros » Sun Oct 27, 2013 10:26

I hope that
I english google translator
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Sun Oct 27, 2013 23:48

Cool, just copy and paste code that into uniflat mod next to the existing 3 search functions.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
GJH105775
Member
 
Posts: 106
Joined: Thu Sep 27, 2012 16:11

by GJH105775 » Mon Oct 28, 2013 22:43

Wow, this is a project. I do believe that it can be done with defining different buildings to be generated randomly. I cannot yet conceive any way to randomly generate the interiors.
Check out my mod xtrablocks, has some different types of marble that you can build with or mine at different depths

I am not here regularly as I just kind of pop in and out. If you want to find me I'll be on quadcopterforum.com helping with multirotor builds and spending other's money haha.

http://i10.photobucket.com/albums/a119/ ... hicons.jpg
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Fri Dec 27, 2013 18:41

I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

Previous

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 6 guests

cron