I'd like to start allowing for user-made content in my game. I'd like users to be able to add their own levels, entities and quests (along with all of the assets that are required). However, I'm unsure of the best way to do so.
Currently, the game loads its levels, entities, etc. from a JSON file. This file is embedded into the executable, and whenever the user starts a new game, it is created from this file. When the new game is saved, it is saved as a JSON file of the same format.
As an example, let's say that an add-on would be a folder containing the following:
- A JSON file describing any new levels, new entities, new quests.
- A single script file with one function that is called to make any modifications to the default game content, since it's not directly available. This would allow the addition of portals to new levels, characters to initiate new quests, etc.
- Audio, images, scripts for entities.
An editor will be provided in order to create the add-on; the author can create entities, levels, etc., so that they don't need to edit the JSON file manually.
Should the player be able to:
- Load add-ons at any point during the game (game == JSON save file)?
- Remove an add-on? Would the add-on author (or I) have to keep track of every new level, entity and quest that the add-on added and remove them? What if the entity is already removed?
It seems that the safest way to allow add-ons is to mandate that they be added at the beginning of a new game and cannot be removed once added. If an add-on makes a new weapon available, for example, removing the add-on once the player has already picked up the weapon would leave the game buggy. However, this seems very prohibitive.
Is this a sane approach? Is there a better one? How much responsibility should I leave with the add-on author? How have games that were designed to be customised handled this?