I’m working on Exercise 45 – “You Make a Game”, and I’m trying to create a text-based version of the Cave of Ordeals from Legend of Zelda: Twilight Princess. Granted, it’s only going to be a few floors of combat, as opposed to 45 – dear God that’s a lot, but it’s still quite the endeavor. I skipped ahead a bit to Ex47 to work with automated testing, and I’m slowly figuring out how to make things work and pass tests and such.
However, I need a way to store data, such as enemy and item attributes. I did some poking around on the Game Dev Stack Exchange and saw that some people recommended JSON for this purpose. In reading up on it, I found it makes a lot of sense and the syntax is pretty straightforward. However, I’m not sure how to best structure the file, and I can’t find a resource that explains it clearly.
Here’s what I have so far:
{
"Bokoblin":
{
"max_hp": 16,
"atk": 4,
"defense": 0
}
}
Are the top-level braces strictly necessary? I saw this structure in this article, and so I assumed it was necessary, but of course, that might not be the case. Can someone with JSON experience please explain this to me or at least point me to a resource that can?