|
| 1 | +# GameMaker Quickstart |
| 2 | + |
| 3 | +This page walks you through building a GameMaker app for Devvit. Once complete, you'll see your GameMaker game running directly within a Reddit post. |
| 4 | + |
| 5 | +If you are already familiar with Devvit and want to jump straight to exporting, see the [Build and Deploy GameMaker Games to Devvit ](#build-and-deploy-gamemaker-games-to-devvit) section. |
| 6 | + |
| 7 | +## Try it out |
| 8 | + |
| 9 | +The template creates a simple GameMaker game and demonstrates data exchange between Reddit and GameMaker. |
| 10 | + |
| 11 | +<img src={require('../assets/quickstart_gamemaker.gif').default} alt="GameMaker example" style={{maxWidth: '40%', height: 'auto', display: 'block', margin: '0 auto'}} /> |
| 12 | + |
| 13 | +## What you'll need |
| 14 | + |
| 15 | +- Node.js (version 22.2.0+) |
| 16 | +- [GameMaker 2024.1400.3](https://releases.gamemaker.io/release-notes/2024/1400_3) or later (this version adds direct exporting to Reddit) |
| 17 | + |
| 18 | +## Environment setup |
| 19 | + |
| 20 | +1. Install Node.js and npm ([instructions](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)) |
| 21 | +2. Go to [developers.reddit.com/new](https://developers.reddit.com/new) and select the GameMaker template |
| 22 | +3. Complete the setup wizard (you'll need to create a Reddit account and connect it to Reddit Developers) |
| 23 | +4. Follow the instructions in your terminal |
| 24 | + |
| 25 | +On success, you should see something like this: |
| 26 | + |
| 27 | +```sh |
| 28 | +Your Devvit authentication token has been saved to /Users/user.name/.devvit/token |
| 29 | +Fetching and extracting the template... |
| 30 | +Cutting the template to the target directory... |
| 31 | + 🔧 Installing dependencies... |
| 32 | + 🚀🚀🚀 Devvit app successfully initialized! |
| 33 | +┌────────────────────────────────────────────────────┐ |
| 34 | +│ • `cd my-app` to open your project directory │ |
| 35 | +│ • `npm run dev` to develop in your test community │ |
| 36 | +└────────────────────────────────────────────────────┘ |
| 37 | +``` |
| 38 | + |
| 39 | +## Running your app |
| 40 | + |
| 41 | +To run your app, navigate to your project directory with `cd my-app` and run `npm run dev`. You should see logs that conclude with: |
| 42 | + |
| 43 | +``` |
| 44 | +https://www.reddit.com/r/my-app_dev?playtest=my-app |
| 45 | +``` |
| 46 | + |
| 47 | +Follow this link to see your app. |
| 48 | + |
| 49 | +## Build and Deploy GameMaker Games to Devvit |
| 50 | + |
| 51 | +For step-by-step export instructions, see the [GameMaker Reddit Template documentation](https://github.com/YoYoGames/GameMakerRedditTemplate/blob/main/docs/HowToBuild.md). |
| 52 | + |
| 53 | +## Communicate between GameMaker and Reddit |
| 54 | + |
| 55 | +GameMaker games communicate with Reddit through HTTP requests. The provided template includes working examples of this data exchange: |
| 56 | + |
| 57 | +- **GameMaker client code**: [reddit_demo_server_api.gml](https://github.com/YoYoGames/GM-RedditDemo/blob/main/source/Reddit_gml/scripts/reddit_demo_server_api/reddit_demo_server_api.gml) — Shows how to send requests from GameMaker to retrieve user data, save scores, and interact with Reddit features. |
| 58 | +- **Devvit server code**: [src/server/index.ts](https://github.com/reddit/devvit-template-gamemaker/blob/main/src/server/index.ts) — Handles incoming requests from GameMaker, accesses Reddit APIs, and stores data in Redis. |
0 commit comments