Player content (shared levels)
Let players share what they make in your game (levels, tracks, builds, replays, designs) with a short code that other players type or open. Gamealia stores it, lists it, counts plays and likes, and moderates it; your game only decides what data means.
// The player saves a level they built
const r = await Gamealia.content.create({ kind: "level", title: "Lava run", data: { tiles, start, goal } });
if (r.ok) showCode(r.code); // "7KX2M9P": the player shares it
else if (r.reason === "signin") showSignInButton();
// Another player opens it
const level = await Gamealia.content.get(typedCode);
if (level.ok) {
loadLevel(level.item.data);
Gamealia.content.increment(level.item.code, "plays");
}
// A browser of what others made
const page = await Gamealia.content.list({ kind: "level", sort: "top", limit: 20 });
for (const it of page.items) addCard(it.code, it.title, it.author.username, it.likes, it.plays);
Items and codes
| Field | What it is |
|---|---|
code | 7 characters of Crockford base32 (0-9 A-Z without I, L, O, U), unique in your game. get also accepts what players type: lower case, dashes, O for 0 and I/L for 1. |
kind | What it is in your game: 1 to 24 of a-z 0-9 _ - (level, track, build). Lists can filter by it. |
title | 1 to 60 characters. It goes through the same filter as the game chat: insults are masked with *, and links, e-mails, phone numbers and @handles are refused (blocked-content). |
data | Any JSON value, at most 64 KB as JSON text (compress big levels into a string yourself). Only get returns it; lists carry the rest. |
author | id (the player's id for your game, the same as Gamealia.user.get().id), username, avatarUrl. Never anything else. |
plays, likes | Counters (increment). liked: the signed-in player liked it. |
mine | The signed-in player made it. |
hidden | Hidden by reports while Gamealia reviews it: only its author sees it (with hidden: true). |
createdAt, updatedAt | Epoch milliseconds. |
Who can do what
- Anyone, guests included, can
getandlist, and count a play (increment(code, "plays")). - Signed-in players can
create,updateandremovetheir own items, like (increment(code, "likes"), once per player) andreport. Guests getreason: "signin": show a sign-in button (Gamealia.user.requestLogin()from a button the player pressed) and try again. - You, the developer, see every item of your game and can remove any of them: Dashboard → your game → Feedback → Player content.
- Gamealia reviews reported items and removes what breaks the requirements.
Limits
| Limit | Value |
|---|---|
data | 64 KB of JSON |
| Creates | 10 per player and game per hour |
| Updates | 30 per player and game per hour |
| Items kept | 100 per player and game (limit: remove one to make room) |
| Plays | Count once per player (or network, for guests) and item every 10 minutes; a repeat answers the current count |
| Likes | Once per player and item (again: already) |
| Reports | Once per player and item; 20 per player per day; 100 per game per hour |
| Calls | 60 content calls per minute per game session; list returns at most 50 items |
Over a limit, calls answer reason: "rate-limit" (or limit) instead of failing.
Moderation
There is no AI moderation. Titles go through the chat filter; players can report an item (spam, offensive, inappropriate, copyright, other). When 3 different players have reported it, the item is hidden from everyone but its author and goes to Gamealia's review queue. An admin either restores it (its reports are cleared; 3 new ones hide it again) or removes it. You can remove any item of your game at any time from the dashboard.
Give players a way to report from your item screen:
reportButton.onclick = () => Gamealia.content.report(item.code, "offensive");
Lists and pages
list({ kind, sort, mine, limit, cursor }):
sort: "new"(default): newest first.sort: "top": most likes, then most plays (up to 1000 items deep).mine: true: only the signed-in player's items, hidden ones included (guests:signin).limit: 1 to 50 (default 20).nextis the cursor of the next page,nullon the last one:
let cursor = null;
do {
const page = await Gamealia.content.list({ kind: "level", cursor });
page.items.forEach(addCard);
cursor = page.next;
} while (cursor && wantMore());
Results and reasons
Every call resolves (never rejects): create → { ok, code?, reason? }, get → { ok, item, reason? }, list → { ok, items, next, reason? }, update / remove / report → { ok, reason? }, increment → { ok, count?, reason? }. Reasons: signin, invalid (bad kind, title, code or cursor, or data that is not JSON), too-large, blocked-content, rate-limit, limit, not-found, forbidden (not the author), already, unavailable (offline, preview, autotest or an old portal).
Testing
In the mock (localhost, file: or ?gamealia_debug=1) the content lives in this browser's localStorage (key gml:mock-content), with one sample item, the same size and title checks and the 10-per-hour create limit, but no chat filter and no moderation. Sign in with Gamealia.user.requestLogin() first to create. In the preview and the autotest the calls answer unavailable; on gamealia.app they use the real store.
Unity and Godot
- Unity:
Gamealia.Content.Create(kind, title, dataJson, onDone),Get,List,Update,Remove,Increment,Report. Data travels as JSON text (dataJson), sinceJsonUtilitycannot hold any JSON. See Unity. - Godot 4 / 3.5:
content_create(kind, title, data),content_get,content_list,content_update,content_remove,content_increment,content_report. See Godot. - The Poki-style and CrazyGames-style compatibility shims have no equivalent call to map.