Jump to content
Damocles

[A19] NITROGEN , a random world generator for 7DtD

Recommended Posts

I'd love for the road generation being cancelled when something is isolated, allowing for islands, dividing rivers, stuff you'll find in the world :)

 

that upside down thing is very confusing ^^ I'll give it another shot :)

 

yep, upside down.

 

now i only have to worry about if editing the roads out of the generated heightmap or completely placing them myself is more effort ^^

Edited by ecv (see edit history)

Share this post


Link to post
Share on other sites

In the very latest uploaded version, roads will not alter terrain on masked areas. You can then just delete that section that crosses the forbidden area in the splat map.

Edited by Damocles (see edit history)

Share this post


Link to post
Share on other sites

Just checked, yeah. nice. This works for me then. Thanks a bunch :)

Share this post


Link to post
Share on other sites

Prefablists for Ravenhearst, Darkness Falls and vanilla

 

Greetings everyone,

 

I spent quite a lot of time the last week testing due to the 'IndexOutOfRangeException: Array index is out of range.' error I encountered before (see old posts) and found this is caused by two POIs, one from Ravenhearst and one from the vanilla list:

 

apartment_adobe_red_5_flr,Downtown;ResidentialNew,2,-10,45,36,37,citycenter;downtown

 

and

 

rh5_rave_factory(by_orak),downtown;industrial,2,1,99,43,112,citycenter;smalltown;downtown;alone .

 

These I had to comment out; the new maps work fine afterwards.

 

The formerly mentioned errors no longer exist with the latest NitroGen version(s) (tested with NitroGen 0.352). This is reflected in the latest prefab lists posted in the GitHub repository (see below).

 

Based on that information, I have corrected my previous Ravenhearst list upload and created a new prefab list, with the list devided into sections for vanilla / MOD information, some refurbishing, typo corrections etc.. You can, e.g., even combine Ravenhearst with the Darkness Falls POIs, and it works, though a 16km x 16km map uses up to 40% CPU performance and ca. 13 GB of RAM this way for me. oO

 

Anyway, to whom it may concern, here are a few pre-configured prefablists; as far as I know, they all work:

 

https://github.com/NickPhaedra/7-Days-to-Die-NitroGen-Prefab-Lists/tree/Prefablists

All in a single zip file as direct link (latest versions):

https://github.com/NickPhaedra/7-Days-to-Die-NitroGen-Prefab-Lists/archive/Prefablists.zip

 

Don't forget to backup your prefab folders and to copy the needed prefabs into the standard 7DTD Data -> Prefabs folder before generating a map (also don't forget to copy the necessary prefab files into the respective MOD's prefab folder, if needed, e.g. when playing Ravenhearst with Darkness Falls POIs):

 

- from the Ravenhearst prefabs folder the abandoned_house_xxnew, the rh5_xx and the xvanilla_xx (if present) files

- from the Darkness Falls prefabs folder the DFalls_xx (if needed), the resource_xx (or only the resource_iron_xx, if needed), the xcostum_xx and the xvanilla_xx files

 

Big thanks again to Damocles and also Xylvier; Xylvier's script was quite helpful to me to cross-check certain data. :smile-new:

Edited by MelT
Former errors no longer exist with the latest NitroGen version(s) (see edit history)

Share this post


Link to post
Share on other sites
^happy to help

 

but be careful with the Zonenames, guess the "INDUS TRIAL" was just a typo, but i don't know what NITROGEN does when it can't sort the Zonename in? Would be interesting to know ... catch or fall through?

 

It's not a typo, it's - for whichever reason - what the forum creates when you copy & paste 'INDUSTRIAL' (as one word) within that line into your post. Had the same in a post of mine before.

Share this post


Link to post
Share on other sites

@Damocles: May i ask how you write the dtm.raw file, as it contains the 2 channels. One is the same as the poiHM but the other one does not look like the genHM. I believe i could get around the raw file by using tga but since you managed to write it out, i would be very thankful if you could tell me or point me towards some deeper information. Thanks.

Share this post


Link to post
Share on other sites

this is basically the code:

the raw hightmap has the value range of a 2-byte short:

The second byte is the same as the original rgb hightmap values, and the first byte the detail values. (little Endian)

Very simple format actually:

 

 

byte[] out = new byte[wide*wide*2]; //map dimensions

 

int i=0;

for(int y=0;y<wide;y++)

