Recipe

A game to share with your friends

For makers and tinkerers: describe the game you want, the agent builds it, and your friends play it from their own browsers with one score table between you.

Apps
Topics

You want a small game — a snake game, a quiz, a word puzzle — that you and your friends play, with one high-score table you all share, so the argument about who is best has an answer. Nobody sells exactly the game you have in mind. In this recipe the agent builds it as a creation in XataWorks, and you share it with your friends by their email addresses.

What you need

  • XataWorks, open, with the agent answering. If it is not yet, Getting started covers the one decision to make first.
  • A XataWorks account. Sharing a creation is part of XataWorks Pro; opening one somebody shared with you is not, so your friends need only an account to sign in with.

1. Describe the game

Say what it shows, what a player presses and what it keeps. For example:

Make me a snake game called Workshop Snake. Arrow keys steer. When the game ends, ask for the player’s name and keep their score in a high-score table that shows the top ten.

The agent writes every file of the creation, checks that it runs, and opens it in a new tab of the chat’s browser panel. A creation is an ordinary web page with its own files, and when it needs to keep records — the scores, here — the agent gives it a small database of its own. Building it asks you first; the question names the creation.

2. Play it, and change it by asking

Play a few rounds. Then ask for what is missing: “make the snake faster as it grows”, “add a pause key”, “show the top score while I play”. Each change is one step with a one-line summary, and every open tab of the game reloads to show it. If a change makes it worse, press Undo last change on the bar under the browser toolbar, or open Versions… and restore an earlier one. The scores are not part of the versions: going back changes the game, not the table.

If something misbehaves, ask the agent to check the game for problems. It reports the errors the page raised, with their file and line, and fixes them.

3. Lock it

When it plays the way you want, press Run on the same bar. In Run, agents can use the game but not change it, so a chat that is only looking at it cannot rewrite it by accident. Only you switch between Design and Run.

4. Share it with your friends

Open the Builder’s list of creations (View ▸ Builder ▸ All Creations), choose ⋯ on the game’s row and then Share…. Add each friend by email address at Can use, which lets them play and add their scores to the shared table. Can view would let them see the game and its data read-only.

Your friends open it in a web browser on their own device by signing in to a XataWorks account. Nobody changes the game’s files from a browser; only its data.

5. Keep it reachable

A shared creation runs from the computer that holds it, so it is only reachable while that computer is on with XataWorks running. If your desktop sleeps at night and your friends do not, move the game onto an always-on computer at home — a Raspberry Pi, a Synology NAS or an old laptop — and share it from there.

Where this recipe stops

  • Everything is in the game’s own files. A creation cannot load anything from the internet: no scripts, no web fonts, no outside services. The agent writes all of it into the creation.
  • Sizes are bounded. A file in a creation can be up to 5 MB, a whole creation up to 25 MB, and its database up to 100 MB — plenty for a game and its scores.
  • Players share the table, not the screen. Each friend plays their own round in their own browser, and their score lands in the one table everyone sees.

Read more

More recipes like this

Back to all recipes.