Jump to content

Alpha 17b240 Quick Guide to Creating a ‘7 Days To Die’ world from an external image.


Red Eagle LXIX

Recommended Posts

Alpha 17b240 Quick Guide to Creating a ‘7 Days To Die’ world from an external image.

 

The following is a basic guide on how I put together the world BackgroundLife.

A 7 Days To Die game world.

Available for download here:

BackgroundLife - a 7 Days To Die world

 

The purpose of this project was to prove the viability of taking an arbitrary starting image and create a game world.

 

First we need to know where the Worlds folder is located. So let’s get there by using the Steam Client:

Steam Client > Games Library > Right-Click 7 Days To Die > Click Properties > Click Local Files Tab > Click Browse Local Files > Navigate into the Data Folder > Navigate into the Worlds Folder.

This is the location to which one would extract the BackgroundLife.zip to have the world available for edit or play.

 

Before we begin let me list the image editing tools in use for my build here:

Paint Shop Pro 9 – modified for Windows 7 to not disable Aero, and Large Address Awareness (thus allowing more memory usage on 64bit machines)

Photoshop CS6 v13 – used for final edits and save of files, including adding the tags to each file and copyright to the dtm.tga, and Red Eagle LXIX to each PNG. Every TGA and PNG file was last saved in this program.

 

Next we need that 1 starting file. To get that we’re going to start the game and generate a Random World (any size, doesn’t matter 4096 will be fastest).

 

Next let’s take the file we need and copy it. Navigate into the folder for the newly created world. Find main.ttw and copy it (should be 194 bytes and basically empty).

 

Go back to the Worlds folder. Create a new folder to hold your custom world. In this case I am going to create a folder called BackgroundLife.

 

Paste the main.ttw you copied from the Random World into your new world folder.

 

Obviously if we try starting a game on this new world right now it is going to yell at us as there is almost nothing here.

 

Next we need to create a map_info.xml that tells the game the basics about our world:

<?xml version="1.0" encoding="UTF-8"?>
<MapInfo>
   <property name="Name"		value="Background Life"/> <!-- Left over property may not be used anymore -->
   <property name="Scale" value="1" />  <!-- not tested, believe how it maps the images to the world for all but radiation -->
   <property name="HeightMapSize" value="8192,8192" />  <!-- Size of the world.  MUST be Square to use smoothworldall due to math -->
   <property name="Modes" value="Survival,SurvivalSP,SurvivalMP,Creative" />  <!-- Game modes allowed to use the world -->
   <property name="FixedWaterLevel" value="false" />  <!-- should there be a fixed height to generate water - UNTESTED -->
   <property name="RandomGeneratedWorld" value="false" />  <!-- Used by RWG to check if RWG has already made a map that came out to same name -->
   <property name="Description" value="Living life in or on the background is never fun." />  <!-- This may have to be a key to localization text, a left over as even for Navezgane, not used anymore -->
</MapInfo>

 

As we can see here I’ve decided to create an 8192x8192 world.

Next to start we’re going to create some basic files we will fill in more completely later:

prefabs.xml:

<?xml version="1.0" encoding="UTF-8"?>
<prefabs>
</prefabs>

spawnpoints.xml – I assigned an arbitrary value, the game will spawn player on the surface regardless):

<?xml version="1.0" encoding="UTF-8"?>
<spawnpoints>
   <spawnpoint position="0,251,0" rotation="0,0,0"/>
</spawnpoints>

 

water_info.xml:

<WaterSources>
</WaterSources>

 

At this point we should have 5 files:

main.ttw

map_info.xml

prefabs.xml

spawnpoints.xml

water_info.xml

 

 

Now for the fun. We need to pick an image that will be the heightmap for our world. This image will define the hills, the valleys, the mountains, the fields.

In this case I chose one people might recognize:

https://steamcdn-a.akamaihd.net/steam/apps/251570/page_bg_generated_v6b.jpg

