Modding: Difference between revisions
Update supported flip, lighting, validation and wallpaper-region formats from current mod examples |
No edit summary |
||
| Line 1: | Line 1: | ||
2D Tower supports modding through data-only content packs which can be shared through Steam Workshop. Content packs can add additional variations of rooms, decorations, wallpapers, and custom maps to the game. The modding system is currently unable to allow for new behavior through custom scripts. | 2D Tower supports modding through data-only content packs which can be shared through Steam Workshop. Content packs can add additional variations of rooms, decorations, wallpapers, audio, and custom maps to the game. The modding system is currently unable to allow for new behavior through custom scripts. | ||
== Installing mods == | == Installing mods == | ||
Latest revision as of 00:51, 21 November 2026
2D Tower supports modding through data-only content packs which can be shared through Steam Workshop. Content packs can add additional variations of rooms, decorations, wallpapers, audio, and custom maps to the game. The modding system is currently unable to allow for new behavior through custom scripts.
Installing mods
The easiest way to install mods is through Steam Workshop. Browse through the workshop for mods and subscribe to ones that interest you. The next time you start the game through Steam, the subscribed mods will automatically be listed in the mods window, waiting for you to enable them for the game. You can enable the mod by toggling the mod on.
Creating mods
Mods are data-driven content packs defined through JSON files along with your assets. Creating a new mod involves 3 major steps:
- Create a mod template using the in-game mod template generator
- Make your changes to the template mod pack
- Use the in-game mod window to publish your mod to Steam Workshop
Create a mod template
The easiest way to get started with a new mod is to use the Mods window and its 'Create mod' feature. This menu allows you to create mods for most room types, decorations, and wallpapers.
When you click on create mod, the game will generate a skeleton mod folder with a basic structure of a new content pack containing your room. The directory structure of this mod should look something like this:
user://mods/
└── my_record_store/
├── manifest.json
├── rooms/
│ └── record_store.json
├── textures/
│ └── records.png
├── i18n/
│ ├── en_US.json
│ └── de_DE.json
└── icon.png
user:// is Godot's per-user data folder. From the title screen, use Mods → Create, then Open mods folder in the Edit step to open the correct location; on a standard Windows installation it is normally %APPDATA%\Godot\app_userdata\2D Tower\mods\. Development builds also discover packs in res://mods/. The game discovers only direct subfolders of these directories that contain manifest.json.
Edit your new mod
After locating your new mod template folder, make your changes. Add new assets and define them within the room JSON definition.
Ensure that you add any necessary translations, update the mod pack icon, and update the mod manifest JSON file to include your changes. Refer to the technical details in the sections below.
Verify and publish
If your mod is working, you should be able to see it listed in the mod window. Select your mod and click on 'Validate' to ensure it is readable and compatible with the game. You can then publish the mod by clicking on 'Upload to Steam Workshop'.
Open Mods on the title screen to enable or disable local packs. Restart the game after installing, removing, enabling, disabling or editing a pack because the content catalog is built at startup.
Steam Workshop packs use the same layout: manifest.json sits at the root of the uploaded folder. Workshop installations stay in Steam's managed directory, not in user://mods. New subscriptions start disabled; enable them in Mods and restart. Use Mods → Create for templates. In Mods → Publish, select a local pack and choose Validate; with Steam running, Upload to Steam Workshop uploads it. New items start private. View on Workshop opens the item page for review and visibility changes. Use a square preview around 512 × 512 pixels and under 1 MB for Workshop compatibility. Its Workshop sidecar file is stored beside the pack folder; keep it to update the same Workshop item later.
Saves record required pack identities, compatibility versions and Workshop IDs. To open a save, keep its required packs installed and enabled with matching save_compatibility_version values and all referenced content IDs available. The game reports missing or incompatible content instead of silently substituting it. A similarly named Workshop item is not a replacement for the original item.
Technical details
Content pack manifest
manifest.json is at the root of the pack folder. Paths in the manifest are relative to that folder and may not escape it.
{
"pack_id": "my_record_store",
"version": "1.0.0",
"enabled": true,
"dependencies": ["base"],
"rooms": ["rooms/record_store.json"],
"translations": {
"en_US": "i18n/en_US.json",
"de_DE": "i18n/de_DE.json"
}
}
- pack_id is the pack's permanent identifier. It must start with a lowercase letter and otherwise use only lowercase letters, numbers, periods, underscores and hyphens. Keep it stable after publishing because saves refer to it.
- version identifies the pack release.
- save_compatibility_version is a positive integer, defaulting to 1. Save loading requires the recorded compatibility version to match, independently of the release version string. Keep it unchanged for compatible updates; change it when your content breaks the saved-content contract.
- enabled is optional and sets the initial state for a local pack. The Mods window stores the player's final selection in
user://mods.cfg. - dependencies lists required pack IDs. Most packs depend on
base. - rooms, wallpapers and maps list their definition JSON files relative to the pack folder. A pack does not need all three kinds.
- Optional name, description and author describe the pack in the Mods window. Workshop packs show the item owner as their author.
- translations is optional. Each key is a locale and each value is a JSON translation file.
Pack folders are scanned in a stable order. Local packs need distinct IDs. Workshop items also use their Workshop item ID, allowing different creators to use the same author-supplied pack ID without colliding. Duplicate effective IDs are rejected; a user pack cannot replace a shipped pack.
Room definitions
Every room JSON file inherits a registered built-in room. The file name supplies the room's local ID unless it has an explicit id. For example, rooms/record_store.json in the my_record_store pack becomes my_record_store:room:record_store. Moving the file to another subfolder does not change that ID.
{
"extends": "base:room:store",
"occupancy_mode": "immediate",
"overrides": {
"display_name": "Record Store",
"description": "A specialist shop selling vinyl records.",
"width": 14,
"height": 1,
"entrance_offset": [6, 0],
"construction_cost": 125000,
"maintenance_cost": 100,
"worker_count": 2
},
"icon": "icon.png",
"visual": {
"texture": "textures/records.png",
"region": [0, 0, 13, 2],
"horizontal_frames": 1,
"vertical_frames": 2,
"frames": [
{ "variant": 0, "mode": "open", "frame": 0 },
{ "variant": 0, "mode": "closed", "frame": 1 }
]
}
}
extends must name an existing room. The loader makes an independent copy of that parent, so a mod never changes the original room. The supported general overrides are the display name and description, category and palette order, size and entrance, construction and maintenance costs, worker count, visit duration, custom-entrance setting and can_flip_h. Demolition charges are fixed at 20% of construction cost; occupied sold residential rooms also repay their current sale price. Values have to use the required data type; dimensions, coordinates and texture regions are integers.
Depending on the inherited runtime, a room may also use supported profiles such as commercial, residential, stock, garbage, demand and evaluation. Installed room mods ignore unrecognized JSON fields, including retired settings, while recognized fields still require valid values and references. Workshop validation rejects unrecognized fields and prevents publishing until they are removed. Start with the template for the room type you want to inherit.
can_flip_h enables horizontal flipping while building or relocating a room and in its query window. It defaults to false; decoration templates set it to true. Flipping mirrors artwork and its selection shape without changing occupied cells. Keep it false for text or floor numbers that should remain readable.
Artwork and translations
icon is a PNG path inside the pack. A custom visual uses a texture and region in the form [x, y, width, height], measured in 32 × 128 pixel tile cells, not pixels. The example above selects 416 × 256 pixels. horizontal_frames and vertical_frames split the region into frames; frames maps their indices to cosmetic variants and modes. The store example uses open/closed modes; residential and office artwork use different mappings. Start with the matching template rather than assuming every room uses two open/closed rows. Without a custom visual, the room keeps its parent's artwork, footprint and appearance definitions.
Optional appearances entries define stable cosmetic IDs and a variant matching the visual frame mappings. A custom texture clears inherited appearances unless the mod provides its own entries. Translation files supply localized text; a short appearance display_name_key is scoped automatically to that room's ID.
Recolorable decor and lighting
The Decor template includes a painting and rooms/example_light.json, a working recolorable pendant light. Start with the parent decoration whose footprint and rendering layer match your design. Map both lit and unlit to frame 0 for static artwork.
Set visual.color_mode to channel_palette, channel_count to 1–3, and channel_colors to that many HTML colors. The region contains luminance artwork and has its RGB material mask directly below it. Red, green and blue select the channels; transparent luminance pixels stay transparent. A 2 × 1-cell artwork region occupies 64 × 128 pixels, with another 64 × 128 pixels for the mask. Players can change these colors in the decor query window.
An optional query_polygon under visual supplies at least three integer [x,y] points in displayed pixels inside the room footprint. Order them around a non-crossing outline. If you change the footprint without supplying a polygon, picking uses the new rectangle.
Room visuals can also supply emission_texture and emission_glow_texture, with normalized emission_uv_offset and emission_glow_uv_offset. The lighting PNG's red channel supplies emission; green supplies the soft glow. Glow requires emission and matching lighting-texture dimensions. emission_color is independent of the material palette; emission_strength accepts 0–4 and emission_glow_strength accepts 0–1. The example light packs luminance, RGB masks and lighting into three 64 × 128-pixel regions of a 64 × 384 PNG and uses offsets [0, 0.666666667] for both lighting samples.
normalize_channel_mask normalizes nonzero RGB values into palette weights at antialiased edges; with it enabled, white mixes the channels equally. Use emission data for an independently white light source. When replacing a parent's visual, explicitly declare its lighting; inherited lighting textures and offsets are not copied onto new artwork. Wallpaper uses a separate palette system and does not accept room-lighting fields.
Wallpaper artwork
Use the Wallpaper template as a working starting point. It bundles five styles in textures/wallpapers.png: luminance tiles at the top, matching RGB masks below and full-color icon swatches in a third row. Each tile cell is 32 × 128 pixels. A wallpaper selects 1–64 cells across.
visual.region selects [x, y, width, 1] in tile cells, with the mask directly below the artwork. icon_region selects [x, y, width, height] in tile cells from the icon PNG. All selected regions and the mask must fit inside their PNG. Without visual.region, the whole wallpaper PNG must be exactly 256 pixels high. A standalone icon PNG does not need icon_region.
For example, the main template style uses "region": [0, 0, 3, 1] under visual and "icon_region": [0, 2, 3, 1] at the wallpaper definition's top level. Both texture and icon point to textures/wallpapers.png.
The visual mode is auto_repeat or cap_repeat_cap. Auto repeat cycles the selected columns; cap repeat cap uses the first and last columns as end caps and repeats the middle, requiring at least three columns. The colors array supplies one to three default HTML colors. Players can recolor placed sections, and those colors are saved. Construction cost, environment contribution and colors are editable values.
List the JSON definitions in the manifest, for example "wallpapers": ["wallpapers/my_wallpaper.json"]. The wallpaper's local id becomes <pack_id>:wallpaper:<id>; keep it stable for existing saves.
Custom maps
Use the Map Mod Kit to create custom maps. This kit is a separate Godot project that you can open. It allows you to use the Godot editor to import assets and draw out the map tilemap. The included scripts will then convert your defined map into a compatible mod content pack.
Using the map mod kit
The visual Map Mod Kit is supplied in the project's source checkout at tools/map-mod-kit; this wiki currently provides no separate kit download. The game's Mods → Create → Map template is available for players with only the game. For the visual editor, copy tools/map-mod-kit into your own working folder and import its project.godot in Godot 4.7. Open map.tscn as a separate project. Use its Export Map Mod command to produce a data-only pack; the editor project itself is not the pack to install.
Choose stable lowercase pack and map IDs, edit the title and gameplay settings, paint the map and export. Use the kit's example as a guide to scenery and entrances. Validate the resulting pack in the game's Mods window before publishing it. Map settings and objective plans are customizable, so a modded map need not share the built-in star requirements.