# Mapgen Explorer

**URL:** <https://discourse.cataclysmdda.org/t/mapgen-explorer/15347>\
**Category:** The Lab\
**Created:** [April 26, 2018, 9:36pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347 "2018-04-26T21:36:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![achoum](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/achoum/32/320_2.png) [@achoum](https://discourse.cataclysmdda.org/u/achoum)\
**Post date:** [April 26, 2018, 9:36pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/1 "2018-04-26T21:36:20Z")

</div>

Hi. I am long time fan of Cdda, among other things I find the world generator to be fascinating, and for a couple of days, I have been prototyping with a way to quickly explore and visualize the _prefabs_ (i.e. the building templates for used by the world generator–there might be a better name).

 ![Imgur](https://sea2.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/1/17533507f6bc75f673290ad6a407ecb3612d3796.png)

Since I am sure I am not the only one that would enjoy seeing these prefabs :), I am releasing the source code of the explorer:

Here is the [Github](https://github.com/achoum/cataclysm_dda_prefab_explorer) (with the running instructions).

And here is the [pre-compiled releases](https://github.com/achoum/cataclysm_dda_prefab_explorer/releases).

I hope you will enjoy it. And if you find bugs, ping me.

Cheers,

Ps: It works with Java i.e. it works on Window, Linux and MacOS.

---

<div class="post-metadata">

**Author:** ![Narroe](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/narroe/32/2081_2.png) [@Narroe](https://discourse.cataclysmdda.org/u/Narroe)\
**Post date:** [April 26, 2018, 10:22pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/2 "2018-04-26T22:22:11Z")

</div>

This looks great! I think it might actually help me prototype buildings quicker.👍

---

<div class="post-metadata">

**Author:** ![budg3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/budg3/32/2138_2.png) [@budg3](https://discourse.cataclysmdda.org/u/budg3)\
**Post date:** [April 26, 2018, 10:30pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/3 "2018-04-26T22:30:47Z")

</div>

It would be cool to see this expanded into an editor since all the old editors are outdated. Creating new mapgen stuff with a text editor is really cumbersome. Nice program nevertheless!

---

<div class="post-metadata">

**Author:** ![STK](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@STK](https://discourse.cataclysmdda.org/u/STK)\
**Post date:** [April 27, 2018, 8:38am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/4 "2018-04-27T08:38:42Z")

</div>

+1 for an editor as well.  
But this looks amazeing thank you 🙂

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 27, 2018, 8:56am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/5 "2018-04-27T08:56:29Z")

</div>

That looks pretty good!

What you call `prefab` is actually called `overmap_terrain`. Several `overmap_terrain` can be combined into `overmap_special`. Maybe it is better to call a tool `Mapgen Explorer`, `Overmap Terrain Explorer` or something like that.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 27, 2018, 9:11am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/6 "2018-04-27T09:11:08Z")

</div>

What I have found so far:

- ISO tilesets aren’t working (e.g. HitButton\_iso);
- tile rotation and connection is not working;

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/5/56420c4afbed3c7c0197f9fe784b50d8dee1c339.png)

- palette support seems to be broken;

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/4/45e6b31eeee830048de787ea5e3073a8ed8a066b.png)

- no text find/search menu in tree;

- no zoom with mouse wheel in preview window (zoom is changed only by changing window size);

- no dragging with mouse in preview window;

- red text labels are hard to see (maybe that should be labels on some background with border).

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/0/06e4a5b016c5d574b2d3c8709b5eab8b4b1e8491.png)

- overmap special aren’t supported yet, but when overmap terrains are in the same file that looks great:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/5/5c2858b9080468db8a688120ade60881c5e2964e.png)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/d/dd39051024f80cdb1557d0819fe06ec279d55387.png)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/5/594db51e1ed5aff7229b5f0086bb208174e418dc.png)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/5/58a5b09f6846f54b92e71a201b407a259e221730.png)

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 27, 2018, 9:13am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/7 "2018-04-27T09:13:46Z")

</div>

Overmap terrains consist of several layers:

- terrain;
- furniture;
- traps;
- fields;
- etc.

I suggest adding overlays and buttons/key commands to show/hide these layers.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 27, 2018, 9:24am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/8 "2018-04-27T09:24:34Z")

</div>

Adding optional third window to view and edit json data of selected file with save and reload button will turn this to viewer to simple, but still powerful editor.

Also could you please add support of pseudo-terminal non-tileset rendering with colored fonts?

---

<div class="post-metadata">

