Storing multiple variables for multiple users

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I am creating a game where certain values need to be stored individually for each user and restored to the previous game state when they return.

    For example:

    User A Mood: 50 Health: 35 Hunger: 65

    User B Mood: 30 Health: 45 Hunger: 25

    Could you please advise on how to achieve this? Thank you so much!

  • Hi.

    You can use different names when you save each user's data to local storage, then after selecting a name, load exactly that user's saves.

    But.

    I would do via array or dictionary, store all variables for each player there, then after selecting a name load the desired array string into global variables.

  • Hi.

    You can use different names when you save each user's data to local storage, then after selecting a name, load exactly that user's saves.

    But.

    I would do via array or dictionary, store all variables for each player there, then after selecting a name load the desired array string into global variables.

    HI~I'm using Dictionary to store data!

    And now I'm curious about how to load these data so that I can identify and recover each user's game progress. Could you give me some advices? Thanks a lot!

  • How do you identify a player? Does he just pick his name from the list or does he have to enter it somewhere?And if other players want to play with the same name? That's cheating.

    It's very important to identify the player. For this you can use either google services or firebase or another method of identification.

    Once you have a unique identifier of your player you need to check the local storage, if there is such a key, then download.

  • How do you identify a player? Does he just pick his name from the list or does he have to enter it somewhere?And if other players want to play with the same name? That's cheating.

    It's very important to identify the player. For this you can use either google services or firebase or another method of identification.

    Once you have a unique identifier of your player you need to check the local storage, if there is such a key, then download.

    I first used a file to store the username, user ID, and user password, and called that file using AJAX, storing the information in an array. When the user enters their ID and password, if it exists in the array, they log in successfully; otherwise, the login fails!

    Currently, my method is to store multiple user attributes in JSON format in local storage, and I want to save the records when the user leaves or finishes the game. The next time they return to the game, the system can recognize the user and restore their multiple attributes.

    How do I read the data stored in JSON format in local storage? There are still some issues that I haven't been able to resolve! Or would you recommend another method for storing and reading the data? Thank you very much!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It is clear that this method has a vulnerability, players can pass each other a name and password and play on one more pumped up account. But if everything suits you, here is a simple example of how to store and load data of different players. I have put together a simple registration and login form, you can add password complexity checks and encrypt the password. But I have made the simplest example.

    kibaga.org/c3-example/file_uploads/index.php

  • It is clear that this method has a vulnerability, players can pass each other a name and password and play on one more pumped up account. But if everything suits you, here is a simple example of how to store and load data of different players. I have put together a simple registration and login form, you can add password complexity checks and encrypt the password. But I have made the simplest example.

    https://kibaga.org/c3-example/file_uploads/index.php?file_name=../storage-multiple-users-r397-2.c3p

    Thank you so much! Really helps me lot!😆

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