Anyone else sabotaging themselves with the storage action?

I do it most of the time whenever I add a new variable… and I just did it again.

For example, this time:
I have this big structure than contains a lot of my game variables, let’s call it HS (For heavy stats) Every 10 seconds HS is saved to storage and If you close the game, it loads HS at the beginning of the scene.

I recently added a new structure inside HS called Friends which contains details of the NPCS that you can befriend. Basically, Structures with their likes and dislikes.

Yesterday I was messing with the StrFind function for the first time ever.
And I couldn’t make it work! No matter what I tried, I was unable to get results from the HS structure…

Then I created a new variable outside the HS structure to test. And it was working!!! So I thought that StrFind simply couldn’t work with structures, but then I turned the test variable into a structure to test and it still worked.

And then I realised

StrFind wasn’t working because there was no variable to pull results from…
Since I had added a new structure inside my HS structure, and the game was loading older saved data at the beginning, the Friends structure was never actually loaded.

I spent 2 hours of my life on this, and I couldn’t sleep at night because I kept thinking about what was wrong with my code… all because of a stupid mistake that I keep repeating every so often!!!

Anyone else with similar mistakes?

Also, the above situation begs the question… what should I do if I’ve already uploaded a game, but later want to make changes to an existing structure without messing up the player’s saved stats?

Maybe I should check whether the child structure or variable exists first, and then add it to the structure if it doesn’t. But that sounds like a lot of work if you plan to constantly push updates.

I wouldn’t call it sabotage when it’s actually a fairly common problem in the life of any developer, regardless of their role. We tend to focus on very specific areas of the code frequently, while some problems are better visualized when viewed through a broader lens (Good opportunity for a reading suggestion: “The Art of Game Design: A Book of Lenses” by Jesse Schell. Good stuff). It will happen again; the important thing is to always remember the lessons learned in the process.

It’s not uncommon to see projects in development that undergo frequent changes with this same consequence. For a long time, Project Zomboid made (and sometimes still makes) save files completely obsolete after major updates for exactly the same reasons. Mechanics change, structures are updated with new or different functions, and different versions certainly become incompatible.

In the specific case of GDevelop, the internal file structure is a little less rigid than in most engines, and this allows us to load the game even with missing information that won’t be used in certain scenes, for example. This obviously has two sides: the game doesn’t need to load absolutely all the necessary information all the time, which is good for performance, but it can generate unexpected errors that we’ll only discover if we access that specific point where the information is missing.

I imagine your solution might work; you could try using your own example as a test case since it’s not that difficult to force the problem. But, thinking from the game designer’s point of view and considering a project under development, this kind of thing is expected, but it’s also expected that you, as a developer, already have in mind a minimum plan for the data structure you will use in your project.

I hate to admit it but AI can really help with the simply coding mistakes. extra } or miss-spellings.

It was driving me nuts once looking at 500 lines of code on why my jump stopped working. Asked chatgpt. 60 seconds later yup I has miss typed Space as space 1 time.

i dont know how well it can code by itself but it can usually find simple mistakes.