how do variables behave online?

  • I have a game where i allow a user to enter their name through a textbox, and it is stored as a variable. I also allow to tweak some inventory, which is stored in an array.

    Now, I am not sure if it will work online. I mean, what will happen if I people visit my pure front end website online: html, css, javascript plus the construct game and begin entering their data. Will there be each game instance per a user or would they be overwriting the data constantly?

    How do I go about it?

  • Data is only available to that game unless you store it.

  • Thank you newt. I do have local storage, and it appears to work. What actually happens when local storage sets a variable in the game, when the game is online?

    This is my understanding to the best of my knowledge, which i have problem with:

    I do have local storage implemented and let's assume that it works fine.

    However what happens when i have say 10 people using my game, and they all do the following at the same time:

    This is one of the steps of actions from implementing local storage from your link:

    Use the action Set item "score" to 100, 50, 60, 40 etc. depending on the number of users.

    Then that item score, which is different for each user because of local storage, is set to a variable score, which is only one in the game.


    Thus will that single variable score be constantly overwritten by each user's key item "score"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If a different person visits the url in a different browser then it will be a different save.

    If a different person visits the url in the same browser then it will be the same save.

    This is unless you implement a login system.

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