#A way to handle data

1 messages · Page 1 of 1 (latest)

rare moon
#

So, I am trying to think of a good way to handle data without become overwhelmed with tons of lines of json.

If i created a json file for each item, character, enemy, whatever and then during the game setup, have these compile and encrypt for release and have a single file for each thing would that be optimal?

So, lets say in my included I have a folder called Items. inside that folder is Potion, Hi-Potion, Ether, Hi-Ether, etc. All json files.

When I build my game, I create an empty array, when i get the first file in the folder and push the parsed json to the array, move to the next until there is no file remaining.

Stringify that array and then save the file ready for game use.

Does this sound like a good way to handle it or an absolutely dreadful way. Keep in mind that this will purely be on the development side as the release version would only open that 1 file.

rugged elm
#

could also use CSV depending on the nature of your data

rare moon
#

I was thinking of that as a possibility I just couldn't think of how youd handle an array of data like you can in json.

{
  "name":"Potion",
  "effects":[
    "heal",
    500
  ]
}

not sure how that translates to CSV also that is not how I am doing stuff. That is dreadful example but yeah, dunno how to do arrays in CSV

sharp marlin
#

you could use a different delimiter and parse it manually

#

e.g something like

name, effects
"potion", "[heal;500]"
rare moon
#

that requires me to parse things manually though when I could just easily parse json lol

sharp marlin
#

🤷‍♂️

rare moon
#

string split is a thing now?

golden halo
#

been a thing since last november