切换到 中文文档
This project is designed for a category of web-based idle games, typically open-source projects. These games are usually written using pure frontend technologies and require no backend API support. They can run almost completely offline after the page loads. Game saves are typically stored in the browser's Local Storage. Representative examples of such games include: Evolve, A Dark Room, etc.
The purpose of this project is to provide remote save support for such games. It allows players to use their saves across multiple devices, enabling them to continue their progress when switching computers, and avoiding the hassle and confusion of manual save import/export.
The project consists of Server-side and Client-side code.
-
Server-side: Written in C#, targeting .NET 8 platform. Uses SQLite as the database. Recommended to run via Docker.
-
Client-side: Written in native JavaScript without additional frameworks. Supports two modes: embedding into game webpages or enabling via Tampermonkey.
-
Embedding into game webpage
You need access to the game's source code or compiled files. Modify the game's entry file (usually index.html) to include this project's JS file and add configuration code. Then deploy the game using an HTTP server.
Advantage: Any computer accessing the game server can use it without additional setup.
Limitation: You must be able to modify the game's deployment code. -
Using Tampermonkey script
Install the Tampermonkey extension in your browser (Chrome, Edge, etc.). Create a new script, paste this project's JS code, and add configuration code. Repeat this setup on every machine used for gaming.
Advantage: No need for game modification/deployment permissions; works with any game server (e.g., official servers).
Disadvantage: Every gaming computer must be configured individually.
-
Download from releases page.
On the machine serving as the remote save server (could be your local machine):
sudo docker load -i wgs-1.0.tar
sudo mkdir /wsg-db
sudo docker run -d -p 80:80 -v /wsg-db:/data -e TZ=Asia/Shanghai --name=wgs --restart=always wgsModify directories, timezone, ports, etc., as needed.
Then open a browser and visit http://{server_ip_or_domain}:{port}/install to create the database structure. This step only needs to be performed once.
-
Method 1: Embed into game code
Taking Evolve as an example:- Create a
wgsdirectory in the game code directory. - Copy
saver.jsand the game config fileevolve.jsinto this directory. - Add the following code before the closing
</body>tag in the game's index.html:
<script src='wgs/saver.js'></script> <script src='wgs/evolve.js'></script> <script> configSaver_Evolve('http://[your_Server]:[port]') </script>
Sample reference: inject.index.html
- Create a
-
Method 2: Use Tampermonkey
Taking Evolve as an example:- Create a new script in Tampermonkey.
- Modify the header as follows:
// ==UserScript== // @name Web Game Saver // @name:zh-CN 游戏进度远程保存 // @namespace https://github.com/sslyc // @version 2024-12-13 // @description Saving & loading game profile to/from remote server. // @author sslyc // @match *://pmotschmann.github.io/Evolve* // @exclude *://pmotschmann.github.io/Evolve/wiki* // @icon https://pmotschmann.github.io/Evolve/evolved-light.ico // @grant GM_xmlhttpRequest // @grant unsafeWindow // @connect * // @run-at document-end // @sandbox none // ==/UserScript==
Adjust
@matchand@excludeas needed.
3. Paste the script content:{Paste saver.js content here} {Paste evolve.js content here} (function() { 'use strict'; configSaver_Evolve('http://[your_Server]:[port]', true) })();
Sample reference: tampermonkey.script.js
- Press
Ctrl + Alt + Sto open the manual save interface. - Press
Ctrl + Alt + Lto open the manual load interface. - Press
Ctrl + Alt + Ato open the auto-save load interface.
When using Tampermonkey, permission prompts may appear on first use. Select "Always Allow".
First-time login format:
user:password[@{machine}]
- URL-encode special characters in username/password (e.g.,
@,/,:) @{machine}is optional. If provided:- Enables auto-save feature
- Creates a new auto-save slot for each machine name
- Saves automatically every minute, overwriting the machine-named slot
Examples:
doggy:123456tom:654321@home-pcjerry:123%40456@office-pc
Password Policy:
- UserID =
MD5('{password}7j7gp1ECga2cX6npj2n3VVm25rwwp89j{name}')(uppercase) - Passwords cannot be modified after initial setup
- Changing devices requires identical username/password combination
- There is NO password recovery mechanism
If password is forgotten:
- Compute new UserID using desired credentials
- Manually update SQLite database:
- Modify
UserIdinUserstable - Update all corresponding
UserIdvalues inProfilestable
- Modify
- Re-login on all devices
-
Clear Account Info:
- Via console: Execute
ssGameSaver.clear()in browser console - Via Local Storage: Delete
ss-web-saver-user-idandss-web-saver-machine
- Via console: Execute
-
Switch Account:
Deletess-web-saver-user-idandss-web-saver-machinein Local Storage, then re-login -
Enable Auto-Save:
Setss-web-saver-machinein Local Storage to your machine name -
Disable Auto-Save:
Deletess-web-saver-machinefrom Local Storage
Contributions to support more web games are welcome!
How to contribute:
- Analyze your favorite game's source code to identify save/load methods
- Fork this repository
- Create new config/test files under
src/client/games/ - Implement:
- Game name identification
- Save data extraction for server upload
- Save data injection for loading
- Base64 encode/decode if game uses binary saves
- Submit Pull Request