• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

KingGen - A Random World Generator for 7 Days to Die

Hiya, as a custom map maker who extensively uses custom height maps, and custom poi preferred placement maps to generate real world terrain and approximate position city maps for the game I would really love it if it was possible to include options for a poi placement map similar to the nitrogen city and town preference placement map which is used in the mask map which also allows me to limit the land volume where pois are actually placed - something quite important when making island based maps for example as I would not want poi's spawning out in the water areas.

I have not tried your tool yet but do intend  to give it a thorough work out over the coming weekend as it appears to have a lot of potential and it's refreshing to see something new come along that might indeed surpass the results nitrogen gives. I will be able to also give feedback on the linux side of things as I run both a win 10 gaming / editing rig and 3 ubuntu based servers

Keep up the great work

PS are the source files available at all if you do not want to add these changes to it so I can add them myself?

 
Last edited by a moderator:
Hiya, as a custom map maker who extensively uses custom height maps, and custom poi preferred placement maps to generate real world terrain and approximate position city maps for the game I would really love it if it was possible to include options for a poi placement map similar to the nitrogen city and town preference placement map which is used in the mask map which also allows me to limit the land volume where pois are actually placed - something quite important when making island based maps for example as I would not want poi's spawning out in the water areas.

I have not tried your tool yet but do intend  to give it a thorough work out over the coming weekend as it appears to have a lot of potential and it's refreshing to see something new come along that might indeed surpass the results nitrogen gives. I will be able to also give feedback on the linux side of things as I run both a win 10 gaming / editing rig and 3 ubuntu based servers

Keep up the great work

PS are the source files available at all if you do not want to add these changes to it so I can add them myself?
Hi,

