Skip to content

Best Practices

Ste edited this page Feb 25, 2025 · 13 revisions

Table of Contents


Code/Naming Conventions

Dome Keeper's source code varies from the GDScript Style Guide in a few significant ways:

  • Non-virtual functions utilize camelCase (beginning with a lowercase letter) rather than snake_case. (Example: unlockGadget instead of unlock_gadget)
  • Some signals employ camelCase, others use snake_case. Make your choice based on the existing convention relevant to your case, or opt for snake_case if unsure. For all other aspects, refer to the GDScript Style Guide.

Project Setup for a Mod

Upon decompiling the project, you have several options for developing your mods.

Recommendation: Symbolic Links

Symbolic links offer an easy way to manage the development and version control of multiple mods. You can create symbolic links to your mod's directory within your decompiled project directory. Windows users can utilize an easy-to-use shell extension to set up such links. Alternatively, you can use the command-line tool mklink.

An efficient setup includes:

  1. Creating a mods-unpacked folder outside your Godot project.
  2. Generating a symbolic link for each mod you intend to work on within the mods-unpacked folder.
  3. Linking this mods-unpacked folder to the Godot project.

Why opt for this setup?

  • It allows for easy version control of each mod individually.
  • You can test and work on mods effortlessly inside the Godot project.
  • Adding or removing mods in development becomes much simpler.
  • Updating the project with a new version doesn't necessitate reconfiguring the entire mods-unpacked setup.

Extend before Overwrite

Aim to extend scripts and resources before overwriting existing ones. Overwriting crucial scripts or the vanilla game code could hinder the functioning of other mods or even the base game if an update modifies the section your mod overwrites.

Scripts can easily extend functions and still invoke the original function using a super call:

extends "res://stages/level/LevelStage.gd"

func landDome():
   super() # this calls the base class function
   # do additional mod stuff

For scenes, "extending" the scene by adding new child nodes or hiding original nodes is a preferable strategy.

Only use extensions and overwrites when necessary

Some mod use cases may require their overrides upon initialization, for instance, for icons. Other elements may only be needed at specific times, like a new game mode.

If you wish to minimize the impact on the base game, only load your extensions and overrides when needed and unload them when not needed.

Translations in Spreadsheet

For mods with a few translations, managing the translations.csv file might suffice.

However, as a project expands, it's common to add more text and languages. Storing your translations in a spreadsheet—preferably in a cloud storage provider like Google Sheets—can simplify tracking and adding new translations. Most spreadsheet tools support exporting to CSV format.

Mod Loader Dev Tool

The Mod Loader Dev Tool can do some of the heavy lifting for you. It is recommended you download it just for that small decrease in tedium. For a complete listing of features, head over to the Asset Lib.

Installation

  • Open the AssetLib Tab in the Godot Editor
  • Search for Mod Loader Dev Tool
  • Click on Download
  • Click on Install
  • Go to Project -> Project Settings -> Plugins
  • Check the Enable checkbox
  • Go to the Mod Tool tab and start modding

Source: https://github.com/GodotModding/godot-mod-tool/tree/4.x

Clone this wiki locally