Looking for a way for me and my friend to work on a project together

Hello gangsters,

Me and my friend have been working on a project for quite some time. However things have significantly slowed down due to the fact that the way we share the project is quite a tedious and time consuming one. We have to download and upload the full build to dropbox every time we want to work on it, we don't work on it at the same time due to the fact that that is impossible to do without creating sync issues. We instead choose work on it alternately because this is much easier to manage. We are looking to cut out the system of downloading the nearly 1.4 GB file and reuploading it every time we want to make even the slightest adjustments. I have so far heard about using GitHub but how this is done with a project like RPG Maker where you need to launch the engine to work on it, I have hardly a clue. I have also thought about a virtual machine that we can both use to work on the project on there, but this would cost money as far as I have seen

Thank you in advance
you don't have to upload the entire project every time - only the changed files.
and as long as you agree to work on different parts, that does not have to happen until the other one needs those different parts.

example: you agree that one of you works with maps 1-10 and the other works with maps 11-20. upload a master with 20 (empty) maps and each works on their own maps, only upload after all maps are completed and you need to work out the connections.

or if one is mapping and the other works on the database, you only need to upload the database when the other needs new items you added.

other than that, you only need the engine locally - so again only upload the changed files. github only is better because it can automatically compare filechanges, but there is no problem with that if you manually chack file date and time.
you don't have to upload the entire project every time - only the changed files.
and as long as you agree to work on different parts, that does not have to happen until the other one needs those different parts.

example: you agree that one of you works with maps 1-10 and the other works with maps 11-20. upload a master with 20 (empty) maps and each works on their own maps, only upload after all maps are completed and you need to work out the connections.

or if one is mapping and the other works on the database, you only need to upload the database when the other needs new items you added.

other than that, you only need the engine locally - so again only upload the changed files. github only is better because it can automatically compare filechanges, but there is no problem with that if you manually chack file date and time.
Me and my friend don't really work this way, we only need to make maps once every few weeks since we work through the areas in the game individually, we would much prefer a way that we can both work on the project from the same "place" if that makes sense
You can setup one pc to be used as the "dev pc" which will have the maker program and all the project files, then add any remote service to it (Anydesk, teamviewer, windows remote, etc) that way both can work on the same project in 1 pc someone will be running local and the other can just "log in" and work as needed.
I have so far heard about using GitHub but how this is done with a project like RPG Maker where you need to launch the engine to work on it, I have hardly a clue.
A version control system like git is desgined precisely for a team of people working on the same files. (Note that the VCS is called git; GitHub is just the most popular website to sync the git data between team members)
At the end of the day you are creating .json files with RPG Maker. The VCS does not care whether you typed the files with a text editor or used some fancy GUI (like the Maker). It will do its job regardless.
Its a good idea to use a version control system such as git when working on large software projects.
Git allows you to store only the changes between each version of your project, meaning that instead of uploading several GB each time a large project is changed, it will only upload the tiny difference between those versions.

Github is a fine choice for this although you can use any of the other git hosting websites.

Im assuming youre a complete novice at this so bare with me for a second because this is a little complicated, but I promise the workflow will be intuitive after the setup is complete.

There are two parts to this. First you'll need to set up an account and a new repository on github (or another site if you choose).
Once you create your account click this button to make a new repository.
It should give you all the info you need, it doesnt matter if its public or private, but if its private you'll need to add your friend's account as a contributor.
1668193033658.png


Next you're going to want to install git from here: https://git-scm.com/downloads

The installer is a little blotted so Ill paste my settings here:
1668192297515.png

You can install the gui, or use github desktop as a gui, its up to you. Hopefully you shouldnt have to worry about conflicts if you set things up correctly, in which case the bash option should be totally fine.
1668192372478.png

I personally like vscode for projects like this, but just make sure that you set this to a visual text editor like vscode or notepad and not vim which I believe is the default.

Most of the rest of the options are fine at the default.
For this it just makes it easier to do a few extra things:

1668192507850.png

Go ahead and finish the install with the other defaults.

That should now give you this right click option in finder:
1668192626604.png


Now you can open a git bash in the project folder for your game.
Once that terminal is open you can set up your repository like this:

Initialize the local directory as a Git repository.

Code:
git init

Add the files in your new local repository. This stages them for the first commit.

Code:
git add .

Commit the files that you've staged in your local repository.

Code:
git commit -m 'First commit'

Back on the page for the repository you created, in the banner, copy the remote repository URL.
1668193551715.png

Paste it into this next command, which should prompt you for your github username and password.

Code:
git remote add origin <remote repository URL>

Set the new remote:

Code:
git remote -v

Push the changes in your local repository to GitHub.

Code:
git push origin main


Okay! Thats a lot of setup! I apologize deeply for computers and the software industry.

Now you're probably wondering how you actually use git from here.

Well luckily this part is fairly straightforward.

When you make changes to your project that you're satisfied with there are 3 steps from the command line, which we already went through when setting up. (or you can do this from githubs desktop client or another visualizer


Code:
git add .
This adds all the files from your repo. There's more you can do here if you only want some of your changes, but you don't really need to worry about it.

Code:
git commit -m 'some message about what you did'
Commit the files along with a message explaining your changes, this is helpful for knowing what was changed.

Code:
git push
This will push up all of your commits to the remote repository on githubs website
From here your friend can download your changes with

Code:
git pull

Now this is all well and good, but in the case of RPGMaker MV there are a few improvements we can make to prevent some issues caused by the program.
I'll write another post in a bit explaining my personal setup for handling those.
So RPGMaker MV handles its json data in a way that doesnt lend itself very well to version control.
This is because systems like git look at the differences between lines, and MV compresses many of its files down by putting a lot of data on the same line.
This makes it hard for git to know when there are conflicting changes, ie you and your friend have edited the file, but different parts of it.

