Companion repository and the server component of activity.gml
Prerequisites:
- Node.JS v20.9.0 (most recent versions should work)
- NPM v10.2.5
cloudflared
for local development
Setup (development)
- Clone this repository to your PC
- Copy
example.env
, name it.env
- Replace the following in
.env
DISCORD_CLIENT_ID
with your Discord applications client IDDISCORD_CLIENT_SECRET
with your Discord applications client secret- Other fields documented below
PORT
with any unused port (the default should be fine)GAMEMAKER_URL
is where GameMaker's inbuilt HTTP server hosts your game, ensure the port matches the one GameMaker usesENVORINMENT
should be set toDEV
on a local machine, andPROD
when in production
- Run
npm i
in the repository's folder - Run the application with
node ./server.js
It's a convoluted process, but it allows your HTML5 game to act as if it's hosted on this server without having to export it every time
Make sure to follow Discord's official guide for testing an activity locally as well to get your activity set up properly on Discord.
Setup (production)
- Copy
example.env
to.env
- Set the following items in
.env
DISCORD_CLIENT_ID
should be set to your application IDDISCORD_CLIENT_SECRET
should be set to Discord's OAuth 2.0 secretPORT
shoudl be any free port that the application will listen onGAMEMAKER_URL
can be left alone, it's not usedENVIRONMENT
should be set toPROD
- Build your GameMaker game for HTML5 as loose files, and place them in the
./static
folder. it should look like this
├───.env
├───example.env
├───server.js
└───static
├───html5game
└───index.html
- Start the server with
node ./server.js