custom heighmaps are supported. Custom biomes.png will be supported very soon (it's already working in the next release). That said, a mask for city generation has been asked many times before, so I will add it eventually. I just need to sort out higher priority things first.

Good luck have fun

 
Hello KingSlayerGM. I wonder is it possible to implement generated caves, like in the glory days? Since the devs refuse to bring them back, maybe modders can give us that option?

 
Hello KingSlayerGM. I wonder is it possible to implement generated caves, like in the glory days? Since the devs refuse to bring them back, maybe modders can give us that option?
Hi, I would love to implement caves, but the game does not allow it. A world is based on heightmap that describes terrain elevation, but it does not support underground holes. That's very unfortunate.

 
some feedback - based on my initial testing this morning

THE TLDR version -
PERMISSIONS ISSUES EXIST IN WINDOWS

GENERATES WORLDS FLAWLESSLY ON LINUX
GENERATES WORLDS FLAWLESSLY ON WINDOWS ONCE PERMISSION ISSUES ARE SORTED OUT

CANNOT GET IT TO COMPLETE GENERATION USING A CUSTOM HEIGHT MAP IN WINDOWS
CAN COMPLETE USING A CUSTOM MAP IN LINUX BUT DOES NOT SEEM TO USE THE CUSTOM HEIGHT MAP AT ALL.

THE FULL TEST (WALL OF TEXT)

Testing the permissions issues

GENERATING RANDOM WORLDS ONLY

WINDOWS 10
I created a directory (owned by my user account) on my dev drive (D:), put KingGen in there, ran it as my logged in user (which also has administrator privs)
Traceback (most recent call last):
<snipped>
PermissionError: [WinError 5] Access is denied: 'user_test_rwg'
 

I then copied the KingGen directory to my users home directory and ran it again from there and it worked just fine - For some clarification my users home directory is NOT on the C drive where windows is stored so perhaps its better for users to copy it to their home directory and just put a shortcut on their desktop for it.

Back on the D:\KingGen directory testing
Once I ran it as Administrator it worked just fine and generated a 10K world within 3 minutes.  
So for some people with permissions issues and do not want to run it from their home directory the simplest solution is to run as administrator but that will only work if their user account is part of the administrator group.

LINUX - UBUNTU 20.04 LTS SERVER (CLI ONLY)
I tested it on one of my linux servers and it worked just fine right out of the gate from the CLI after I put it into my users home directory.

I then sudo copied it to /usr/local/bin.  It runs fine from there and is available to all users and is working exactly as it should by assigning the user ownership of the generated directory and files correctly to the user who runs it.

This well may replace using built in RWG for generating totally random worlds on my servers given how fast it generates worlds and that it follows normal linux conventions.

CUSTOM HEIGHT MAP TESTING 

Initially I just used my Nitrogen prepared height map then I realised you require 16 bit grayscale so adjusted the image to 16 bit integer grayscale and exported it from GIMP using 16BPC GRAY as the pixel format in the PNG export settings.
 

Not big issue but it would be nice if the program checked for a 16 bit depth on loading the png map file and perhaps reported to the user the height map was not correct bit depth and exited gracefully as the simplest solution - that way the user would realise what the problem was.  Consider this as I imagine other people would have prepared their custom nitrogen maps similarly which requires an 8 bit greyscale image.

WINDOWS
Testing KingGen running from user directory and using the custom 10K height map.

When using a custom height map which is stored in another directory on my dev drive (D:\), and which my user account is the owner of the file, I seem to be getting issues with KingGen as it just sits on Generating random pois and after 15 - 20 minutes I stop the generation.  So far I have been completely unable to complete the generation using a custom height map in windows

LINUX
if I use the following command line

KingGen --seed 1234567890 --custom_heightmap /home/myuser/kinggen_testmap.png --cities_size large user_custom_map_test 10

it appears to ignore the custom map entirely.

Same result when I use the following command line

 KingGen  --custom_heightmap /home/myuser/kinggen_testmap.png --cities_size large user_custom_map_test_2 10                 

And yet again the same thing happens when I use this command line
 KingGen  --custom_heightmap=/home/myuser/kinggen_testmap.png --cities_size=large user_custom_map_test_3 10                    

So I am at a TOTAL LOSS as to how to get it to use my custom height map at all.  It does complete and generate a map but it really does not seem to use the height map so is there something I am missing here as far as command line parsing goes???

Also as an aside I have clamped my height map values in gimp prior to export as such that the water areas should be exactly that water areas according to the information given for generation.  I will happily DM you a link to the source height map on my webserver if you like, it's a 10K height map and is approx 5MB in size.

I further tested this by re-scaling my custom map to 4k and it still refuses to complete making a map in WINDOWS and it seems to ignore it in LINUX...  Of course it could well be the png file itself that is the issue or perhaps something I have misunderstood regarding the linux command line...  And yes for the 4K map tests I did change the size parameter to 4

I will happily be educated on how it's supposed to be used with importing custom maps

What IMHO would be an added improvement for the CLI versions would be simply allowing us to specify a config file on the command line with all the options we want the generator to use

It might also make it easier for debugging purposes...

Right now as it stands, from my perspective it's nice and fast for generating totally random worlds but completely useless to me for generating worlds using custom height maps...

 
Last edited by a moderator:
here is the generated KingGenConfig.txt file contents from the 4K custom map test on the linux server

Based on this command line

KingGen  --custom_heightmap /home/myuser/4ktest.png --cities_size large user_custom_map_test_3 4

  _  ___              _____
 | |/ (_)            / ____|
 | ' / _ _ __   __ _| |  __  ___ _ __
 |  < | | '_ \ / _` | | |_ |/ _ \ '_ \
 | . \| | | | | (_| | |__| |  __/ | | |
 |_|\_\_|_| |_|\__, |\_____|\___|_| |_|
                __/ |
               |___/
v0.5.0
7 Days to Die Random World Generator
Find out more at https://community.7daystodie.com/topic/23988-kinggen-a-random-world-generator-for-7-days-to-die/

SETTINGS:
burnt_size=medium
cities_size=large
custom_heightmap=/home/myuser/4ktest.png
desert_size=medium
grid_size=medium
heightmap=None
mountains_size=medium
name=user_custom_map_test_3
pois_list=vanilla
pois_number=medium
seed=9h57Zz1TJH
single_city=False
size=4
skip_preview=False
snow_size=medium
spawn_points=medium
terrain_roughness=medium
towns_size=medium
traders_number=medium
villages_size=medium
waste_size=medium
water_size=medium

 
This tool really makes great looking maps. Thank you.

A request for a couple small things:

1. Ability to create only a single biome, for example a winter world using only snow biome.

2. Either use any POI only once, or once per city/town. 

I use a custom POI list, made from vanilla, compopack, and a few other downloads. It seems to skip some (not using them) and placing multiple copies within close proximity. I would rather it leaves blank/empty spaces. I also get py list errors when I remove certain types of POI - perhaps allow for empty lists. 

 
This tool really makes great looking maps. Thank you.

A request for a couple small things:

1. Ability to create only a single biome, for example a winter world using only snow biome.

2. Either use any POI only once, or once per city/town. 

I use a custom POI list, made from vanilla, compopack, and a few other downloads. It seems to skip some (not using them) and placing multiple copies within close proximity. I would rather it leaves blank/empty spaces. I also get py list errors when I remove certain types of POI - perhaps allow for empty lists. 
Hi, thank you for the feedback. Let me answer your points.

1. It is a great idea. I will add the ability to have a single biome.

2. KingGen tries not to use the same poi multiple times, however sometimes it is forced to choose one it has used before. I can try to improve this, but given the fact that the list of pois is not infinite, at some point pois must be repeated.

3. I can't allow for empty lists. If you don't have a list, just use the vanilla list provided by KingGen

 
Last edited by a moderator:
some feedback - based on my initial testing this morning

THE TLDR version -
PERMISSIONS ISSUES EXIST IN WINDOWS

GENERATES WORLDS FLAWLESSLY ON LINUX
GENERATES WORLDS FLAWLESSLY ON WINDOWS ONCE PERMISSION ISSUES ARE SORTED OUT

CANNOT GET IT TO COMPLETE GENERATION USING A CUSTOM HEIGHT MAP IN WINDOWS
CAN COMPLETE USING A CUSTOM MAP IN LINUX BUT DOES NOT SEEM TO USE THE CUSTOM HEIGHT MAP AT ALL.
Hi, thank you for taking the time and for sharing this long feedback. Have you tried using the GUI at all? Or did you just use CLI?

Testing the permissions issues

GENERATING RANDOM WORLDS ONLY

WINDOWS 10
I created a directory (owned by my user account) on my dev drive (D:), put KingGen in there, ran it as my logged in user (which also has administrator privs)
Traceback (most recent call last):
<snipped>
PermissionError: [WinError 5] Access is denied: 'user_test_rwg'
 

I then copied the KingGen directory to my users home directory and ran it again from there and it worked just fine - For some clarification my users home directory is NOT on the C drive where windows is stored so perhaps its better for users to copy it to their home directory and just put a shortcut on their desktop for it.
I can't do much about permissions. It depends on the machine and on the user. What I can do is to clarify better inside the user guide what works and what doesn't.

Not big issue but it would be nice if the program checked for a 16 bit depth on loading the png map file and perhaps reported to the user the height map was not correct bit depth and exited gracefully as the simplest solution - that way the user would realise what the problem was.  Consider this as I imagine other people would have prepared their custom nitrogen maps similarly which requires an 8 bit greyscale image.
Noted. Thats a good idea.

WINDOWS
Testing KingGen running from user directory and using the custom 10K height map.

When using a custom height map which is stored in another directory on my dev drive (D:\), and which my user account is the owner of the file, I seem to be getting issues with KingGen as it just sits on Generating random pois and after 15 - 20 minutes I stop the generation.  So far I have been completely unable to complete the generation using a custom height map in windows

LINUX
if I use the following command line

KingGen --seed 1234567890 --custom_heightmap /home/myuser/kinggen_testmap.png --cities_size large user_custom_map_test 10

it appears to ignore the custom map entirely.

Same result when I use the following command line

 KingGen  --custom_heightmap /home/myuser/kinggen_testmap.png --cities_size large user_custom_map_test_2 10                 

And yet again the same thing happens when I use this command line
 KingGen  --custom_heightmap=/home/myuser/kinggen_testmap.png --cities_size=large user_custom_map_test_3 10                    

So I am at a TOTAL LOSS as to how to get it to use my custom height map at all.  It does complete and generate a map but it really does not seem to use the height map so is there something I am missing here as far as command line parsing goes???
I think there might be a bug where the custom heightmap is ingored. I will investigate.

What IMHO would be an added improvement for the CLI versions would be simply allowing us to specify a config file on the command line with all the options we want the generator to use
This is a good idea. I will add it.

 
Last edited by a moderator:
Thanks for your response to the feedback, to answer your question on CLI / GUI. On windows I tested the gui only, on my linux server it was CLI only as I do not even have an X server installed on it, so no desktop, all my linux servers are configured to be headless units that I ssh into from my main windows machine, my other server - a windows 10 pro machine I did not test anything on, the main windows machine is a win 10 home edition machine

I hope that helps

 
2. KingGen tries not to use the same poi multiple times, however sometimes it is forced to choose one it has used before. I can try to improve this, but given the fact that the list of pois is not infinite, at some point pois must be repeated.
The issue I have it generates multiple copies within close proximity (<100m same town). I suggest once per city or town.

3. I can't allow for empty lists. If you don't have a list, just use the vanilla list provided by KingGen
Example: I removed all road signs, and street lights. Throws list index errors.

Suggestion:

If (poi_list.count() < 1):

continue

else

...

Hope above is clearer.

 
An update for you regarding linux gui

Ran the same test as I did previously only this time using the linux gui version.
 

The setup - Linux Ubuntu 20.04.2  LTS  desktop environment
Downloaded KingGen, then copied it from my users download folder to my users home folder and after making it executable ran it detached from the terminal using the command
./KingGen &

Then in the GUI on the desktop ran a straight up RNG generation with the seed 1234567890
Changed no other settings

Worked fine - generated the world in 34 seconds

Then went and changed the world name by adding a 2 to the end of it  and went into advanced settings, selected the 4ktest.png file as per the previous test on WNDOWS and told it to generate the world - no other settings were changed and I did notice the seed had been erased and left this blank.

It got to the same point as per the windows gui version - just sitting there on Generating random pois

 
Version 0.6.0 released!

Here is what's new:

  • Smoother villages
  • Smoother roads
  • Optimized preview rendering
  • Custom biomes map support
  • Added single biome option
  • Added no city/town/village option
  • Added configfile support for CLI
  • Faster water generation
  • Reduced executable size
  • Added check for no streetlights/signs
  • Fixed seed not working
  • Fixed spawning random pois forever
 
Really nice. Thanks again for going above and beyond on helping us Win7 users.

With that I just created 2 maps to have a look at the new program and I noticed it showed the first of the 2 and then as soon as the other one finished (quickly I might add) it showed that preview. I never really got a chance to see the first one and there was no way to go back to it.

I was wondering is there a way to tab the map previews so you could go back and forth between them to compare? Not sure how much mem it would use so even if it could show 3 or 4 that might help someone decide which of the maps they would like to use.

Thanks again for keeping this program alive and updated.

 
Really nice. Thanks again for going above and beyond on helping us Win7 users.

With that I just created 2 maps to have a look at the new program and I noticed it showed the first of the 2 and then as soon as the other one finished (quickly I might add) it showed that preview. I never really got a chance to see the first one and there was no way to go back to it.

I was wondering is there a way to tab the map previews so you could go back and forth between them to compare? Not sure how much mem it would use so even if it could show 3 or 4 that might help someone decide which of the maps they would like to use.

Thanks again for keeping this program alive and updated.
Previews are saved inside the world folder. So you can always go there to have a look.

 
Ok @KingSlayerGM I did a very quick test on windows 10 tonight with the new version

Running KingGen in a directory in my home directory

RWG - no seed entered - worked just fine

RWG - seed entered - worked just fine

Custom Height MAP - did not clear the seed...

Map file is on D Drive and users folder is on E Drive

Owner of file is my user account

 

Generating heightmap.
Generating biomes.
Generating cities.
Generating water.
Generating roads.
Generating villages.
Generating random pois.
Saving heightmap.
Generating spawn points.
Generating radiation.
Generating map info.
Generating ttw.
Generating preview.
Traceback (most recent call last):
  File "gui.py", line 925, in generate
  File "ntime.py", line 11, in ntime
  File "world.py", line 818, in run
  File "world.py", line 186, in generate
  File "world.py", line 213, in gen_preview
  File "drawing.py", line 15, in bump
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

It appears to have generated the dtm.raw file but I won't know till later if it actually paid attention to the height map it was given or not when I can check it out in game

Tried the same with the file moved to the users home directory tree - same sub dir that king gen is running  in.  Same result as above.

Will test it on linux desktop and get back to you as well as CLI tests

 
@scallipus Thank you for testing. I really appreciate it :)
 

The error seems to occur when KingGen is rendering the preview. So the dtm.raw has already been created (I am not sure if correclty).

Can you please share the config file and the heightmap file that you used, so that I can reproduce the error and pin point the bug?

 
Last edited by a moderator:
@KingSlayerGM sure I just ran the world in game - and basically it generated the terrain - Of course this was a quick and dirty adjusted height map as a test and nothing like my final maps end up but the overall land mass shape and the various islands are about right as far as their placement went etc.. So yeah it seems to be the preview that is bugging out

the test image is at the following url

4k_KG_test2.png


and config file...

  _  ___              _____
 | |/ (_)            / ____|
 | ' / _ _ __   __ _| |  __  ___ _ __
 |  < | | '_ \ / _` | | |_ |/ _ \ '_ \
 | . \| | | | | (_| | |__| |  __/ | | |
 |_|\_\_|_| |_|\__, |\_____|\___|_| |_|
                __/ |
               |___/
v0.6.0
7 Days to Die Random World Generator
Find out more at https://community.7daystodie.com/topic/23988-kinggen-a-random-world-generator-for-7-days-to-die/

SETTINGS:
burnt_size=medium
cities_size=medium
desert_size=medium
grid_size=medium
heightmap=E:/Users/myuser/KingGen/4k_KG_test2.png
mountains_size=medium
multiple_generations=1
name=KingGenWorld6
pois_list=vanilla
pois_number=medium
seed=1234567890
single_city=false
size=4
skip_preview=false
snow_size=medium
spawn_points=medium
terrain_roughness=medium
towns_size=medium
traders_number=medium
villages_size=medium
waste_size=medium
water_size=medium

 
@scallipus thank you, I found the bug and fixed it. However I will not upload the fix until KingGen7, so it might be a week.

In the meantime I can suggest you to:

1) try a few times with random seeds and eventually your heightmap will work

2) use larger worlds (8K or above) and the error will not happen

