Hello, I have seen for a while that people use events to read JSON files or others, I still don’t know many things, but JSON is not just “game”? So I want to know a few things:
What are the benefits of reading other JSON files or others?
With what events can I say “read file X”?
How much importance applies in one game or another?
For one, in the case of variables, particularly structures, you can save a complete variable structure (with all it’s descendants) into a JSON file in one statement. When you read it back into a variable, the structure is restored in two simple actions. If you did this yourself, it’d take a lot of events to achieve the same result.
Hello @ElementerTheDragon ,
imagine that you are writing a game and youneedto store informations closing application and read them when you reopen it.
Your first idea is to store the best score. So you insert:
at begin of game: save best score
on quit: write best score .
After one week you want to add the player name so:
at begin of game: save best score
save player name
on quit: write best score
write player name
After one week you want to add the player birth date . So
at begin of game: save best score
save player name
save player birthdate
on quit: write best score
write player name
write player birthdate
…
After 2 mounth of develop you have to manage a lot of field.
But if you create the structure:
Player
–name
–best score
–birthdate
–…
this code will never change
at begin of game: save best score
transform structure player into json
save json
on quit: write best score
read json
put json into player structure
If you need to add 100 field you have to put them into the player structure and don’t modify the read/save code.