{

for(int x=0;x<wide;x++)

{

int valShortRage = getByteTo2ByteOutputRange(floatImage[x][y]); //convert to short range (0 .. 65535) equals (0 .. 255 meters)

 

int a = valShortRage & 0xFF;

int b = valShortRage >>8 & 0xFF;

 

out = (byte)a;

out[i+1] = (byte)b;

i+=2;

 

}

}

 

Internally I use a float-value map to make smoothing the terrain simpler.

Edited by Damocles (see edit history)

Share this post


Link to post
Share on other sites

Has anyone figured out how to add this to a dedicated server yet?

Share this post


Link to post
Share on other sites

Hey, Nitrogen is a nice tool and produces decent results pretty fast, but there are also some weak parts. I would like to know if we will ever see some bridges across the water between two parts of the land? Right now it tends to produce some pretty weird and unrealistic results as it draws roads across the water and the roads are very often below the water level and when you cross the road you are literally surrounded by walls of water. What I would like to see instead are bridges or at least roads that go above the water level instead of under it.

Share this post


Link to post
Share on other sites
Hey, Nitrogen is a nice tool and produces decent results pretty fast, but there are also some weak parts. I would like to know if we will ever see some bridges across the water between two parts of the land? Right now it tends to produce some pretty weird and unrealistic results as it draws roads across the water and the roads are very often below the water level and when you cross the road you are literally surrounded by walls of water. What I would like to see instead are bridges or at least roads that go above the water level instead of under it.

 

Did you try the very newest version? v0.25

It should create a ramp through the large water area where the road goes (unless you edited it manually)

Water should not be cut then.

 

Small lakes are avoided also.

 

Bridges are not implemented yet, its a bit tricky to make them work properly.

Edited by Damocles (see edit history)

Share this post


Link to post
Share on other sites
Did you try the very newest version? v0.25

It should create a ramp through the large water area where the road goes (unless you edited it manually)

Water should not be cut then.

 

Small lakes are avoided also.

 

Bridges are not implemented yet, its a bit tricky to make them work properly.

 

Interesting. I have version 0.251 alpha. Is this the one you were talking about? I created one map yesterday and it had similar result in this aspect like version 0.241 that I tried before. What kind of ramps we are talking about? Could you give me a screenshot? I would like to see one, so that I know what I should be looking for in the final result.

Share this post


Link to post
Share on other sites
Interesting. I have version 0.251 alpha. Is this the one you were talking about? I created one map yesterday and it had similar result in this aspect like version 0.241 that I tried before. What kind of ramps we are talking about? Could you give me a screenshot? I would like to see one, so that I know what I should be looking for in the final result.

 

Here a quickly drawn custom map with lots of islands, which forces roads to cross the water:

 

roadramp.jpg

 

They will then generate a ramp over the main water level.

 

Maybe you try to download the very recent version. I did add those ramps to 0.251 in a second upload quickly after the first upload. (so technically the versioning is not correct here)

Edited by Damocles (see edit history)

Share this post


Link to post
Share on other sites
Here a quickly drawn custom map with lots of islands, which forces roads to cross the water:

 

roadramp.jpg

 

They will then generate a ramp over the main water level.

 

Maybe you try to download the very recent version. I did add those ramps to 0.251 in a second upload quickly after the first upload. (so technically the versioning is not correct here)

 

Oh, this is what is generated, but the road is not always above the water, sometimes it goes below the water level and creates those walls of water on the sides of the road. Even that wouldn't be bad if the water itself filled that space above the road which would simulate a sunken road. If you're absolutely sure that these roads should always be above the water level, I will try to download the latest version then.

 

EDIT: It looks like I already had the last version available.

Edited by mr.devolver (see edit history)

Share this post


Link to post
Share on other sites

There are also water bugs occurring due to the water not spreading correctly (mostly at shallow shorelines). But that more a fault of the 7dtd water-flooding calculations.

 

Water is still very fragile currently in 7DtD...

 

If there are more water bugs, I could make those ramps even wider...

Edited by Damocles (see edit history)

Share this post


Link to post
Share on other sites
Has anyone figured out how to add this to a dedicated server yet?

 

It is surprisingly easy to get this to work.

 

1) I recommend you specify the save game folder for your server, this is what I put in serverconfig.xml:

 

<property name="SaveGameFolder" value="/home1/sd/saved_games" />

 

