Mapgen Explorer

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).

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 (with the running instructions).

And here is the pre-compiled 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.

12 Likes

This looks great! I think it might actually help me prototype buildings quicker.:+1:

1 Like

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!

1 Like

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

1 Like

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.

1 Like

What I have found so far:

  • ISO tilesets aren’t working (e.g. HitButton_iso);
  • tile rotation and connection is not working;

  • palette support seems to be broken;

  • 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).

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

Overmap terrains consist of several layers:

  • terrain;
  • furniture;
  • traps;
  • fields;
  • etc.

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

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?

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

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, the release, the changelog and some screenshots:

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,

Thanks for your dedicated work.

Thanks! I’ve created Removed extra curly brace in HitButton_iso json by ZhilkinSerg · Pull Request #23625 · CleverRaven/Cataclysm-DDA · GitHub to fix it.

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

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

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

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

Blockhead

HitButton_iso

Blockhead with some tiles from HitButton_iso

RetroDaysTileset10

Blockhead with some tiles from RetroDaysTileset10

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

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

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

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 :slight_smile:

As it should, here is the git, the release, and the 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, 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 } :slight_smile:

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, :slight_smile:

You should look for terrain colors in terrain definitions jsons, e.g. 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. Mods can add more terrain and furniture definitions.

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. 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.

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), then valid rows nods inside of object node will have 24X rows with 24Y characters wide each.

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