No no. It works like a database in a way. It's like what
@Andar said. Look I will try to explain, it is really technical, but when you open a file to read it, the file is not in danger in general. When you open a file to write inside of it, you surely will mess with its structure temporarily, until you write whatever you want and CLOSE it properly. So
(I try to be here as simple as possible) programs open and close files in different ways. When you open to edit a file though, it is a dangerous moment.
What MV does open the files, as
@Andar already told you, it is keeping the json files open all the time during editing, in order to be able to edit them on the fly. Why? Well a possible reason is to avoid bad response times during editing or even worse the need to reset everything everytime you make a change. Remember you can playtest your game on the fly. It's not as simple as it looks, nothing is as simple as it looks. I can give you an example. Variables are not set during editing. Variables are set at runtime. Thus when you preview a Show Text command that involves a variable, the variable will be 0! Imagine you making changes and these changes being available only during runtime. LOL right? You need them available instantly.
"Wait! This is stupid! I might crash and lose my work". Yes. In a relative way it seems stupid. On the other hand, it is smart in many other ways. Thus because it solves more problems that it causes, I consider it being OK. I imagine something like this:
Let's say MV was 100% crash proof. What does that programmaticaly mean?
What if the program would load all json files into RAM? Then it would write changes once, every time you say so, making a backup first, then if the procedure would be smoothly ended, you could go on, otherwise a rollback feature from a backup would take place. Sounds great right?
Here goes the problems with such an approach:
- A json file can become huge.
- A project might have hundreds of json files.
Thus you might need a lot of RAM and I mean A LOT, without any reason.
Also the program would not be responsive, in a way you would imagine it is full of bugs. You would never be sure if it crashed or if it just does a lot of work during saving.
When saving from the RAM to json, everything would be ok.
That is far from smart programming.
Before saving, you can't playtest any changes and of course you can't access such changes on the GUI either, meaning you make a change and it isn't htere yet, even after saving. Oh! If you need to fix that by refreshing all the json files, then the program will not be responsive after ANY change you make.
Everything has to be resetted.
Is that something smart? Nah!
So in order to avoid these problems and a lot more, the program access json files on the fly. It is dangerous indeed, but it solves everything and you can keep yourself safe with not much effort, just backup every day a copy of your game.
I am sad for what happend to you for real. I know how you feel, I was angry and sad at the same time when I lost my work once.