JSON, Array & Dictionary

0 favourites
  • 3 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I have a basic question that couldn't locate on the forum. Maybe the most obvious of the answers, so apologies in advance. I guess- Arrays, xml, json and dictionaries are allowed to be added more than once to the project. A text box says they are available for the entire project, but other plugins like input controls, web, etc.. don't show up again after been added. And also those files can be created in the editor without having previously added the object to the project. So I am a bit confused.

    Does it mean that for each one of those project files that I have to be requested, I must add one object of the kind? I mean, if I have 3 dictionaries, would be 3 dictionary objects with 3 project files or just 1 dictionary object for the three files would serve?

    So, e.g.- a string key is unique for each dictionary JSON project file or for each dictionary object?

    Given JSON, arrays, dictionaries and XML have different ways of calling their values through actions or expressions and some return values as strings and others as numbers, I am mixing things up at figuring out the best way to manage dB for users, players/enemies stats, leaderboards, ... and need some enlightening.

    But I will not expand any more, just that simple doubt- one object per file or just one object and all the files?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm not sure about XML and JSON but dictionaries are like arrays. You can have multiple objects and multiple instances of those objects. I've often made dictionaries and arrays to be in a container with sprites.

    Edit:

    If you have for example one for unit costs and one for resource requirements, it's usually better to have separate objects. But if every unit has an array describing its last 5 moves, it's better to have instances.

  • Sumyjkl

    Thanks for the response. So, for every array or dictionary that I create in the editor as a project file, there must be an array object related to it.

    I wasn't getting the point of having array/dictionary instances. Forgive if it is a nonsense question. They are supposed to be data storage objects, which don't are visually settled onto the layout. And the way their values are 'called' is by actions or expressions, so I thought instances didn't matter here.

    But if I understand you correctly, I can attach an array/dictionary to a sprite (player, enemy, ...) through a container, so having just one array/dictionary object, esch instance has its unique values stored separatedly in its own array/dictionary, just like instance variables. That sounds way better.

    I was approaching this by making an array where every character (player/enemy) was included. X being each different character and Y storing the diffetent 'stat' values.

    Now I am not pretty sure about my method.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)