Most efficient way to save/load data

Hey all,

I’m in my first few weeks using Defold and loving it so far! I’ve been mostly working in game logic/gui but want to start tackling saving/loading. I read some other threads about manipulating data and I was wondering the best approach.

So I plan to have one lua table that contains many tables that hold my data (items, enemies, player, level, etc.)

My game is turn based, so no high speed transactions needed necessarily. I’d be happy to hear any suggestions, the two approaches I’m currently considering are:

  1. Load all the data into a global table, manipulate/use as needed, save it all back when done
  2. Make a lua module with a bunch of functions to save/load specific data as needed. (For example, when the character uses an attack move call a function to load and return specifically the player weapon inside the attack function.)

Open to any and all advice, thanks!

1 Like

I would do the most stupid simple thing you can think of first, and if you find that too slow or not what you need, then make it more complicated as necessary. It’s not something you would want to do every frame, but loading and saving files is pretty fast. Unless you have a ton of data, I wouldn’t be worried about speed, so it’s just a matter of what would be easiest for you.

3 Likes