Game settings as a validated document: declare each setting once, scope it to a device, an account or a server, and save it through a store you choose. A settings screen, a console and a migration all read the same declaration.
GameSpice addon, MIT, built with Claude Code. examples/settings_selftest.tscn is the headless test. Every game in Zee's Games keeps its settings through this addon on live servers. Bug reports go to the issue tracker.
- Get Godot 4.7.
- Either use GameSpice Bootstrap, which clones every project and links the addons, or copy
addons/gs_settings/and GameSpice Core'saddons/gs_core/into your project and enable gs-settings in Project > Project Settings > Plugins.
GameSpice Core and GameSpice Save (copy its addons/gs_save/ beside gs_core) are the dependencies.
var schema := GSSettingsSchema.new() schema.add(GSSettingsDef.number(&"master_volume", 0.8, 0.0, 1.0, &"audio")) schema.add(GSSettingsDef.integer(&"fov", 90, 70, 120, &"video") .with_scope(GSSettingsDef.Scope.SERVER_CLAMPED)) schema.add(GSSettingsDef.binding(&"chat_open_key", "Y", &"chat") .with_scope(GSSettingsDef.Scope.ACCOUNT)) var settings := GSSettingsManager.new() settings.schema = schema settings.local_store = GSSettingsStoreFile.new() settings.app_namespace = &"my_game" settings.shared_namespace = &"tmc_account" # optional add_child(settings) settings.setup() settings.get_float(&"master_volume") settings.set_value(&"master_volume", 0.4) # saved shortly after, atomically
A key binding is stored as readable text ("Y", "Shift+A", "Mouse 1"), not a keycode, so the file means the same on every keyboard layout. GameSpice UI's GSInputBinding converts it to and from an InputEvent.
| Scope | For | Behaviour |
|---|---|---|
DEVICE |
Resolution, audio device, thread count | Never synchronised, so switching machines does not break it. |
ACCOUNT |
Sensitivity, crosshair, subtitles, language | Stored under shared_namespace. Games that use the same name share the value; others are unaffected. |
SERVER_CLAMPED |
Field of view, view models, third person | A server may cap it. |
A server can cap a setting but can never read one: asking clients for key bindings, audio device or resolution would build a fingerprint that survives new accounts and bans, so this addon has no read direction at all.
A clamp is a bound, not a value. What is saved is the player's choice.
settings.apply_server_clamps({"fov": 90}) settings.get_value(&"fov") # 90 for a player who wanted 110 settings.chosen_value(&"fov") # 110, what the screen shows
GSSettingsManager.to_config() returns a GSConfig whose properties are the schema's keys. GameSpice UI builds a panel from any GSConfig, so you do not write one.
| Behaviour | Why |
|---|---|
| Written on change, debounced | Dragging a slider is one write, and a crash loses nothing. |
| Atomic (temporary file, then rename) | A crash mid-write cannot corrupt the file. |
| Web builds flush the IndexedDB mirror after every write, removals included | user:// on the web is only a mirror. |
| Unknown keys are kept and written back | Going back to an older build does not lose settings a newer one added. |
| A bad hand-edit loses one line | An out-of-range value is corrected, an unreadable one falls back to the default, and the two are reported separately. |
GSSettingsStore has three methods. A file store and a memory store ship. An account store is an HTTP client against whichever back end you use; this addon does not choose it for you.
Import the project once, then run the self-test scene in examples/ headless with Godot. Design notes: docs/design.md.
Zee's Games is a collection of games I made on GameSpice, for demonstration and for fun. They show what the platform can do, and they run on live servers you can join. Anybody can create games on GameSpice, and each addon is its own repository and can be used separately from the games and from the rest of GameSpice.
These games vendor this addon:
- Fatal Contact
- Airdrift
- Playlot
- Hungario
- Buses From Hell
- Smash Copter
- Zombie Zone
- Hide n Seek
- Prop Hunt
- Murder Mystery
- Deathrun
- Wipeout
- Dangerous Delivery
- Look At Me
The whole collection is at zeesgames.com.
MIT licence, see LICENSE. The only closed part of the GameSpice platform is the web back end; you can use your own instead of GameSpice's.
