Json Files - Coding Guidelines

Game development with Board Game Arena Studio
Post Reply
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Json Files - Coding Guidelines

Post by MikeIsHere »

Where would I put json files in my project? In the root or in the modules folder?

I am writing cribbage and hopefully I will allow for different board designs, therefore, I want to put the board zone positions in a json file so I can write the following pseudo code

loadJson(this.boardName)
for i=0 to 120
player_1_i style Left:jsonVal Top:jsonVal
this.array1 = createzone(player_1_i);
player_2_i style Left:jsonVal Top:jsonVal
this.array1 = createzone(player_2_i);

Then the better questions is: do I need to make zones or can I just absolutely position my marker -- what would zones really offer
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Json Files - Coding Guidelines

Post by Tisaac »

Why would you store them as JSON ?
A natural place for this in inside material.php (as an associative array) and then you can send this data to your frontend (if needed) using getAllData function.
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Re: Json Files - Coding Guidelines

Post by MikeIsHere »

I was just thinking that since the server to client transfer is going from an associate array to Json anyway, why not just cut out the transformation and store the resulting json
Post Reply

Return to “Developers”