Create the directory, and under it create the directory GeneratedWorlds. If your server root is /home1/sd like mine is, you should have:

 

/home1/sd/saved_games/GeneratedWorlds

 

2) Make these changes to your serverconfig.xml, these are what I use but you can use whatever you want. In this case my server name is "Vomiting Spleens", and the game world and seed is NitroGenMap_4096_flat_snow. I'm not sure what would happen if GameWorld and WorldGenSeed were different, I didn't try to find out as I was a bit short on time. I kept them the same and it worked great.

 

<property name="ServerName" value="Vomiting Spleens"/>

<property name="ServerDescription" value="Vomiting Spleens"/>

<property name="GameWorld" value="NitroGenMap_4096_flat_snow"/>

<property name="WorldGenSeed" value="NitroGenMap_4096_flat_snow"/>

<property name="WorldGenSize" value="4096"/>

<property name="GameName" value="Vomiting Spleens"/>

 

3) Use NitroGen to generate your world, give it the same name you use for GameWorld above. I used NitroGenMap_4096_flat_snow because it was a 4K flat snow world.

 

4) Copy the directory NitroGenMap_4096_flat_snow from the NitroGen output directory to the GeneratedWorlds directory. You should have:

 

/home1/sd/saved_games/GeneratedWorlds/NitroGenMap_4096_flat_snow

 

5) Cross your fingers, pray to the diety of your choice, and start the server. It will take this template and generate the world:

 

/home1/sd/saved_games/NitroGenMap_4096_flat_snow

 

When the server finishes generating the world, join the server and enjoy!

 

This works for me, YMMV. The above creates a 4096 world, I kept it small for testing. After I saw that it worked, I then created a 16K world, which likewise worked great.

 

Try it and let us know what happens.

Share this post


Link to post
Share on other sites
It is surprisingly easy to get this to work.

 

1) I recommend you specify the save game folder for your server, this is what I put in serverconfig.xml:

 

<property name="SaveGameFolder" value="/home1/sd/saved_games" />

 

Create the directory, and under it create the directory GeneratedWorlds. If your server root is /home1/sd like mine is, you should have:

 

/home1/sd/saved_games/GeneratedWorlds

 

2) Make these changes to your serverconfig.xml, these are what I use but you can use whatever you want. In this case my server name is "Vomiting Spleens", and the game world and seed is NitroGenMap_4096_flat_snow. I'm not sure what would happen if GameWorld and WorldGenSeed were different, I didn't try to find out as I was a bit short on time. I kept them the same and it worked great.

 

<property name="ServerName" value="Vomiting Spleens"/>

<property name="ServerDescription" value="Vomiting Spleens"/>

<property name="GameWorld" value="NitroGenMap_4096_flat_snow"/>

<property name="WorldGenSeed" value="NitroGenMap_4096_flat_snow"/>

<property name="WorldGenSize" value="4096"/>

<property name="GameName" value="Vomiting Spleens"/>

 

3) Use NitroGen to generate your world, give it the same name you use for GameWorld above. I used NitroGenMap_4096_flat_snow because it was a 4K flat snow world.

 

4) Copy the directory NitroGenMap_4096_flat_snow from the NitroGen output directory to the GeneratedWorlds directory. You should have:

 

/home1/sd/saved_games/GeneratedWorlds/NitroGenMap_4096_flat_snow

 

5) Cross your fingers, pray to the diety of your choice, and start the server. It will take this template and generate the world:

 

/home1/sd/saved_games/NitroGenMap_4096_flat_snow

 

When the server finishes generating the world, join the server and enjoy!

 

This works for me, YMMV. The above creates a 4096 world, I kept it small for testing. After I saw that it worked, I then created a 16K world, which likewise worked great.

 

Try it and let us know what happens.

 

I have not tried out setting up a dedicated server, if you tutorial works, I can add it to the starter post.

Share this post


Link to post
Share on other sites
I have not tried out setting up a dedicated server, if you tutorial works, I can add it to the starter post.

 

It might need a bit of tuning and tweaking. I'm currently loading a 16K map, but the initial load takes a while so it's not done yet. I'm also generating a 20K world on another machine ... which just finished at 86 minutes 37 seconds! Now to see if I can get it to run on a server without running out of memory....

 

I'll update everything later today, and if you like it then feel free to reference it from the starter post. Getting this to work on a dedicated server was not difficult, but there are a few things that have to be exactly right or it won't work. Plus I need to make sure there are no seed name conflicts because those can cause extreme geography problems.