Another very annoying issue is that MV makes the same changes to a few files everytime you open it, even if you didnt really do anything. Namely it keeps track of where you were scrolled to on maps and it keeps a (useless) version number updated in System. These things tend to always cause conflicts if you both make changes and then try to push, even if those changes are in different parts of the game and should be merged just fine.

To get around this I use a script which runs during the git commit process, which I adapted from this thread and made some improvements to: https://forums.rpgmakerweb.com/inde...lean-git-commit-diffs-using-git-hooks.108122/
(maybe I should post it there too, I kinda forgot oops)

On top of everything above you'll need to install node for this if you dont already have it: https://nodejs.org/en/download/

JavaScript:
#!/usr/bin/env node

const data_directory = "data"
let command = '';
const fs = require('fs')
const { exec } = require('child_process');
const { parse } = require('path');
try {
    console.log("Running cleanup...");
    fs.readdir("data", function (err, files) {
        //handling error
        if (err || files.length <= 0) {
            console.error(err)
            process.exit(1)
        }
    
        files.forEach(file => {
            // Load file, pretty the JSON, and write it back
            const json = fs.readFileSync(`${data_directory}/${file}`)
            const parsed = JSON.parse(json);
            // Keep scroll static, this changes every time you view a file
            // and will cause conflicts
            if(file == 'MapInfos.json') {
                parsed.forEach(obj => {
                    if(obj && obj.scrollX) {
                        obj.scrollX = 0
                        obj.scrollY = 0
                    }
                });
            }
            // Keep version static, this changes each time you save a file
            if(file == 'System.json') {
                parsed.versionId = "latest"
            }
            fs.writeFileSync(`${data_directory}/${file}`, JSON.stringify(parsed, null, 2))
            command += ` ${data_directory}/${file}`
        })
    
        // Add the file back to the staging since it changed
        exec(`git add ${command} -f`, (err, stdout, stderr) => {
            if (err) {
                console.error(err)
                process.exit(1)
            }

            console.log(`stdout: ${stdout}`)
            console.log(`stderr: ${stderr}`)
            process.exit(0)
        })
    
    });
} catch (err) {
    console.error(err)
    process.exit(1)
}

As it says in the thread I linked, copy this code into the ".git/hooks" folder in your project directory with the file name "pre-commit" (no file extension).
Your friend will need to do this in his version of the project as well.

This will now run each time you make a commit, but if you want to be able to see your status you can run it directly with
Code:
node ./.git/hooks/pre-commit
So RPGMaker MV handles its json data in a way that doesnt lend itself very well to version control.
This is because systems like git look at the differences between lines, and MV compresses many of its files down by putting a lot of data on the same line.
This makes it hard for git to know when there are conflicting changes, ie you and your friend have edited the file, but different parts of it.

Another very annoying issue is that MV makes the same changes to a few files everytime you open it, even if you didnt really do anything. Namely it keeps track of where you were scrolled to on maps and it keeps a (useless) version number updated in System. These things tend to always cause conflicts if you both make changes and then try to push, even if those changes are in different parts of the game and should be merged just fine.

To get around this I use a script which runs during the git commit process, which I adapted from this thread and made some improvements to: https://forums.rpgmakerweb.com/inde...lean-git-commit-diffs-using-git-hooks.108122/
(maybe I should post it there too, I kinda forgot oops)

On top of everything above you'll need to install node for this if you dont already have it: https://nodejs.org/en/download/

JavaScript:
#!/usr/bin/env node

const data_directory = "data"
let command = '';
const fs = require('fs')
const { exec } = require('child_process');
const { parse } = require('path');
try {
    console.log("Running cleanup...");
    fs.readdir("data", function (err, files) {
        //handling error
        if (err || files.length <= 0) {
            console.error(err)
            process.exit(1)
        }
   
        files.forEach(file => {
            // Load file, pretty the JSON, and write it back
            const json = fs.readFileSync(`${data_directory}/${file}`)
            const parsed = JSON.parse(json);
            // Keep scroll static, this changes every time you view a file
            // and will cause conflicts
            if(file == 'MapInfos.json') {
                parsed.forEach(obj => {
                    if(obj && obj.scrollX) {
                        obj.scrollX = 0
                        obj.scrollY = 0
                    }
                });
            }
            // Keep version static, this changes each time you save a file
            if(file == 'System.json') {
                parsed.versionId = "latest"
            }
            fs.writeFileSync(`${data_directory}/${file}`, JSON.stringify(parsed, null, 2))
            command += ` ${data_directory}/${file}`
        })
   
        // Add the file back to the staging since it changed
        exec(`git add ${command} -f`, (err, stdout, stderr) => {
            if (err) {
                console.error(err)
                process.exit(1)
            }

            console.log(`stdout: ${stdout}`)
            console.log(`stderr: ${stderr}`)
            process.exit(0)
        })
   
    });
} catch (err) {
    console.error(err)
    process.exit(1)
}

As it says in the thread I linked, copy this code into the ".git/hooks" folder in your project directory with the file name "pre-commit" (no file extension).
Your friend will need to do this in his version of the project as well.

This will now run each time you make a commit, but if you want to be able to see your status you can run it directly with
Code:
node ./.git/hooks/pre-commit
Sorry for the delay but I just wanted to thank you, we have been using this for 2 days approximately and has been working perfectly. Thank you for taking the time to explain this to me
Great! Im glad it wasn't information overload. If you have any questions about merge conflicts or other git workflow nonsense don't be afraid to ask and I can try to help out

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-a-way-for-me-and-my-friend-to-work-on-a-project-together.152620/