Skip to content

germanoeich/CoreKeeperTilesetGenerator

Repository files navigation

Core Keeper Tileset Generator

Sublime's custom image

Generate Core Keeper-ready tiles from compact source tilesets. This editor tool can expand 17-tile blob sets, such as ground and wall tiles, into the larger runtime layouts Core Keeper expects, then output either a generated texture or a populated ModTileset layer.

It also supports non-blob layer templates and an arrange-only mode for placing selected source tiles into the Core Keeper layout without generating new variants.

Install

Install the package through Unity Package Manager:

  1. Open Window > Package Manager.
  2. Click +.
  3. Select Install package from git URL....
  4. Enter:
https://github.com/germanoeich/CoreKeeperTilesetGenerator.git

Examples

The package includes example generator assets and source PNGs under Examples.

Sample source textures:

Reference tileset atlases:

Usage

1. Create a Generator Asset

In Unity, create a new asset from:

Assets > Create > Core Keeper > Tileset Layer Generator

Create one generator asset for each Core Keeper layer you want to generate.

2. Choose the Output

In the generator inspector:

  1. Set Target Tileset to an existing ModTileset if you want to update it.
  2. Leave Target Tileset empty to create a new ModTileset.
  3. When creating a new tileset, set New Tileset ID.
  4. Optionally set Output Folder. If empty, the generated assets are created beside the generator asset.

3. Choose the Template and Source Texture

  1. Pick a Layer Template.
  2. Assign a readable Source Texture.
  3. Set Tile Size to the size of one source tile in pixels.
  4. Optionally assign Source Emissive Texture to generate a matching emissive layer.

The source texture and optional emissive texture must have Read/Write enabled in Unity import settings.

4. Select Source Tiles

Use the tile picker controls in the inspector to assign source tile positions for the tile groups required by the selected template.

For normal blob generation, fill the compact 17-tile selections and make sure Fill Tile has exactly one selected tile.

Enable Arrange Only when you want to copy the selected source tiles into the Core Keeper runtime layout directly, without adaptive reconstruction.

5. Generate

Click Generate Layer to create or update the target ModTileset layer.

Click Export Texture if you only want to export the generated texture without applying it to a ModTileset.

Building a Full Tileset

Create one Core Keeper/Tileset Layer Generator asset per output layer and point all of them at the same ModTileset.

You can regenerate every generator asset in the project from:

Tools > Core Keeper > Tilesets > Generate All Layer Generators

Leave Layer Bank Mode on Use Template Bank unless the layer behavior itself needs a custom PugMapTileset bank.

Template Data Generation

The layer templates used by this package are generated from dumped Core Keeper PugMapTileset assets.

The source data starts as serialized Unity YAML from tileset_*.asset files. In this package, those dumps are stored as .txt files under:

Editor/Templates/Dumps/

They are kept as .txt so Unity treats them as data files, not importable asset definitions.

The generation script is included at:

~Tools/generate_runtime_blueprints.py

The parse process is:

  1. Dump the vanilla tileset_*.asset files as text/YAML.
  2. Parse each layers block from the dumped tileset.
  3. Keep adaptive layers using AdaptativeFill or AdaptativeExtrude.
  4. Choose the runtime lookup table:
    • use generatedTextureAdaptativeSpriteLookupTable when generateFullAdaptiveTexture is enabled
    • otherwise use adaptativeSpriteLookupTable
  5. Apply the layer's available direction bits to each 8-bit neighbor mask.
  6. Resolve each mask to the atlas cell or cells used by Core Keeper at runtime.
  7. Write JSON and text summaries to the output folder.

By default, the script reads:

Editor/Templates/Dumps/

and writes to:

~Tools/generated/

Run it from the package root:

python3 ~Tools/generate_runtime_blueprints.py \
  --layer-name-enum /path/to/decompiled/PugMap.Common/PugTilemap/LayerName.cs \
  --tile-type-enum /path/to/decompiled/Pug.Base/PugTilemap/TileType.cs

Add --generate-images to also write diagnostic blueprint PNG atlases.

The enum paths are required when regenerating package templates. Without them, the script falls back to numeric names like LayerName_8, which are useful for inspection but are not valid template names for the Unity editor.

Each generated JSON file describes one layer template: the source tileset, layer name, target tile, lookup kind, runtime grid size, and mask_to_cells mapping. After reviewing the generated output, copy the generated .json files into Editor/Templates/Blueprints/. The editor reads those JSON files at load time, then uses the matching dump file to recover the remaining layer settings needed to build a compatible QuadGenerator.

License

The source code and tool scripts in this package are licensed under the Mozilla Public License 2.0.

The MPL-2.0 is a file-level copyleft license. If you distribute modified versions of this tool's source files, those modified files stay under the MPL-2.0.

Using the tool does not place your source art, generated textures, generated ModTileset assets, or other project assets under the MPL-2.0. Those assets remain governed by the rights and licenses that apply to your inputs and project.

About

Core Keeper tileset generator and tooling for working with Core Keeper tilesets.

Topics

Resources

License

MPL-2.0, Unknown licenses found

Licenses found

MPL-2.0
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors