diff --git a/README.md b/README.md index 93e87e6..e40d729 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,13 @@

- Play now + Play online (beta) + Play the free edition +

+ +

+ 🌐 Online edition (beta): Play Together with friends, optional accounts  ·  + ▶ Free edition: the whole game, offline, no account

@@ -32,7 +38,8 @@ Parents & teachers · Controls · Run it yourself · - Roadmap + Roadmap · + Community

--- @@ -371,8 +378,8 @@ src/noise.js Seeded Perlin noise and hashes | Edition | What | How it's updated | |---|---|---| -| **Free** ([GitHub Pages](https://dynamic-web-lab.github.io/MiniCrafter/)) | The whole game, offline-ready, no server features. It will be retired once the online edition launches. | Automatically from `main` | -| **Online** (our own server) | The same game plus server features: Play Together now, then accounts (register / log in). Those features need a login. | `tools/deploy-site.sh` | +| **🌐 Online (beta)**: [portal.dynamicweblab.com](https://portal.dynamicweblab.com/) | The same game plus server features: Play Together and optional accounts (Play Together needs a login). | `tools/deploy-site.sh` | +| **▶ Free**: [GitHub Pages](https://dynamic-web-lab.github.io/MiniCrafter/) | The whole game, offline-ready, no account and no server features. It links to the online edition, and will be retired once the online edition launches. | Automatically from `main` | The online features switch on through `site-config.json`: the copy in Git keeps them off, and the deploy script uploads an "on" version to our site. The relay ([`server/`](server/README.md)) only accepts the site that hosts the game. @@ -382,6 +389,12 @@ Next up are flowing water and slides, marble runs, music boxes, smoother tablets Have an idea? [Open an issue](https://github.com/Dynamic-Web-Lab/MiniCrafter/issues). +## 💬 Community + +Join us on **[Discord](https://discord.gg/RPWMmJSJqd)** to share builds, report bugs, suggest features and follow the beta. + +> **For parents, teachers and players aged 13+.** Discord requires users to be at least 13, and it is open chat, so the game itself never links to it. Younger players: ask a grown-up to share your ideas for you, or use the **💬 feedback** in the game. + ## 🙏 Credits Built by [Dynamic Web Lab](https://dynamicweblab.com) and released under the [MIT License](LICENSE). Made with [three.js](https://threejs.org/) and [Blockly](https://developers.google.com/blockly). MiniCrafter is an original game inspired by block-building sandboxes, with its own code, art and sounds. diff --git a/index.html b/index.html index f0a77e2..761829e 100644 --- a/index.html +++ b/index.html @@ -78,6 +78,7 @@

MiniCrafter

Generating world…

+
World
—
diff --git a/site-config.json b/site-config.json index 3eaddb8..6691512 100644 --- a/site-config.json +++ b/site-config.json @@ -1 +1 @@ -{ "online": false } +{ "online": false, "onlineUrl": "https://portal.dynamicweblab.com/" } diff --git a/src/main.js b/src/main.js index ee8d002..9df1871 100644 --- a/src/main.js +++ b/src/main.js @@ -964,6 +964,8 @@ $('btn-together').addEventListener('click', openTogether); $('btn-together').classList.add('hidden'); loadSiteConfig().then(() => { $('btn-together').classList.toggle('hidden', !SITE.online); + // The free edition links to the online edition for Play Together and accounts. + if (!SITE.online && SITE.onlineUrl) { $('btn-online').href = SITE.onlineUrl; $('btn-online').classList.remove('hidden'); } account.enabled = SITE.accounts; $('btn-account').classList.toggle('hidden', !SITE.accounts); if (SITE.accounts) account.refresh(); diff --git a/src/together.js b/src/together.js index 1b06884..0d8dc24 100644 --- a/src/together.js +++ b/src/together.js @@ -35,7 +35,7 @@ export function saveProfile(p) { try { localStorage.setItem(PROFILE_KEY, JSON.st // Online features (Play Together, and accounts later) only run on our own hosted site. // ./site-config.json says whether they're on: the copy in Git (and so on GitHub Pages) says // off, and tools/deploy-site.sh uploads an "on" version to our own site. -export const SITE = { online: false, rooms: '', accounts: false }; +export const SITE = { online: false, rooms: '', accounts: false, onlineUrl: '' }; const isDev = () => ['localhost', '127.0.0.1'].includes(location.hostname); export async function loadSiteConfig() { @@ -43,6 +43,7 @@ export async function loadSiteConfig() { const r = await fetch('./site-config.json', { cache: 'no-cache' }); if (r.ok) { const c = await r.json(); + if (c && typeof c.onlineUrl === 'string' && /^https:\/\/[\w.-]+\/$/.test(c.onlineUrl)) SITE.onlineUrl = c.onlineUrl; // free edition: where the online one is if (c && c.online === true && typeof c.rooms === 'string' && /^\/[\w/-]*$/.test(c.rooms)) { SITE.online = true; SITE.rooms = c.rooms; SITE.accounts = c.accounts === true; } } } catch { /* offline or no config: free edition */ } diff --git a/style.css b/style.css index d2463f9..f9fc014 100644 --- a/style.css +++ b/style.css @@ -450,3 +450,8 @@ label.check input { width: 22px; height: 22px; flex: none; margin: 0; accent-col .legal-links a, .acc-privacy a { color: #9cc3ff; } #account a { color: #9cc3ff; } #account .hint { color: #9aa3b5; font-size: .85em; } + +/* Free edition: link to the online edition */ +a.online-link { display: block; text-align: center; text-decoration: none; color: #fff; padding: 8px 14px; border-radius: 6px; border: 2px solid #3b82f6; background: #24324f; font-weight: 600; margin-top: 8px; } +a.online-link:hover { background: #2c3d60; } +a.online-link small { display: block; font-weight: 400; color: #9cc3ff; } diff --git a/sw.js b/sw.js index cd41f84..62e8a4a 100644 --- a/sw.js +++ b/sw.js @@ -1,6 +1,6 @@ // Service worker: caches the whole game so it works offline once loaded. // Bump VERSION whenever files change so players get the update. -const VERSION = 'minicrafter-v24'; +const VERSION = 'minicrafter-v25'; const CORE = [ './', './index.html', './style.css', './privacy.html', './terms.html', './legal.css', './manifest.webmanifest', './site-config.json', './icons/icon-192.png', './icons/icon-512.png', './icons/icon-maskable-512.png', './icons/apple-touch-icon.png', './icons/favicon-32.png',