Jump to content

SinglePlayer Map Renderer


DorHans
 Share

Recommended Posts

  • 2 weeks later...

Need to move Codeplex to Github

 

Nice tool I have not used it yet but I like the idea.

 

I just found out last week that Codeplex is shutting down and you only have a certain amount of time to transfer your account repos and content to Github. So I nearly lost some of my valuable source codes not currently on any HDD do to drive failure. It is a automated process once you authorize it on both ends.

 

"CodePlex is shutting down. Read about the shutdown plan, including archive and migration information, on Brian Harry's blog."

 

Hope this helps.

Link to comment
Share on other sites

Well tried to build your app from your source code on Codeplex in VIS 2017. Loading your project tries to connect to Team Foundation Server on Codeplex and fails; due to access not authorized going to the url ask for the tfs codeplex login credentials.

 

tried any way build fails.

----- Build started: Project: 7DTD-SingleMapRenderer, Configuration: Debug Any CPU ------
1>E:\Games\7DaystoDie\utils\Mapping\7dtdsinglemaprenderer-45069\7DTD-SingleMapRenderer\app.config : error MSB3249: Application Configuration file "app.config" is invalid. Could not find file 'E:\Games\7DaystoDie\utils\Mapping\7dtdsinglemaprenderer-45069\7DTD-SingleMapRenderer\app.config'.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

NM I removed app.config and re added dll reference.

 

I am trying to add a feature to show airdrops currently on map; what do I need to add to POI.cs to get that working?

 

Looks like the entry is not supported in the dll.

Edited by sixxkilur (see edit history)
Link to comment
Share on other sites

Sorry for answering this late.

 

You are right, I completely forgot to commit the app.config. But you don't really need it anyway, it is almost empty. And yes, you also need the FunPimps.dll from the binary release.

 

As for the POIs / waypoints:

A POI is just a map marker with a name, symbol and coordinates. All waypoints, you've added to your map, are read from from player profile (.ttp). The POIs are read from a csv file (plain text file with default encoding). These symbols are static and not accessible from ingame.

1000,760,book,store

This line will add a book symbol with the name "store" at 1000 north / 760 east to the rendered map.

 

I assume, that airdrops are saved in the chunk files. So you might end up reading all 7rg files, searching for airdrop blocks, extract their coordinates and create an instance of the POI class for each airdrop. It is possible, but requires some work.

 

 

@Pr00ch: Well, uncovering the map is not that simple. First you would need the game to create all region files. Then you would parse these files for the highest terrain block. Then you would need the material of that block. Then you need the color of that material. Then you need the orientation of the block (a block in a mountain slope has a different color than in a plain). Then you might compute the color of that pixel on your map.

Since we have an ingame preview of the map, I don't really see the need for that.

Link to comment
Share on other sites

  • 2 months later...

Version 1.9

 

Yesterday I released version 1.9 which features a RegionViewer (in the menu under "Experimental"). I don't know if it is useful or not. So tell me if you have an idea.

 

Currently it takes your selected map and renders each region individually. When you select a region from the list, you will see the rendered image and a grid overlay. Each grid cell represents a chunk and has a X and Z value.

 

RegionViewer.jpg.a059f2b8bc0964325239a7acc3aec02f.jpg

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 3 months later...
  • 2 months later...
  • 3 weeks later...
  • 2 weeks later...

Thank you guys for all your feedback! It' always a pleasure to read, even if you find it useless.

 

And thanks, Eihwaz, very nice spotlight. I like how you explain every option and detail. This reminds me of writing a short wiki on github...

Link to comment
Share on other sites

  • 3 weeks later...

Hi guys and gals,

 

what have I been up to lately? I've been trying to render a map from the region files.

 

From what I have observed, and that may be incorrect, the game saves data the following way:

It creates the "hub cell data", which I think is for the distant terrain. These files contain the names of POIs, "asphalt" and some binary data. Maybe the height and/or biome map? The creation takes some time, but I expect that you see this data, when you use "Editing Tools" (Random Gen World Previewer). Each hub seems to represent 9 regions.

The actual blocks are stored in your region files. Each region is 512 x 512 blocks big and reaches from the bedrock to the sky. The region is divided in 32 x 32 = 1024 chunks, each of them being 16 x 16 blocks big.

When you first step into a region, the game creates an empty region file and only generates the chunks around you.

From where I stand, the map gets rendered 4 chunks in each direction. The region files contains additional 4 chunks in each direction. This may be because of my view distance being 9? Beyond that point the chunks aren't created or saved.

 

