Filling array with data from text file

0 favourites
  • 7 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I am trying to make an RPG and I need to enter a great amount of data in 3D arrays (world map, objects, dialogs...). I would like to work on text files and then load them in arrays at start of layout for use in the game. I know there are already multiple topics on this problem but none of them provide a clear way of doing this.

    Here is what I figured out :

    • You can use a super long JSON string, but the syntax is not intuitive and not suitable for great amount of data
    • You can add external files in the game project file and call them through AJAX but I am missing a step on how to fill the array

    Here are my questions :

    • What text file format should I be working on ? (.txt, .xml, Json, other ?)
    • How can I get the data from the text file and fill the arrays with them ?

    Those questions were asked before but I coudln't understand the answers given. Could someone help me please ?

  • OPG

    I can be misunderstanding the problem(English isn't my native language), so correct me if I am wrong:

    You want to be able to work on files to load inside arrays, but only for your convinience (so the user shall not be able to edit it).

    If that is the case, I think it is possible for you to create another quick project on C2 to have an JSON array editor suitable for your needs, then, you just put the retrieved content in a .JSON file, which you include in C2 project files, and load into arrays using the Ajax object.

    I am not sure on how to do it, but creating an easy-to-work-on array editor to make array editing simplier, then use them into the original project may be the solution to need

    If someone has a better idea, Or if I am All wrong, correct me please.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Aphrodite,

    I'm french too so we will both make English mistakes !

    Thank you for your answer, however it is not the good solution for me.

    I plan to make a 100x100 array with a specific data in each spot. If I go through C2 to make it, it means doing 10 000 events to fill each spot...

    I would like for example to use a CSV file that I could edit in Excel and then "translate" it to an Array in C2.

    Perhaps I am wrong but there is no way of "filling" manually an Array in C2 without doing a lot of events ?

    Merci !

  • this can help

    CSV, CSV2Array

  • I made an ingame level editor in my previous game and wrote a tutorial about it few weeks ago, it makes level making much more easier, you can make your RPG levels quickly inside your game and export the whole JSON file quickly into your downloads folder. After this you export this file into your project, the tutorial also shows you how to make a loader to load the json back into te game. You can add more parameters to the array by increasing the first parameter(currently 4). This method saves you a lot of time. For example if you want to add a character dialog you just drag a text box from the side menu and after adding text you save the textbox text into the array.

    I hope, that was helpful.

  • Great thank you for your help.

    vtrix I'll try the CSV plugin but i guess I won't be able to put my game on the arcade if I use it.

    trollface I'll also have a look to your level editor, the initial time investment will probably allow me to save a lot of trouble later on !

  • OPG they are working on something to allow plugins,could be soon, so if it easy to use i would use it, anyway have you also considerd tmximporter with the tileprogram, you can search for it,.. have fun making your game!

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