Online save files

0 favourites
  • 6 posts
From the Asset Store
Template for a generic save / load system, fully documented in comments and video
  • I've considered using my website to store player's save files (basically "cloud saves") so they can pick up where they left off on another computer, or have multiple save files that they can switch between.

    In Construct 2, a player's entire save file is stored as a Hash Table (using a 3rd-party plugin) that can save/load to a JSON string. On my website, I can store/load a string to/from a flatfile (using player's name as filename).

    How would I bridge the two? Here's what I envision:

    1. When user starts game, they are prompted to create an online save or play locally.

    2. At the main menu, they can press a button to create an account (upload local save to web), or log in (download remote save).

    3. If user is logged in, they will automatically upload their save when it changes.

    Downloading:

    1. Game sends username and password to server

    2. Server sends back JSON file with valid data if correct login, or blank otherwise

    3. Game reads file and prompts for re-login (if invalid) or loads save (if valid)

    Uploading:

    1. Game sends username, password, and JSON to server

    2. Server saves file if valid, or rejects if invalid (does not respond to server)

    If a local save exists, game uses that to load/save. If registration (name/pass) also exists, game will upload to that.

    Game will only download from server when logging in (or changing accounts).

    Is this possible? How do I send messages between the game and server?

    I am familiar with PHP, JavaScript, etc, so I expect a web developer's perspective.

  • Use Ajax plugin.

  • Ahh, I didn't see the LastData expression in there before.

    Does this plan sound feasible and doable, then?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • looks like a well thought plan and is absolutely doable with the standard plugins delivered with C2.

    As stctr said, Ajax is all you need for this (in addition to your server side scripts in PHP, Perl, or whatever)

  • Yes it is doable very easy.

  • Well, that felt a lot more painful than it needed to be, but I got it working! HUZZAH!

    If anyone feels like trying it out, you can do so at http://www.carnageinspace.com

    If anyone wants to make their own online save files, I'll freely provide snippets of the Construct and PHP code used to make it.

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