There is a console command called "visitmap", with that you can force the creation of specific regions and chunks. The command expects two X-Z block coordinate pairs. If you want to create the region 0,0 you have to type "visitmap 0 0 511 511". It than creates and checks all 1024 chunks in that region.

 

Here are some numbers. These are only estimates, as I don't want to spend so much time testing this out.

A random world is about 40 x 40 = 1600 regions big. Each region consists of 1024 chunks, resulting in about 1.6 million chunks. The visitmap command can compute about 22 chunks per second (on my system). Generation of the whole world would take 74,000 seconds or 20 hours. Each region file takes about 8-10 MB, so the whole world would be 12-15 GB.

Rendering the map is a lot faster, and happens at about 1100 chunks per seconds (on my system) -- resulting in about 26 minutes for the whole world. The image would be 20,000 x 20,000 pixels and about 130 MB big.

 

TLDR:

It is possible to render a map from region files, but -- and that's a huge butt ;) -- it takes a tremendous amount of time to create the regions.

Currently it can only render the terrain, no blocks or decorations. Maybe because blocks can be painted, and therefore the map color must be extracted from the texture? And it also renders underwater terrain.

The code is very experimental and far away from production use. So don't expect a release in the near future.

 

Finally something to look at.

The four images on the left are a comparison between the rendered regions and the ingame map. I hope, you can see the limitations mentioned above.

The right image shows what additional information you may get. The magenta overlay marks the chunks saved in the region file, that are not on your ingame map. Nice, but pretty much useless?

 

RegionRendering.jpg.5d466cc9af478d35064d930141138276.jpg

 

Any thoughts on this feature?

Any wishes? Maybe extend your ingame map with information from region files?

You know a faster way to generate the whole world?

Link to comment
Share on other sites

  • 3 months later...
  • 9 months later...
  • 4 weeks later...

Hi, I've just started to host a server for me and a friend, I'm finding this tool very useful but wondered if you would take a few suggestions?

 

I'm running a quick powershell I've wrote to grab all the enteries in prefabs.xml and plot them over the biomes.png which is great to get an idea where stuff is. I got the idea to overly the output from your SingleMapRenderer on top of my biomes.png to give a map of where we have been, what the biome layout is and where the interesting POI's are, which results in something like this:

 

sm_output.thumb.jpg.046a8f48ccb15ccebc5305824246feb4.jpg

 

My request would be, can you add an option under general to produce a full size png which is the whole map area, not just the discovered tiles? i.e. is the randomGen is 4096x4096, the png output is 4096x4096, regardless of the discovered area? This would mean I can just overly the images straight on top of the biomes.png without having to photoshop to align everything.

 

I've looked over your source code and unfortunately my programming skills don't extend to the level needed to figure out how the map reading works :)

Link to comment
Share on other sites

  • 1 month later...

would love for this tool to work in a18's and with the use of Damocles random map generator that way i dont have to load in game when editing maps so i can see if the land is smooth ect when i port height maps from my 3d models

Link to comment
Share on other sites

  • 1 month later...

Happy Holidays!

 

Hey guys,

 

long time no see. The ttp file format is a topic on its own, so I decided to ditch this part and implement a simple text search. With version 1.10 you will have your ingame waypoints, but no spawnpoint (bed symbol), no dropped backpack and no quick marker.

 

@dynamis_dk

I really like the idea to include the biome map and the prefabs. Would like to include this in the next release.

Well, my commenting skills aren't the best. But if you want to know how the map is rendered you just need this file: https://github.com/DorHans/7DTD-SMR/blob/master/7DTD-SingleMapRenderer/src/Core/MapRenderer.cs

The method getAllTilesFromMapFile will read all tiles from the map file and returns a dictionary. The key consists of the x-z-coordinates of this tile (or chunk). The value is a 512 byte array, which is the raw bitmap data.

The method renderTiles extracts the x and z coordinates, creates a bitmap from the raw data and draws this into the map.

If you want to code yourself, you can change the method RenderWholeMap. The variables minX, maxX, minY, maxY, sizeX and sizeY control the size of the resulting image. (E.g. a 4k map would be something like: min=-128, max=127, size=4096)

 

@Lain

I haven't used NitroGEN, so I don't know what files it generates. I assume it doesn't generate a map file. So it would be out of the scope for this tool. Maybe Damocles could add an option to output a height map as well.

 

Enjoy your holidays!

Link to comment
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
 Share

×
×
  • Create New...