page_bg_generated_v6b.jpg

 

After some cleanup, cropping, resizing, convert to greyscale, negative image, enhancement, and smoothing via Average and Median smoothing the image ends up like this JPG (50% scaled) -- EDIT: the important bit here is the greyscale (image must be 0-255, black-white only everything else is a matter of preference in world design):

EB58E4868A043C6E1FCB312F88D0954993B55DE8

 

I saved that as dtm.tga

 

We’re almost ready to load this world but we’re still missing a few bits.

Now for the first of the 2 files that tends to be annoying.

biomes.png

I had originally tried working with ones like those from Navezgane and RWG worlds but kept having issues. Especially when saving from Photoshop.

This worked for me; creating a new biomes.png file the size of my world with no transparency.

 

There are exactly 5 colors that can be used (any other colors can result in either Void or Biome Generation errors):

 

COLOR - Biome

#004000 - Forest

#BA00FF - Burnt Forest

#FFA800 - Wasteland

#FFE477 - Desert

#FFFFFF - Snow

50% scaled biomes image:

DF8EF4AC7AF05631FCC173FF048028B373817437

 

The other annoying file is splat3.png. This is where our roads and gravel paths live.

For this file I had originally tried dealing with copies of RWG worlds or even creating my own file with transparency. Everything worked fine when adding roads or paths. It was when deleting the road or path from the file, the road would be gone and transparent, but still show in the world.

So again, I tried without transparency, black background. This allows working adding and deleting gravel and asphalt.

 

This file uses only 3 colors

COLOR - Effect

#000000 - None

#FF0000 - Asphalt

#00FF00 - Gravel

50% scaled splat3

A8AF39E0AC0D1857975099E0004E4123ACA2DF75

 

Next we need our radiated border so we need a new file called ‘radiation.png’.

This file should be 1/16 of our map size. So for BackgroundLife I’ll be creating a 512x512 radiation.png

