Tutorial: Managing resource subfolders using hard links

Your project by default has a number of resource folders, stored in the Audio and Graphics folders such as Pictures, Battlers, BGM, and SE. However, if you have a large project, you may find yourself possibly having thousands of files in certain folders, making it difficult to manage your resources.

You may consider organizing your files into subfolders grouped based on some logical classification scheme, but the problem with this approach is that the editor has hardcoded the resource folders and does not recognize any new ones. This is not an issue for scripts using custom folders, but if you want to use the event editor to show pictures or use the database editor to assign battler sprites it wouldn’t work.

However, with the use of “hard links”, it is possible to to organize your resources in your own folders while developing your game.

Required

Hard links are available in Windows Vista and above without requiring any additional tools.

Background

If you don’t know what a hard link is, you can read about it on wiki.

Problem

Suppose you have decided to organize your Tilesets folder like this:

resource_hardlinks1

However when you try to create a new tileset, you will find that the editor doesn’t see any of your custom resources.

resource_hardlinks2

So now you have separate subfolders containing your resources, but the problem is that the editor only reads from the main Tilesets folder.

Solution

The trick is to create hard links with the following steps

  1. Get this batch file: download. You can create your own with this code:
for /R %%F in (*) do (
  if not "%%~dp"=="%cd%" (
    if not exist %%~nxF (
      mklink /H "%%~nxF" "%%F"
    )
  )
)
  1. Place the file in the main resource folder (eg: Tilesets).
  2. Double-click the file to run the script.

resource_hardlinks3

When the script has finished executing, your folder will contain a bunch of files that were in the subfolders, automatically prefixed with the folder names. This may look like a simple copy and paste, but the difference is that the new files and the files in the subfolders point to the same data.

resource_hardlinks5

Now you can use them in your editor as usual

resource_hardlinks6

You can even have files with duplicate names as long as they are in separate folders.

Modifying existing resources

When you modify one of the resources in the subfolders, you will notice that the linked file in the main folder has also changed automatically. This allows you to only work with your resources in the subfolders and not have to worry about the files in the main folder.

Adding new resources

When you add a new resource to a subfolder, it does not automatically get added to the main folder. Simply run the batch script again to create new hard links.

Publishing your game

Notice that the hard links actually take up space, so you will use up double the space just to develop your game. However, when you are ready to distribute your game, you can simply delete all of your subfolders and then pack up the game.

You may also like...

6 Responses

  1. February 27, 2015

    […] Managing Resource Subfolders Surpassing Event Page Limits Keyitem Triggered Events Item Affixes (aka gem sockets/materia) Word Wrapping Multiple Action Triggers for Events Enabling debug RPGMaker Console Drop Item Sets (skinning?) This entry was posted in Pandaria and tagged Links, Mechanics, Planning by darthneko. Bookmark the permalink. […]

Leave a Reply

Your email address will not be published. Required fields are marked *