How to Create Files ( json,txt,csv,etc..) In Server, Save Data And Load into Arrays Construct3

6

Attached Files

The following files have been attached to this tutorial:

.png

Stats

2,678 visits, 3,630 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 3 Sep, 2020.

Hello All !

All My Tutorials Here

construct.net/en/tutorials/construct-tutorials-2525

In this file atached you will learn how to Save your game and load from server and generate Unique IDS

How it works :

Start of layout will create a new and unique ID for your users if not created and saved before

using this api

uuidgenerator.net/api/guid

After this, the game will save the coins ( or your own data ) into localstorage

After this you will see a button export to server , when click it will create a file ( yourid.json ) in the server with the data from localstorage

you can modify it and create files like txt , csv , xml etc

so your data will be saved in the server with your unique id

after you export ( not before ) will be available a button " import from server " and on click it will call the file with your ID from server load it back into your array and save the new data into your game

so its a save and load system game

the button will be available only after exporting , because if dont and user try to import a file tha doesnt exist will give a error

if you understand how it works you will see that you can do a lot of things like give a user the ID and when the user uninstall the game and install again in other cellphone , pc etc .. he can put the id and load the data , dont need to create a login system

Download Files Here

dropbox.com/s/ntol2jktpfmgyxf/CreateFilesInServer.zip

.PNG
  • 7 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • erorr on export, can you help?

  • does not work, exporting file error

    guniastudios.com/construct/2/index.html

  • Hey, I tried this and whenever I try uploading a file ajax just throws an error. I'm using my own 000webhost site but I'm using the same exact php file as yours. Any help?

  • Thanks for important tutorial

    But if the player change his device how to check the same id (to import same number of coins for this player) ?

    because when he reload this page (uuidgenerator.net/api/guid)it generate a different id

    • abdalghani , Hi , yes this work like this , when reload it will be a different Id , because it generates unique ids, and the users only needs one ID and it saves in localstorage only once , for retrieve the data in the future you can send an email to the user with his Id , so you must make an request input from user to type his code if the user has one , and check into the server if its valid and retrieve the data

  • Thank you very much for all the tutorials! They are incredible! Regards