Each pixel will either be RED (#FF0000 radiated) or Black (#000000 normal).

Each pixel will represent approximately a 16x16 area of your full size map.

100% radiation

62D574201AC462C8CD46AF61C6BFAD62954B649D

 

At this point we should have 9 files:

main.ttw

map_info.xml

prefabs.xml

spawnpoints.xml

water_info.xml

dtm.tga

radiation.png

biomes.png

splat3.png

 

Do I know if creating new biomes, splat3, and radiation PNG files without transparency was 100% correct way? No. I do know this. Everything worked as I expected when I did this. I got the world I expected and the result expected every time doing it this way.

 

Right now we have no prefabs in our prefabs.xml and no water in the water_info.xml but we are finally at a point we can load our custom world and see how things look in the World Editor.

 

There is currently an issue/bug with the code that SmoothWorldAll assumes a world size of 4096x4096 when using the noregion flag. However we need this to get smooth terrain.

As such I have put together a pack of modified Assembly-CSharp.dll files for different sizes.

The following shows a code compare between Stock 4096 and the Modified 8192:

FF631DA6133A4239B630963A4E96DDE53D63211D

Link to comment
Share on other sites

Exit out of the game and replace the stock Assembly-CSharp.dll with one from the pack here chosen for the size of the world we want to smooth (8192 in this case): https://www.dropbox.com/s/ofenxy18fm8t9cm/swa_smoothworldall_patched_DLL_files.zip

 

Start 7 Days to Die > Select Editing Tools > World Editor > Our New World (“BackgroundLife”) > Start

 

Doing this will create the first version of dtm.raw file for us.

 

At this point we can fly around and determine if we’ve smoothed our image enough to make it ready for smoothworldall command. If it looks like a porcupine then it is not ready. If it looks like the whole world is the surface of golf balls, iffy (might want to smooth more, might not). If it looks like Minecraft with diamond shaped blocks but nice rolling hills, valleys, plains, mountains; then it is ready.

This all boils down to preference on how you want your terrain.

NOTE: at this point your world will be upside down from your starting dtm.tga – Do not worry.

Example:

Before 'smoothworldall' Notice how it is upside down now. Note this area will be in the North after using 'swa'.

6BDF01662F6616427CC07BDEFA94D51D28B43BAD

6D0B36BBC2FD7B1289BAEB18C768D25F417C47F4

0B38527F31C4CD29658B1B75798932954D9BEBED

 

If we’re happy with the flow of the world we can issue the SmoothWorldAll command which will generate smooth terrain data for the world to make it less Minecraft-y.

 

The command is formatted as

swa <NUMPASSES> noregion

smoothworldall <NUMPASSES> noregion

 

This tells the command to run <NUMPASSES> of smoothing, and write the smoothworldadjustment data to the dtm.raw file because we specified no region (instead of writing all the region files like accompany a save game).

The reason we had to replace the DLL was because the default DLL assumes all worlds are 4096x4096 when writing to dtm.raw at this point.

 

In the case of BackgroundLife I issued ‘swa 5 noregion’.

034BC28ACAFEC9C66EC3A8E425A0923801334B87

 

Now we exit out of the game, delete any saves.

 

At this point we will have 11 files:

main.ttw

map_info.xml

prefabs.xml

spawnpoints.xml

water_info.xml

dtm.tga

radiation.png

biomes.png

splat3.png

dtm.raw

heightinfo.dtm

 

You might also notice a new file heightinfo.dtm. This is some of the heightmap and smoothing data that was used during the re-write of dtm.raw. The heightinfo.dtm file is no longer necessary and can be deleted (as you’ll see I did before packaging the world). Technically we no longer need the TGA, but for the purposes of editing, changes, etc, best to keep it and supply it with the world.

 

The world should now have smooth flowing terrain based on the heightmap and the orientation should match the source dtm.TGA file.

After 'smoothworldall' Notice the copyright from the dtm is now correctly oriented. Also note the it used the range 1-251.

23082EF306F3F7BA3FE43AA8F26C005515F84C7A

CF0B7AF1335C170E00DFFE59DD57755994635948

Link to comment
Share on other sites

After 'smoothworldall' Notice the dip is now in the north, and smoothed.2D2E787C0B9D786729AB272D91E8F627A63162B4

After 'smoothworldall' some nice rolling hills.

C9EF66214BF24A477B605DC77D5B121772785861

Long Arm of the Law Canyon

5080E3BB398BBC1288CC210C541652842801DFB1

604CB1A19C1D74F8803C9666C2AF21AC18DD6CD5

 

Now we can paint our roads and biomes as we see fit to match our smoothed world, modify our prefabs.xml and our water_info.xml.

 

Since this was a demo, I cheated and just moved both Perishton and Diersville onto this map, and put a trader between.

For the water I flew around and found a few dips and then updated my water_info.xml accordingly.

Lastly I moved the single spawnpoint I have given this world to a location that allows a more testable start.

 

That’s it, a quick and dirty guide on converting an image to a world.

 

This is how it turned out from an in-game map (50% scaled):

5D2C5542215048DA963C17444D65564319AB9CA2

Link to comment
Share on other sites

Can you elaborate on the water portion?

 

Great explanation so far!

 

Water is actually somewhat easy.

Find a spot where you want water.

Get coordinates in the area you want water, height level you want the water.

 

A good example to play around with would be the 2 water spots I put at:

<Water pos="775, 137, 1423" />

<Water pos="844, 139, 1434" />

 

This one was tricky as I placed the first water spot. Then attempts to place the second one (originally at a height of 140) would fail. Even though the main water did not breach the barrier between these 2 positions, it still tried creating a 64x64 area and joining in an odd way because they were so close. By dropping the level 1 more it gave enough clearance between the 2 spots that effect was stopped.

 

Water needs to obey the following rules for where placed. There must be no block occupying the coordinates for the water at the exact spot set. Further, the height level must be the same as, or higher than the terrain level at the point set.

So unlike a POI where one would go to the lower left of where you want to get the coordinate; water is best near the shore, but in the area you expect water.

Don't set your water too high. I flooded the 7 during one of my water placement attempts.

 

Conveniently the spawn point for this world starts you in view of this set of water placements.

Link to comment
Share on other sites

This is how you can see how many colors are in use in Photoshop (example when checking to make sure you only use the 5 colors for biomes) (the below example has an incorrect 34 colors plus 1 for the transparency = 35 {as can be seen when switching to custom, last one is transparency}:

7PnJBcJ.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Is there a way to "automate" prefabs creation on manually made map, so it uses manually created roads?

 

SWA note: you dont have to use swa, its heavy weight on memory and making 16k map will require more than 20gb ram.

Vram wont work with swa, but rest of "normal" game data usage will,ie. map creation,server/game running, etc.

Since you are already using photoshop, open map.raw with ps as;

1 channel, ibmpc, 16bit img,edit, and save as ibmpc, confirm printer data warn. and viola, allot of saved time ;)

rawopenps.thumb.jpg.53f0042d84a6812238ef096894ae3bc5.jpg

From photoshop you can run gaussian blur, i advise smaller increments like 0.2 and 10.0 as max(using higher increments will flatter map quite a bit and kill most of map "details" like cliffs). Surface blur also does few tricks.

 

Caution:tga still must be used ingame for map import/regen, or you simply need already game made raw and trow desired img over it, otherwise game will highwire the default ps raw, regardless how you export it from ps.

 

Cheers

Link to comment
Share on other sites

Thank you for the tutorial Red Eagle LXIX,

 

but some things dont work or are not clear enough:

- The upside down aspect of the world. Do we have to rotate the TGA file so the world renders like we want to ? And whats about the splat files, do they have to stay as they are ?

 

-imported TGAs result (for me) always in minecraft steps in the world, i tried the command swa *amount* noregion, but it does not solve the steps. Did try that on an 8192 world, i still get steps if i choose a value of 5 or 251 for the swa amount. Which value do you prefer to get rid of the steps ?

 

-Are your DLLs still mandatory now after 17.1 stable is available ? Did not try it with the files you created.

Link to comment
Share on other sites

@Sam_Neill

 

If you want your map turned in specific way, you need your dtm.tga to be upside-down. That means game will also export it in dtm.raw like you set your dtm.tga, so when game loads it will be flipped vertically. Note that both files must be named dtm.

Note also that this "flipping" happens ONLY with dtm file, and not with radiation,biomes and splash3.

 

In order for swa to work, your dtm.tga that was used in map generation must be present in your world folder.

 

Try troubleshooting your command from game logs to see what error happens when u run swa(if any), they should be in your game root .\7DaysToDie_Data folder.

 

If you dont have em i can provide you with batch file for it to be generated at each game start.

 

If logs dont show error, it means that your tga isnt "sharp" or blurred enough and game has nothing to base map flattering on.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I am new to the forum and very interested in generating my own height map and world. I have already created some very cool real world maps this way. Amazing feature. Anybody figured a certain part for the terrain generation of the rwgmixer.xml, which is not used at the moment?

As far as I see it, it is meant to incorporate your own png for terrain generation and then generating biomes and POIs on top. I have tried to make it work. Sadly, no success for me. For the sarek.png you need to create a new folder called "Heightmaps" in the data folder of the game. Hope somebody can help. Thanks.

Reference part of the rwgmixer.xml:

<terrain_generator name="vanilla" base_height="32" water_level="38">

<module name="HM" type="NoiseFromImage">

<property name="metersPerPixel" value="15.14"/>

<property name="imageFile" value="sarek.png"/>

</module>

<module name="BIAS" type="BiasOutput">

<property name="sourceModule" value="HM"/>

<property name="bias" value="-30"/>

</module>

<output module="MasterScaleBias"/>

</terrain_generator>

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...