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.