Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,860
First Language
English
(Note: This tutorial was originally posted on HimeWorks and may not be up-to-date)

symlinks1-720x340.jpg


I write plugins that support both MV and MZ at the same time, mostly for personal convenience so that I don't need to maintain two different releases when it's basically the same code except maybe one has a little extra MZ-specific logic like registering a plugin command or something.

But for the most part, the majority of plugins I've been looking at are basically the exact same code.

So the question is, would it be possible to have the exact same folder structure for one project...but the contents of the project point to another project?

Example

For example, let's say I have two projects as follows

symlinks2-1024x422.jpg

So there's Project1 and then there's Project2. Two different projects, same folder structure.

Now in Project1, I have a Community_Basic plugin and a TitleSkip plugin.

symlinks3-1024x519.jpg

With Project1 open in the editor, when I go and add my plugins, I see the plugins, as expected. Nothing special, just usual RM things.

symlinks5-1024x390.jpg

In Project2, I have some different plugins, called "cool_stuff" and "other_thing".

symlinks4-1024x519.jpg

Now what if I wanted to use the cool_stuff and the other_thing in both projects?

How about a Shortcut?

So you might be familiar with shortcuts. You put a shortcut to a folder on your desktop so that you can quickly access a specific folder somewhere on your computer. We can try to create a shortcut by right-clicking and creating a shortcut, then calling it "plugins"

symlinks6.jpg

But it doesn't do anything. This is because it just creates a link that your computer uses to go to another file or folder.

symlinks7.jpg

Enter Symbolic Links

So most operating systems have something called symbolic links which is kind of like a shortcut...but a more powerful shortcut. There's a tool called "symlinker" which allows you to create symbolic links (or other types of links) using a GUI interface, which is nice if you don't want to deal with command-line. Or you can just use command-line directly. For this tutorial I will just use that program.

symlinks8.jpg

So I create a folder symbolic link inside Project1 called "plugins" which refers to the plugins folder in Project2.

This results in a plugins folder in Project1 that looks like a shortcut, and when you click on it, it will jump to the plugins folder in Project2

symlinks9-1024x512.jpg

However the biggest difference is, suddenly the editor is pulling the plugin data from Project2's plugins folder instead! If you look at the screenshot, I still have Project1's original plugin settings...but when I try to add new ones, it shows a different set.

symlinks10-1024x402.jpg

In Summary

Now I can manage all of my plugins for two different projects in the same folder, and the changes I make to one project, will automatically be reflected in the other project because they're all pointing to the same files.

This technique could be used for other resources as well, such as audio, images, and so on. Since MV and MZ use basically have the same specifications, I can just have one copy of all my resources and share them between different projects!

This can be a useful technique depending on your needs. For most devs it probably won't be too useful, but if you're in a specific situation where you wanted to test in different environments, it save a lot of effort.
 
Last edited:

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,821
Reaction score
4,754
First Language
English
Primarily Uses
RMMZ
Very nice tutorial! This might come in very handy!
 

Kupotepo

Fantasy realist/Advocatus Diaboli
Veteran
Joined
Jul 5, 2017
Messages
1,958
Reaction score
2,089
First Language
Thai
Primarily Uses
RMMV
I am still confuse but in time I will understand. So this tutorial is about redirect the plugins folder of another project to the intended project?
Ahmmm, Hime, can this be done the same in other resources like image folder correct?
Most importantly, if it can be done with the generator part folder would be great appreciated by me.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,860
First Language
English
I am still confuse but in time I will understand. So this tutorial is about redirect the plugins folder of another project to the intended project?
Ahmmm, Hime, can this be done the same in other resources like image folder correct?
Most importantly, if it can be done with the generator part folder would be great appreciated by me.

Ya basically you would just have your audio or img folder point to another folder using that symlinker tool.

Or if you wanted only bgm folder or pictures folder to be shared, just set it up for only those subfolders.

It's the same idea: you just change what the files/folders point to on your hard drive. Might work for network resources as well but I haven't tested since I don't have that kind of set up.

It'll probably work the same way for the generator folder if MV and MZ generator tool uses the same folder structure.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
543
Reaction score
238
First Language
English
Primarily Uses
RMMV
Do you happen to know the command-line command (assuming one exists) to make a symbolic link on Windows? I know it's "ln -s source destination" on UNIX-like systems (including Mac) but I have no idea if that would work in Windows.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,548
Reaction score
3,301
First Language
Binary
Primarily Uses
RMMZ
Pretty clever solution. I wonder how it works when deploying the game though? does it just pull the plugin files like normal and bundle them into the exported project?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
543
Reaction score
238
First Language
English
Primarily Uses
RMMV
That's actually a very good question, as there's two possible ways it could work, one of which would create a deployed project that works only on your own computer.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,860
First Language
English
Do you happen to know the command-line command (assuming one exists) to make a symbolic link on Windows? I know it's "ln -s source destination" on UNIX-like systems (including Mac) but I have no idea if that would work in Windows.

same syntax just different name and option

Code:
mklink /D source destination

mklink: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink

Pretty clever solution. I wonder how it works when deploying the game though? does it just pull the plugin files like normal and bundle them into the exported project?

I think RM just copies the files over and let's the OS handle where the files are being pulled from.

When I did a test deploy, my audio and img folders were already symlinked to somewhere else and it copied it over no problem.

It's the same URI, just on your machine the file you're loading might be stored elsewhere.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,548
Reaction score
3,301
First Language
Binary
Primarily Uses
RMMZ
Thats pretty dang nice then! Will have to try this out myself :D
 

Latest Threads

Latest Profile Posts

just destroyed hours of work again. i don't know why I bother.
World Map for the inside of my main character's head. Every spot is an area that either occupies his thoughts or staples of everyone's "headspace"
How can I look up the components for a medieval bomb for my game without the FBI showing up at my door?
I don't think I can handle using the real SNES resolution of 512x448 because resizing absolutely every interface element I had on hand by painstaking trial & error/guess and check (is there any other way?) is KILLING me.

Forum statistics

Threads
108,992
Messages
1,041,102
Members
141,457
Latest member
Germelshausen
Top