Share this post


Link to post
Share on other sites

Added your post to the main post...

 

20 k is pretty ambitious (lots of RAM needed to generate)

Share this post


Link to post
Share on other sites

Slightly different for me, i'm using alloc's scripts to install my server

 

I upload the NITROgenerated worlds folder to the /engine/Data/Worlds/ folder of the server

 

I then adjust the serverconfig file for the instance as follows:

 

GameWorld = the name of the folder you have just uploaded

WorldGenSize = the world size you chose when generating the map with NitroGen

 

I save the file and start the server and look for errors in the log file ^^

 

btw, if you get your players to save that same folder to their local install, they don't have to download the map when joining the dedi. You could put it on a dropbox or something for your players to pre-load, that will cut down log in time immensely on first login ^^

Share this post


Link to post
Share on other sites
Slightly different for me, i'm using alloc's scripts to install my server

 

I upload the NITROgenerated worlds folder to the /engine/Data/Worlds/ folder of the server

 

I then adjust the serverconfig file for the instance as follows:

 

GameWorld = the name of the folder you have just uploaded

WorldGenSize = the world size you chose when generating the map with NitroGen

 

I save the file and start the server and look for errors in the log file ^^

 

btw, if you get your players to save that same folder to their local install, they don't have to download the map when joining the dedi. You could put it on a dropbox or something for your players to pre-load, that will cut down log in time immensely on first login ^^

 

Check your save games directory for your server and make sure it actually used your Nitro generated world. I've found that sometimes it won't use it, won't complain, but will happily generate something else instead, like Vimeno County or whatever. Took me a while to figure out why my worlds were not right. It was ignoring my Nitro generated world and creating its own instead.

Share this post


Link to post
Share on other sites

So I don't really have much to add to my initial post. A 16K map generates based on the instructions I wrote, and loads fine. Players can join IF they have enough memory in their computer, and performance seems to be excellent.

 

Here are some of my observances:

 

A 16K world generates in NitroGen in 38 minutes.

A 20K world generates in 48 minutes.

 

I gave NigroGen 16GB, and it only used 10.5GB to generate the 20K world. Memory does not seem to be an issue.

 

Server memory consumption 16K world with one player in game: 14GB

Client initial join time: 45 minutes.

Client memory consumption server: 17GB

 

This, btw, is why many people have trouble playing a 16K map. The client uses more than 16GB, so if your machine has 16GB or less, like many do, you will hit the swap file and probably crash.

 

With a 16K map, the server runs well with minimal cpu consumption. Likewise the client. Performance was excellent.

 

Sadly, the 20K map would generate in Nitrogen, but the server would not load it. I get:

 

Texture has out of range width / height

 

2019-05-03T14:32:43 60.504 INF Biomes image size w= 8, h = 8

2019-05-03T14:32:43 60.605 WRN Biome image contains unknown biome color RGBA(255, 0, 0, 255) at 3/3

2019-05-03T14:32:43 60.605 WRN Biome image contains unknown biome color RGBA(255, 0, 0, 255) at 4/4

2019-05-03T14:32:43 60.605 WRN Biome image contains unknown biome color RGBA(255, 0, 0, 255) at 3/3

2019-05-03T14:32:43 60.605 WRN Biome image contains unknown biome color RGBA(255, 0, 0, 255) at 4/4

...

IndexOutOfRangeException: Array index is out of range.

at WorldDecoratorPOIFromImage+<InitData>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0

at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0

 

At this point server initialization stops. The server does not finish initializing and therefore no players can join. This map is dead.

 

I changed serverconfig.xml to RWG to see if I could generate a 20 K map from the server itself, and I get:

 

Texture has out of range width / height

 

UnityException: Failed to create texture because of invalid parameters.

at UnityEngine.Texture2D.Internal_Create (UnityEngine.Texture2D mono, Int32 w, Int32 h, GraphicsFormat format, TextureCreationFlags flags, IntPtr nativeTex) [0x00000] in <filename unknown>:0

at UnityEngine.Texture2D..ctor (Int32 width, Int32 height, TextureFormat textureFormat, Boolean mipChain, Boolean linear, IntPtr nativeTex) [0x00000] in <filename unknown>:0

at UnityEngine.Texture2D..ctor (Int32 width, Int32 height, TextureFormat textureFormat, Boolean mipChain) [0x00000] in <filename unknown>:0

