Inactive Dragon Heaven Client

Rezzo

(EVIOLITE COMPATIBLE)
is a Pre-Contributor
Instructions for setting up a Dragon Heaven Client/Server environment
Note well that this is for testing with the *full* DH setup. If you just want to fix and fiddle with movesets, abilities and tiering data then you will likely want to fork the Dragon Heaven Server repo and work from that. This post covers using your own local client for testing, alongside the added functionality that the custom battle simulator and teambuilder utilise on DH.

I'm working on Windows implementing this, so all instructions will be Windows-focused. If you're using Mac or Linux it'll be mostly the same. This instructions guide will not go into details about how to actually develop for DH. Please reach out to the Pet Mods Discord server for help regarding that.

1. Download and install Git; run Git Bash in your working folder

First thing you'll want to do is download and install Git from here. Once that's finished, you can set up yourself a folder in some space for developing. Anywhere is fine, though to keep things simple I will be using 'Documents\Projects' for this example. Create a new folder inside of your Documents folder named "Projects" if you'd like to follow along entirely.

Now browse 'Start > Git > Git Bash'; this will open a new window where we will be using Git commands to set up our projects. We will be browsing to the Projects folder from here - mine looks something like 'F:/Sean/Documents/Projects' however yours will likely look different.

Bash:
cd C:/path/to/your/folder
This is very likely to be C:/Users/(your username)/Documents/Projects, however you can also find the full filepath of Projects by right-clicking it, selecting "Properties" and viewing the 'Location:' value like below:

Screenshot_372.png


And thus in my example I use the following command:

Bash:
cd F:/Sean/Documents/Projects
Git Bash should then update to show that you're running commands from the Projects folder.

2. Clone Dragon Heaven Client and Server repositories

Next command to run in Git Bash is the following:

Bash:
git clone https://github.com/scoopapa/pokemon-showdown-client.git dh-client
This command copies the DH client's source code into your Projects folder, into a new folder named 'dh-client'. It might take a minute or two to finish so go make yourself a cup of tea, a couple of yoga stretches... maybe a ladder match while this updates.

If you haven't already, you will need to create a fork on your GitHub account of the DH server repo, which you can do by selecting the "Fork" option near along the rightside of the top banner.

Once this is finished, enter the following command:

Bash:
cd dh-client/data
And then:

Bash:
git submodule add location/of/your/forked/DH/repository.git DH
So for my for my instance as en example, I ran:

Bash:
git submodule add https://github.com/Rezzo64/DH.git DH
This clones the DH server source code into the working location of the client. Once you've finished this guide, you'll be able to make all of your changes from the DH folder once you've finished these instructions (it maintains its own Git structure and commit history).

Just one more command for now to run before we go onto the next step:

Bash:
git rm pokemon-showdown
This command removes an empty folder which we don't need for our setup.

3. Re-point dh-client build files

From here we will modify the client's files to look through our nested DH server repo in the data folder. Ideally you'll want some method of opening text files with line counts - Notepad++ is a good bit of software for just that.

Open the file at dh-client/build-tools/build-indexes. We will be commenting out lines 11, 12, 13, 14, and 15. The end result should look like this:

JavaScript:
// if (!fs.existsSync('data/pokemon-showdown')) {
//     child_process.execSync('git clone https://github.com/scoopapa/DH.git pokemon-showdown', {
//         cwd: 'data',
//     });
// }
Doing the above keeps your DH folder nested inside of 'data' as your main working folder (and means that you don't need to commit and push changes after every local edit).

There are more lines that need editing in this file. Essentially, every instance of '...data/pokemon-showdown...' must be transformed into '...data/DH...'. This needs to be done on lines 18, 19, 22, 1299, 1323, 1338, 1353, 1368, 1378, 1388, 1398, 1408, 1419, 1425.

If you're using Notepad++ or a similar software, you can use the Replace function (press Ctrl + H) to make this easier. Enter the following values and click 'Replace All':

Screenshot_374.png


This also needs to be done to the build-tools/build-learnsets and build-tools/build-minidex files.

- build-learnsets needs line 21 changed
- build-minidex needs line 9 changed

You will also need to change your testclient.html file. Edit line 15 to match the following:

HTML:
        <script src="config/config.js"></script>
Finally you need to change some details in 'config/config.js'. Edit lines 22 and 23 inside of the Config.defaultserver variable to the following:

JavaScript:
    host: 'localhost',
    port: 8000,
Save and close these five files once you're done.

4. Build and deploy DH server and DH client

Inside your Git Bash window, run the following commands:

Bash:
cd DH
node pokemon-showdown
Allow this to complete - you will eventually see a message similar to "worker 1 now listening on..." which indicates the process has ran through to the end.

Once it's finished, open another Git Bash window (don't close the old one) and cd to your dh-client folder. Run the following command:

Bash:
node build full
Just wait for this to complete as well. If it runs through successfully, you're all done and you should now be able to access the custom client locally by opening the testclient.html file in your web browser. My example allows me to do this by putting the below link into my web browser:

Code:
file:///F:/Sean/Documents/Projects/dh-client/testclient.html?~~localhost:8000
Adjust the above to correctly locate your file, noting that you will need to append the end of the URL with: ?~~localhost:8000

If all the above has worked, you should have a good setup ready for testing changes to DH. You may want to doubly make sure this works first by changing something minor like the type of a Pokemon. Restart the DH server by opening the Git Bash window running your server instance, pressing Ctrl + C, and re-entering the command 'node pokemon-showdown' as before. If you've done the above correctly you will see the changes upon browsing back to testclient.html

Elaborations

Just a section for those more technically inclined on how you can get the most out of this setup:

This setup allows you to test changes directly in your dh-client/data/DH folder as its own repo while treating it as the primary working space for DH at the same time. Changes don't need to be committed and cloned into the data/DH folder for testing, though some types of changes to DH might require a rebuild of the dh-client.

I've changed the name of the scoopapa/pokemon-showdown-client to dh-client upon cloning as to not interfere with any forks that users may have of the official showdown client. Of course, you also can fork the dh-client as well and clone from here as a starting point for this guide, however unless you are planning to test changes with the client itself this is an unnecessary step. I also recommend against doing this and pushing to the forked client to keep your own configurations unless you are comfortable with Git, as retracing these instructions is a better method and means you are always working off of a clean clone of the final dh-client.

If you aren't already, you may want to use VS Code for making your changes to DH from here on. Vscode will aid in making code changes but it will allow you to run DH locally from its own command terminal as well as gain easy access to the testclient.html file for when you're ready to start viewing your changes.

Anything else, just head over to the Pet Mods Discord and we'll help you out!
 
Last edited:
I'll be looking out for this server, I am making a showdown mod and this may be a good candidate to host it, what do I need to do to use Dragon Heaven for my mod
 

Rezzo

(EVIOLITE COMPATIBLE)
is a Pre-Contributor
I'll be looking out for this server, I am making a showdown mod and this may be a good candidate to host it, what do I need to do to use Dragon Heaven for my mod
You'll need to fork https://github.com/scoopapa/DH to your own GitHub repository, and submit your changes as pull requests for the repo owners to approve.

Please also join the Pet Mods Discord so that we can know it's you making your first pull request https://discord.gg/qQEf7ym

We can also help you out over there with further questions if needed.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top