Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
</p>

<p align="center">
<a href="https://dynamic-web-lab.github.io/MiniCrafter/"><img alt="Play now" src="https://img.shields.io/badge/%E2%96%B6%20Play%20now-in%20your%20browser-4a9132?style=for-the-badge"></a>
<a href="https://portal.dynamicweblab.com/"><img alt="Play online (beta)" src="https://img.shields.io/badge/%F0%9F%8C%90%20Play%20online-with%20friends%20(beta)-2b6cb0?style=for-the-badge"></a>
<a href="https://dynamic-web-lab.github.io/MiniCrafter/"><img alt="Play the free edition" src="https://img.shields.io/badge/%E2%96%B6%20Free%20edition-no%20account-4a9132?style=for-the-badge"></a>
</p>

<p align="center">
<b>🌐 <a href="https://portal.dynamicweblab.com/">Online edition (beta)</a></b>: Play Together with friends, optional accounts &nbsp;·&nbsp;
<b>▶ <a href="https://dynamic-web-lab.github.io/MiniCrafter/">Free edition</a></b>: the whole game, offline, no account
</p>

<p align="center">
Expand All @@ -32,7 +38,8 @@
<a href="#-for-parents-and-teachers">Parents &amp; teachers</a> ·
<a href="#-controls">Controls</a> ·
<a href="#-run-it-yourself">Run it yourself</a> ·
<a href="#-roadmap">Roadmap</a>
<a href="#-roadmap">Roadmap</a> ·
<a href="#-community">Community</a>
</p>

---
Expand Down Expand Up @@ -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.

Expand All @@ -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.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ <h1>MiniCrafter</h1>
<p id="loading">Generating world…</p>
<button id="btn-play" class="primary">▶ Play</button>
<button id="btn-together" class="wide-btn together-btn">👫 Play Together <span id="tg-menu-state"></span></button>
<a id="btn-online" class="wide-btn online-link hidden" href="#" target="_blank" rel="noopener">🌐 Play online with friends <small>(beta: Play Together, accounts)</small></a>
<button id="btn-account" class="wide-btn hidden">👤 <span id="acc-menu">Log in or create an account</span></button>
<div class="section world-row">
<div><span class="note">World</span><div id="world-name">—</div><div class="note" id="world-info"></div></div>
Expand Down
2 changes: 1 addition & 1 deletion site-config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "online": false }
{ "online": false, "onlineUrl": "https://portal.dynamicweblab.com/" }
2 changes: 2 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/together.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ 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() {
try {
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 */ }
Expand Down
5 changes: 5 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
2 changes: 1 addition & 1 deletion sw.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Loading