Godot Version
4.4.1
Question
I am building a small offline game and want to save match stats such as matchId, date, result, score etc.
The last N matches needs to be fetched and displayed in a stats screen when needed.
Currently I have 2 approaches but neither sit right with me, looking for guidance from experienced folks!
Option 1 - FileAccess
Refering to Saving games — Godot Engine (stable) documentation in English
FileAccess.save_line()
with the json of the concluded match details seems simple enough, but I am not sure about a couple of things here.
- This does not seem optimized for queries (e.g. I want to display a list of top 5 scoring matches in the future)
- Will this be scalable once the player has 1000s of matches?
Option 2 - SQLite
Using a plugin like GitHub - 2shady4u/godot-sqlite: GDExtension wrapper for SQLite (Godot 4.x+)
This seems more optimized for the task, but for some concerns -
- Can I encrypt the DB so the player can’t just open and edit values unrestricted?
- This doesn’t seem to allow write access on some platforms - See issue: GitHub - 2shady4u/godot-sqlite: GDExtension wrapper for SQLite (Godot 4.x+)
What would be the best way to store fixed schema data in a scalable way and allow querying in your opinion?
Follow up:
If you were doing the same on an online-enabled game with cloud saves what would you do differently?
Thanks in advance.