**Author:** ![achoum](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/achoum/32/320_2.png) [@achoum](https://discourse.cataclysmdda.org/u/achoum)\
**Post date:** [April 27, 2018, 5:53pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/9 "2018-04-27T17:53:04Z")

</div>

Thanks for the inputs ! 🙂  
And let me prototype with these ideas.

---

<div class="post-metadata">

**Author:** ![achoum](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/achoum/32/320_2.png) [@achoum](https://discourse.cataclysmdda.org/u/achoum)\
**Post date:** [April 28, 2018, 10:00pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/10 "2018-04-28T22:00:20Z")

</div>

Here is the version 0.2 that implements (some) of your inputs :). What is not in this version will be in the next one.

As it should, here is the [git](https://github.com/achoum/cataclysm_dda_mapgen_explorer), the [release](https://github.com/achoum/cataclysm_dda_mapgen_explorer/releases), the [changelog](https://github.com/achoum/cataclysm_dda_mapgen_explorer/blob/master/CHANGELOG) and some screenshots:

 ![Imgur](https://sea2.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/b/b5298f9fe263557297e07b186fb491fc4fbbe4f6.png)

 ![Imgur](https://sea2.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/2/291ab0f5e9144e4c7e2e4a30aa6ade494e9e2dc5.png)

 ![Imgur](https://sea2.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/8/8122ae8971d0a05ade7e02ec8a003c62db89429a.png)

I hope this makes the mappers’ life easier, and the cdda work even richer.

While making this release, I came to two of remarks / questions / brainstorming content:

- I think there is an extra non matching } at the end of gfx/HitButton\_iso/tile\_config.json (at least of my json parser).

- In “gfx/ChestHole32Tileset\_iso/tile\_config.json”, the tile entry around line 129 is missing an “id”. I wonder if that is expected.

- Zhilkin, can you point me to the best way to determine the color of the fonts for the pseudo-terminal non-tileset rendering?

Cheers,

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 29, 2018, 6:21am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/11 "2018-04-29T06:21:36Z")

</div>

Thanks for your dedicated work.

> [@achoum](#):
>
> I think there is an extra non matching } at the end of gfx/HitButton\_iso/tile\_config.json (at least of my json parser).

Thanks! I’ve created [Removed extra curly brace in HitButton\_iso json by ZhilkinSerg · Pull Request #23625 · CleverRaven/Cataclysm-DDA · GitHub](https://github.com/CleverRaven/Cataclysm-DDA/pull/23625) to fix it.

> [@achoum](#):
>
> In “gfx/ChestHole32Tileset\_iso/tile\_config.json”, the tile entry around line 129 is missing an “id”. I wonder if that is expected.

@Chezzo, will you bother with updating ISO tileset after normal one is done?

> [@achoum](#):
>
> Zhilkin, can you point me to the best way to determine the color of the fonts for the pseudo-terminal non-tileset rendering?

You can take RGB values from here - [https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/raw/colors.json](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/raw/colors.json)

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 29, 2018, 6:45am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/12 "2018-04-29T06:45:24Z")

</div>

A couple of things to fix in `0.2`:

- Application closes after that error, though it would be better to fallback to some working tileset.

![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/b/bc701c0989cc69d6b55da2771cd55d4ba10fc9e7.png)

- Some tiles are starting to be displayed in previously selected tilesets if you switch between tilesets:

# Blockhead

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/4/4468e03e850a8fc85bcdb689d0ac00b0bb0f0092.png)

# HitButton\_iso

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/c/c12efeaa4757e76387acd6258898b02c20b9f834.png)

# Blockhead with some tiles from HitButton\_iso

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/9/9f29f8bbdf735a16fb8dce69d54d8d146ba1c2f4.png)

# RetroDaysTileset10

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/0/0422b054aaa2873821d1d6abe321cfdefd90341b.png)

# Blockhead with some tiles from RetroDaysTileset10

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/a/ad5f0cb7557df1d5306dadb458ad6178d5a75f19.png)

---

<div class="post-metadata">

**Author:** ![ChunkOfMeat](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/chunkofmeat/32/11049_2.png) [@ChunkOfMeat](https://discourse.cataclysmdda.org/u/ChunkOfMeat)\
**Post date:** [April 29, 2018, 7:04am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/13 "2018-04-29T07:04:04Z")

</div>

D:\HP\My Games\cataclysmdda-0.C\gfx\RetroDaysTileset20 really do not have retrodaystiles20.png and retrodaysfallback20.png

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 29, 2018, 7:26am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/14 "2018-04-29T07:26:22Z")

</div>

It is just a 2x scaled version of 10 pixel tileset.

---

<div class="post-metadata">

