Skip to content

Beginner's Setup Guide

Devin Spikowski edited this page Jan 25, 2018 · 44 revisions

Requirements

If you want to run D-Zone for your Discord server, you will need the following:

  • A computer to run the node server
    • The computer you're on right now would be fine, or you can use a node.js hosting service.
  • A port available on the node server for the websocket
    • This means port forwarding on your router, like when you host a game server.
  • A web host or local host for the client files
    • Important: The page must be served over http, not https. SSL support is coming some time in the future.
    • People tend to get stuck on this one, please find a web host before proceeding.

This guide is written for Windows, but much of it should be the same on other systems.

First, you must install Node. I use the LTS release.

To check that you have installed Node properly, open a command prompt and type node -v. It should tell you what version you have just installed. Also run npm -v to ensure this too was installed. If you're getting errors, you may need to reboot. If that still doesn't work, google how to add node and npm to your PATH variable.

Installation

Click the big green download button on D-Zone's GitHub page to download the ZIP. Inside is a folder called d-zone-master, extract it where you want. Then open that folder, and in an empty space right click while holding Shift and choose "Open command window here". You could also browse to the folder manually in CMD if you know how. Then run this:

npm install

This will take a few minutes. You may see some warnings, this is okay. If you get an error and the package did not install, you may need to download the Visual C++ runtimes from Microsoft. You also may need Python 2.7 installed. If all goes well, you should now have a node_modules folder.

Configuration

Rename discord-config-example.json to discord-config.json and insert the login and server info for your Discord server(s). To get your bot's token, go here. If you aren't using a bot (you should use one), go google how to get your Discord token. If you don't know your server ID, look in Server Settings > Widget in Discord.

You must specify one default Discord server. You can include multiple servers here, and as long as your bot can connect to them, they will be available for clients to view. You can password-protect a server from being viewed by a client by using the password property (see notes). Check the Configuration reference for more info.

If you want an easier way to automatically include all servers your bot resides in, simply put your bot's token in discord-config.json and then run Update Configuration.bat. If you already have servers in your config with optional parameters, they will not be overwritten.

Rename socket-config-example.json to socket-config.json and insert the IP and port you want to run the websocket on. If you're going to run the server on your computer, this would be your IP. The port can be almost anything you want, but I recommend 3000. If you're behind a router, you may need to forward this port.

While in the same command prompt window (or in a new one, as long as it's pointed at your D-Zone folder) start the server with npm start or just node index.js

Uploading

The client files are all contained within the web folder, and need to be built with npm run-script build. After running that, you will have a file called bundle.js in /web/static. Upload everything in the web folder except the script folder to your web host. Do not remove the web folder from the package; the server component requires it.

Open a browser tab and visit the URL where you uploaded /web/index.html. If everything works, the client should connect to the default server, generate a world, and receive live updates via websocket from the server.

If you see "Upgrade required" then you are typing in the wrong URL. The websocket port is not to be visited in your browser! You simply need to visit the folder that you uploaded to your web host.

If it's stuck on "Connecting..." make sure that the port in your socket config is open.

You can tweak the message box parameters by editing misc-config.json. Check the Misc Config reference for details.

If you're having any other problems, you can catch me on Discord here: https://discord.gg/0MvHMfHcTKUvE2kC

Remember, this is still being developed! Check back for updates! 😀 To get the latest version, you will have to download and install a new instance in a new folder, copy over your configuration files, and build again.

Notes

Respect the privacy of the users in your Discord server. By creating a D-Zone for your server without a password, you are allowing anyone with the URL to view any conversations your bot has permission to see.

The build script creates a minified bundle file with no source mapping, while watch is not minified but is quicker to run and has source mapping. So, watch is good for development and build is good for deployment. If you have no idea what this means, use build

Clone this wiki locally