Skip to main content

Generate a Game

tip

Understand what UrTurn is and isn't.

Create Gameโ€‹

npx @urturn/runner init my-game # generates new game files
cd my-game
npm run dev # run the game locally

File/Folder structureโ€‹

game
โ”‚ package.json # npm package specification for dependencies for your room functions (includes @urturn/runner for local development)
โ”‚
โ””โ”€โ”€โ”€.github/workflows # contains important GitHub actions that create a build artifact for UrTurn to use
โ”‚
โ””โ”€โ”€โ”€src
โ”‚ โ”‚ main.js # room functions (e.g. onRoomStart, onPlayerMove, etc.)
โ”‚
โ””โ”€โ”€โ”€frontend # holds all the files related to your game frontend
โ”‚ package.json # npm package specification for dependencies on your frontend (includes @urturn/client)
โ”‚ ...your frontend files

GitHub Actions in .github/workflowsโ€‹

tip

No GitHub Actions experience needed!

We've already done the hard work for you. When you ran npx @urturn/runner init my-game, the correct github actions were created for you.

When you push to main branch of your repo on GitHub, the actions will automatically create the correct Artifact structure on the published branch, which you will use to deploy to production.