How to Create a Playground on RPGJS
Creating a playground on RPGJS is a straightforward process that allows you to experiment and share your RPG projects with the community. Here’s a step-by-step guide to get you started.
Step 1: Access the RPGJS Playground Creation Page
First, navigate to the RPGJS Playground creation page at https://playground.rpgjs.dev/create.
Step 2: Create a Markdown File for Your Playground
Your markdown file should include the following sections:
Title
Start with a title for your project.
Description
Under the "Description" subtitle, provide a detailed description of your project.
The title should remain "Description".
Structure
Use the "Structure" subtitle to outline the structure of your project. This should be a simple list that links to sub-sections containing specific code or to a GitHub repository. This can either be your own repository or the pre-built content available at https://github.com/rpgjs/prebuilt.
The title should remain "Structure".
Example Structure:
# Your Title
## Description
Your project description.
## Structure
- main
- [maps](https://github.com/rpgjs/prebuilt/tree/master/maps/base)
- [characters](https://github.com/rpgjs/prebuilt/tree/master/spritesheets/characters/base)
- [players.ts](#playerts)
- [rpg.toml](https://github.com/rpgjs/prebuilt/blob/master/config/rpg.toml)
## Files
### player.ts
import { RpgPlayer, type RpgPlayerHooks, Components } from '@rpgjs/server'
const player: RpgPlayerHooks = {
onConnected(player: RpgPlayer) {
console.log('Player connected')
}
}
export default player
Publish Your Playground
To publish your playground, copy your markdown file and post it on the RPGJS community forum with the "playground" tag: https://community.rpgjs.dev/t/playground. Your playground will then be accessible from the homepage.
Share Your Playground
To share your playground, click on "Copy Link." The link will be copied to your clipboard. You can then send it to someone or post it on the forum for an embedded link.
Forking a Playground
To fork an existing playground, click on "Fork." This allows you to start with an existing markdown and modify it. Changes are saved in your browser as soon as you modify the content.