**Author:** ![ChunkOfMeat](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/chunkofmeat/32/11049_2.png) [@ChunkOfMeat](https://discourse.cataclysmdda.org/u/ChunkOfMeat)\
**Post date:** [April 29, 2018, 7:43am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/15 "2018-04-29T07:43:28Z")

</div>

Wrong parsing when “terrain”: is at end of file.

 ![BS](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/4/4220f790fe48011948464c0dd12404bff7bdacfc.png)

---

<div class="post-metadata">

**Author:** ![achoum](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/achoum/32/320_2.png) [@achoum](https://discourse.cataclysmdda.org/u/achoum)\
**Post date:** [April 29, 2018, 9:13pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/16 "2018-04-29T21:13:09Z")

</div>

Here is the version 0.3 that solves the unwanted merging of tilesets and a couple of other improvements on the renderding. It is not yet as good as the game (wrong rotation, does not handle multiple png tileset, etc.) but it is getting there 🙂

 ![Image](https://sea2.discourse-cdn.com/flex016/uploads/cataclysmdda/original/2X/0/06a235d6c0a243e7857d8366919c4d7ce470bccb.png)

As it should, here is the [git](https://github.com/achoum/cataclysm_dda_mapgen_explorer), the [release](https://github.com/achoum/cataclysm_dda_mapgen_explorer/releases), and the [changelog](https://github.com/achoum/cataclysm_dda_mapgen_explorer/blob/master/CHANGELOG).

I created a function to check the validity of all the files in the repo (e.g. check for undefined symbol, out-of-bound coordinates, unexpected entries [misspelled], etc.). I am using it as a test, but I assume it can also be used a quick test when changing mapgens.

Here is the report on a clone of the cdda repo I just did. You can re-generate it by clicking on “analysis/Scan for Potential Errors”.

In the [report](http://blog.mathieu.guillame-bert.com/sharing/mapgen_explorer_analysis.html), I see some undefined characters i.e. character than don’t match any palette. I wonder if there are reserved character (e.g. \< \> and for the stairs, z for the zombies) or if those are unexpected. There is also some mapgens with inconsistent row sizes. Here again, one of the character might be some kind of modifier.

Zhilkin. About the color of the character for the terminal mode. Thanks for the link. But how do you match a character (or a symbol) to a color string i.e. “p -\> t\_pavement -\> BLUE”?

Also, thanks for the quick fix about the } 🙂

I have some question about the “chance” field. In some of the code and the documentation, the acceptance probability seems to be “rndUniform(0,chance)==0” i.e. 1-in-”chance”. In some other places, there is some reference that the acceptance probability is chance/100 i.e. chance is a probability expressed in percentage. I made some test with both version, and there is always some situation that seem off (either too much of too little generated items).

By any chance, anyone know about it? There might also be special cases like it seems to be the case with monsters and distance to cities.

In the next release, I’ll work on making the editor more usable (undo, find, not messing up the json formating, etc.) and I’ll add support for the “overmap specials”.

Cheers, 🙂

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 29, 2018, 10:31pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/17 "2018-04-29T22:31:37Z")

</div>

You should look for terrain colors in terrain definitions jsons, e.g. [https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/json/terrain.json](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/json/terrain.json). And there is similar file for furniture - [https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/json/furniture.json](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/json/furniture.json). Mods can add more terrain and furniture definitions.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 29, 2018, 10:37pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/18 "2018-04-29T22:37:55Z")

</div>

There are no default mapgen palettes, so these unmatched characters are most probably errors. It is great we have this kind of check now.

For example, `Q` in `data/json/mapgen/ags_station.json` was `"Q": "t_pavement",` but this definition was deleted in [https://github.com/CleverRaven/Cataclysm-DDA/commit/0eebba300bfdaef15c53db88926a09f67d01ef74#diff-fdfd42264316ecba09736063dfa8b293](https://github.com/CleverRaven/Cataclysm-DDA/commit/0eebba300bfdaef15c53db88926a09f67d01ef74#diff-fdfd42264316ecba09736063dfa8b293). There is also `{ "ter": "t_gas_tank", "x": 3, "y": 5 }` command iniside of `place_terrain` which places mentioned terrain where the `Q` is, so it should really be like `"Q": "t_gas_tank".` and the `place_terrain` could be empty.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [April 29, 2018, 11:00pm UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/19 "2018-04-29T23:00:29Z")

</div>

Overmap terrains have size of 24x24 characters.

If `om_terrain` node contains a single value.valid `rows` node inside of `object` node will have exactly 24 rows 24 characters wide each, but if `om_terrain` contains X rows of Y values (e.g. [https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/json/mapgen/prison\_1.json](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/json/mapgen/prison_1.json)), then valid `rows` nods inside of `object` node will have 24_X rows with 24_Y characters wide each.

---

<div class="post-metadata">

**Author:** ![Valiant](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/valiant/32/4788_2.png) [@Valiant](https://discourse.cataclysmdda.org/u/Valiant)\
**Post date:** [April 30, 2018, 5:32am UTC](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347/20 "2018-04-30T05:32:59Z")

</div>

Cool! Very useful for devs, modders and the like.

[Next page](https://discourse.cataclysmdda.org/t/mapgen-explorer/15347.md?page=2)