at WorldGenerationEngine.GenerationRules..ctor (System.String _worldSeed, Int32 _worldSize) [0x00000] in <filename unknown>:0

at WorldGenerationEngine.GenerationManager.Generate (System.String _worldSeedString, Int32 _worldSize, System.String _ruleset, Boolean _autoExport, Boolean _useProgressShadow) [0x00000] in <filename unknown>:0

at MainMenuMono+<startGeneration>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0

at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0

 

And once again it stops.

 

I think 20K maps exceeds the capability of 7D2D at this time. I may play with this some more when I have time, but I'm not very optimistic of getting a 20K server to run. I have plenty of memory, and at no time does it all get consumed. The server itself just doesn't seem to be able to handle it.

 

- - - Updated - - -

 

PS. I suspect memory consumption for both server and client is dependent on the actual world contents as well as size. I have a computer with 16GB and I was never able to get it to join any of my 16K worlds and run well. I bumped it up to 24GB, and now it joins and plays on these world just fine.

Share this post


Link to post
Share on other sites
It is surprisingly easy to get this to work.

 

1) I recommend you specify the save game folder for your server, this is what I put in serverconfig.xml:

 

<property name="SaveGameFolder" value="/home1/sd/saved_games" />

 

Create the directory, and under it create the directory GeneratedWorlds. If your server root is /home1/sd like mine is, you should have:

 

/home1/sd/saved_games/GeneratedWorlds

 

2) Make these changes to your serverconfig.xml, these are what I use but you can use whatever you want. In this case my server name is "Vomiting Spleens", and the game world and seed is NitroGenMap_4096_flat_snow. I'm not sure what would happen if GameWorld and WorldGenSeed were different, I didn't try to find out as I was a bit short on time. I kept them the same and it worked great.

 

<property name="ServerName" value="Vomiting Spleens"/>

<property name="ServerDescription" value="Vomiting Spleens"/>

<property name="GameWorld" value="NitroGenMap_4096_flat_snow"/>

<property name="WorldGenSeed" value="NitroGenMap_4096_flat_snow"/>

<property name="WorldGenSize" value="4096"/>

<property name="GameName" value="Vomiting Spleens"/>

 

3) Use NitroGen to generate your world, give it the same name you use for GameWorld above. I used NitroGenMap_4096_flat_snow because it was a 4K flat snow world.

 

4) Copy the directory NitroGenMap_4096_flat_snow from the NitroGen output directory to the GeneratedWorlds directory. You should have:

 

/home1/sd/saved_games/GeneratedWorlds/NitroGenMap_4096_flat_snow

 

5) Cross your fingers, pray to the diety of your choice, and start the server. It will take this template and generate the world:

 

/home1/sd/saved_games/NitroGenMap_4096_flat_snow

 

When the server finishes generating the world, join the server and enjoy!

 

This works for me, YMMV. The above creates a 4096 world, I kept it small for testing. After I saw that it worked, I then created a 16K world, which likewise worked great.

 

Try it and let us know what happens.

 

Thanks. I already had my game save folder set to a different folder that I find easier to find so I will try this out.

Fingers crossed.

Share this post


Link to post
Share on other sites

Hmm, would it be possible to have the custom files in another directory? Like the target one for example. It feels weird to change the file in the main resources directory and having to overwrite it each time i try a new world. It#s harder to organize too.

 

Could we have the option to place them in the target directory already? or specify the path in the UI?

Share this post


Link to post
Share on other sites
Hmm, would it be possible to have the custom files in another directory? Like the target one for example. It feels weird to change the file in the main resources directory and having to overwrite it each time i try a new world. It#s harder to organize too.

 

Could we have the option to place them in the target directory already? or specify the path in the UI?

 

I think I can do that. The main reason why the import map is loaded from the resource dir was that a novel user can try it out immediately without having to set up a directory.

 

I can also make it load the import map from the target output folder. (you need to make the directory with the correct name then manually)

Share this post


Link to post
Share on other sites

Small update:

 

v 0.252

- can select to import HM and mask from output directory (you need to manually copy it there)

 

- "unique" marker, to restrict POIs to spawn only once (for custom scenario prefablists), just add it to the zone list like

 

mp_waste_sewer_hole_1,COMMERCIAL,2,-10,33,32,31,houses;unique

 

be careful to have at least one non-unique POI of each zone type, else the generator can run into a deadlock

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...