Also I noticed that your heightmap goes from very low (2) to very high(255). This is permitted, but it might be undesirable. I would suggest to keep your heightmap between 30 and 230.

Btw this is what a world generated with your image looks like. Pretty cool if you ask me :)

GUr3N0C.jpg


One more thing: biomes.png files are now supported. Maybe that would go along well with your Australia project.

 
Last edited by a moderator:
as mentioned it was a very quick and dirty test map level adjustment from my 10K map artwork.  Yes a bit of tweaking would need to occcur for a playable map, the original artwork was 20K x 20k and done it 8 bit grayscale and the land mass was level balanced for 32 or 34 to 180 or something (what works well for nitrogen as far as most maps go where you end up with your land mass low level set to 1 block above the water level).

As your maps have a higher low point I just raised the levels overall and then scaled it to 4K purely for a test, the actual live map on scallisgaming.com plays very nicely by the way...

I tend to work on real world terrain maps for games as it makes it a lot more interesting IMHO

And yes the map looks bloody awesome in the preview above thanks for looking into it and fixing the bug, I will continue to test a few things during this week - including the cli config file option, how it goes on linux gui and cli, and will also test out the custom biomes option :)

Keep up the great work you are doing its absolutely a breath of fresh air so far and for your efforts I honestly thank you :)

The current live 10K map looks like this on the server

ausmap.png


the screen shot cuts off tasmania but you get the idea based on the sheer volume of POI's

One thing I am wondering - from a programming design standpoint - why did you choose 16 bit grayscale as the basis for the height map image ??
It is because that is what the raw file uses or was it for some other reason?  As the colour space the game plays in is essentially 8 bit I would have thought an 8 bit map basis would be easier to work with - as a minor thing I noted when I viewed the map in game, a result for changing the colour space from 8 bit to 16 bit for me was it essentially required me to double the levels of the artwork (no easy feat when using sliders lol) compared to clamping it between 0 and 255...  the initial map test was mostly under water until I just boosted the levels - I was not really tweaking levels as simply setting a white point at one of the brightest areas and relevelling  the colour space at that.

If for program allowed for 8 bit grayscale levels it would make it a lot easier working in gimp doing level adjustments (at least from my point of view)

 
Last edited by a moderator:
Back
Top