save-systems
Qué hace
Cubre el guardado y la carga del progreso del juego, incluido qué guardar, la escritura segura de archivos y el control de versiones. Es para desarrolladores que necesitan guardados que sigan intactos tras las actualizaciones.
Cuándo usarla
- ✓Cuando necesitas guardar el progreso del jugador, el inventario y las banderas del mundo entre sesiones.
- ✓Cuando los guardados se corrompen tras un fallo o cuando el juego se interrumpe durante el guardado.
- ✓Cuando los archivos antiguos dejan de funcionar después de actualizar el juego.
Link de la skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/save-systems/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Mis jugadores pierden sus guardados si el juego falla mientras guarda, y los guardados antiguos se rompen tras las actualizaciones. ¿Puedes arreglar el sistema de guardado?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente decide qué datos son la fuente de verdad y guarda esos datos en lugar de los objetos del motor. Añade un número de versión a cada guardado, escribe el archivo de forma que un fallo no lo corrompa y añade código de migración para las versiones antiguas.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Save systems
A save file is a serialized snapshot of game state that survives restarts. The hard parts aren't writing bytes — they're choosing what to save, writing it so a crash mid-save can't corrupt it, and reading old saves after you ship a patch. Get those three right and the rest is plumbing.
When to use
- Use to persist progress: player stats, inventory, world flags, settings, positions — across sessions and game updates.
- Use to design save slots, quicksave/autosave, and crash-safe writes.
- Use when old save files break after a content/code change (versioning & migration).
When not to use: for Roblox cloud persistence specifics, use
roblox-datastores. For the data model the save serializes (resources/SOs), use
godot-resources / unity-scriptableobjects. For Godot's FileAccess/
ResourceSaver and user:// paths, defer to the Godot engine skill while
applying the patterns here.
Core workflow
- Decide what state is authoritative. Save the data (hp, position, seed, unlocked flags), not engine objects or scene nodes. You will reconstruct objects from data on load — never serialize live node references.
- Define a versioned schema. Every save embeds a
versioninteger. This is the single most important field for a game you intend to patch. - Pick a format. JSON/text for readability and debuggability; a binary format for size/speed or mild tamper-resistance. Start with JSON.
- Write atomically. Serialize to a temp file, flush, then rename over the real file. A crash leaves either the old save or the new one — never a half-written one.
- Load defensively. Read version → migrate up to current → validate → instantiate. Keep a backup of the last good save and fall back on parse error.
- Autosave on safe boundaries (level change, checkpoint), throttled, and to a separate slot so it can't clobber a manual save.
- Verify: save, fully quit, relaunch, load — and confirm by inspection that state matches. Test loading a save from the previous version.
Patterns
1. Serialize state as plain data (not engine objects)
# Build a dictionary of pure data. Each savable object reports its own state.
func capture_state() -> Dictionary:
return {
"version": SAVE_VERSION, # ALWAYS stamp the schema version
"player": { "hp": player.hp, "pos": [player.position.x, player.position.y] },
"inventory": player.inventory.to_array(), # ids + counts, not Item nodes
"flags": world.flags, # e.g. {"met_guard": true}
"seed": world.seed, # regenerate procedural content
}
# On load, RECONSTRUCT objects from the data — do not expect live references back.
func apply_state(data: Dictionary) -> void:
player.hp = data["player"]["hp"]
player.position = Vector2(data["player"]["pos"][0], data["player"]["pos"][1])
player.inventory.from_array(data["inventory"])
world.flags = data["flags"]
2. Atomic, crash-safe write (temp + rename)
# Godot 4.7. Write a temp file, keep the previous save as .bak, then rename.
func save_atomic(path: String, data: Dictionary) -> Error:
var tmp := path + ".tmp"
var f := FileAccess.open(tmp, FileAccess.WRITE)
if f == null:
return FileAccess.get_open_error() # disk full, read-only, no permission...
if not f.store_string(JSON.stringify(data)):
return ERR_FILE_CANT_WRITE
f.close() # flushes Godot's buffer to the OS
if FileAccess.file_exists(path):
DirAccess.rename_absolute(path, path + ".bak") # keep the last good save
return DirAccess.rename_absolute(tmp, path)
func load_save(path: String) -> Dictionary: # empty = nothing loadable
for p in [path, path + ".bak"]: # .bak covers a crash between renames
if FileAccess.file_exists(p):
var data = JSON.parse_string(FileAccess.get_file_as_string(p))
if data is Dictionary and data.has("version"):
data["version"] = int(data["version"]) # JSON numbers load as float
return data
return {}
# WRONG: opening `path` directly and writing in place — a crash mid-write leaves a
# truncated, unloadable save and destroys the player's progress.
A crash now leaves the old save, the new one, or (between the two renames) only
the .bak — which the loader tries
Preguntas frecuentes
¿Por qué añadir un número de versión a cada guardado?
La skill lo llama el campo más importante, porque permite que futuras actualizaciones conviertan los guardados antiguos.
¿Debo guardar objetos de escena?
No. La skill indica guardar datos y reconstruir los objetos a partir de ellos al cargar.
¿Cubre guardados de Roblox?
No. Los almacenes de datos de Roblox los cubre una skill de Roblox aparte.
Detalles
Descripción original del autor
Design save/load for game state — choosing what to serialize, file formats, save slots, atomic crash-safe writes, schema versioning and migration, and autosave. Engine-neutral. Use when the user mentions save system, save/load, game state persistence, save slots, autosave, save file corruption, or migrating old saves to a new version.
Popularidad
- Estrellas en GitHub
- 6,6 mil
- Posición en el ranking
- #13804
- Licencia
- Apache-2.0
- Actualizada
- 28/10/2026
Comentarios
- …
Más skills de este repositorio
router
6,6 milAyuda a tu agente a elegir la skill de desarrollo de juegos adecuada para cada petición, detectando tu motor y el tipo de tarea que necesitas.
ai-behavior-trees-utility-ai
6,6 milAyuda a tu agente a construir un árbol de comportamiento y un sistema de IA por utilidad para enemigos y personajes que eligen acciones según prioridad y puntuación.
audio-design
6,6 milEnseña a tu agente la mezcla de audio de juegos: buses, volumen en decibelios, ducking bajo los diálogos, música adaptativa y variación de efectos de sonido.
camera-systems
6,6 milAyuda a tu agente a crear cámaras de juego que siguen con suavidad, se mantienen dentro del nivel y orbitan o miran alrededor en 3D.
Skills parecidas
diffs
394 milPermite que tu agente genere un diff real y compartible de los cambios, como enlace de visualización o archivo de imagen, en lugar de un resumen escrito a mano.
coding-agent
394 milAyuda a tu agente a pasar un trabajo de programación grande a Codex, Claude Code u OpenCode como trabajador en segundo plano, y después revisar su progreso.
gh-issues
394 milAyuda a tu agente a encontrar incidencias de GitHub, elegir cuáles trabajar y abrir pull requests con correcciones, incluido el seguimiento de los comentarios de revisión.