Skip to content

Use Case Cookbook

Samuel Grossman edited this page Apr 15, 2024 · 2 revisions

This page shows some examples of Pathwinder configuration files, intended as templates, that can be used for real use cases.

Cloud Saving for Games

Windows-based games often write their configuration and save data to wildly inconsistent locations. Some use the same directory as the game's executable (or a subdirectory from there), others use the current user's LocalAppData directory, and others use a subdirectory of the current user's Documents folder. Furthermore, sometimes save and configuration data are stored in the same place, whereas other times they are stored in separate locations.

Configuration data refers to settings like controller input customization, graphics resolution, and so on. Save data refers to game progression, unlockables, and so on.

The goal of this use case is to show various ways Pathwinder can be used to:

  • Organize game save and configuration data in a consistent, easy-to-locate directory structure
  • Cloud-synchronize said directory structure using any cloud provider of the user's choice
  • Separate configuration data from save data such that configuration data is stored per-user and per-machine whereas save data is stored per-user

What we want as a desired outcome is that the user can roam from one cloud-synced device to another. Regardless of which device they use to play the game their save data is accessible, and the user can resume from wherever they left off last play session, irrespective of device. Configuration data are also backed up to the cloud, but Pathwinder will automatically select whichever configuration data were previously configured for each device individually. If we imagine that a user plays at home on a powerful gaming PC and also on-the-go using a handheld, Pathwinder will ensure that the most recent save data avaialble on both devices, but each device automatically gets its own set of configuration data.

It is worth noting that cloud synchronization is already available for games sold through various digital marketplaces. However:

  • Digital marketplace cloud synchronization requires that the same digital marketplace be used as the cloud storage backend. With Pathwinder, any cloud provider is supported, including self-hosted cloud solutions, as long as the provider makes available a desktop synchronization application.
  • Not all games sold through digital marketplaces support cloud synchronization. Older games, in particular, either require a workaround to be implemented by the digital marketplace provider or simply do not support cloud synchronization at all. Pathwinder, conversely, makes the game behave as though it natively supports reading from and writing to cloud-synched directories.
  • Pathwinder can enable cloud synchronization for games not obtained from digital marketplaces that support cloud synchronization.

Note that Pathwinder itself has no notion of local versus cloud storage. Pathwinder can perform the redirection to target the cloud-synched folder, but from there the desktop synchronization application will need to take over and do the actual synchronization.

The remainder of this section is divided into two steps. First, we configure Pathwinder to organize save and configuration data consistently, and second, we choose an appropriate location and enable cloud synchronization.

Configuring Pathwinder

The first step to enabling cloud saving for games using Pathwinder is to configure Pathwinder with filesystem rules so that save and configuration data are organized well and redirected to a consistent location. In this example, we will assume that the "consistent location" is the "Saved Games" folder within the user profile directory.

Various examples of configuration files are shown, depending on how the game is programmed to organize its own save and configuration data. In all cases, the goal is to organize the data as follows.

  • "%USERPROFILE%\Saved Games\Game Name\" is the top-level directory for each game. Within this directory:
    • "SaveData\" contains the game's save data.
    • "ConfigData\Machine Hostname" contains the game's configuration data, one subdirectory per machine.

The subsections that follow show how to achieve this for games that place their data in various locations around the system. All of the example configuration files make heavy use of dynamic reference resolution as an illustration of how it works. The examples themselves are intended as templates and will most likely require game-specific modifications.

Note that Pathwinder cannot automatically detect where a game stores its save and configuration data. This information is needed to set up the origin directory paths properly. A good resource that can supply this information for many games is PCGamingWiki.

Separate Folders Beside the Executable

This example configuration file shows the simplest case. It assumes that the game:

  • Places its save data, and nothing else, in "Game Executable Directory\Save\".
  • Places its configuration data, and nothing else, in "Game Executable Directory\Config\".
[Definitions]

; Game name. For convenience of reuse later in this file.
GameName = My Example Game

; Where the game places its save data.
GameSaveDirectory = %BUILTIN::ExecutableDirectoryName%\Save

; Where the game places its configuration data.
GameConfigDirectory = %BUILTIN::ExecutableDirectoryName%\Config

; Base directory for where game data should be redirected.
DesiredDataDirectoryBase = %FOLDERID::SavedGames%\%CONF::GameName%

; Where the save data should be redirected.
DesiredSaveDirectory = %CONF::DesiredDataDirectoryBase%\SaveData

; Where the config data should be redirected.
DesiredConfigDirectory = %CONF::DesiredDataDirectoryBase%\ConfigData\%BUILTIN::DnsHostname%

[FilesystemRule:SaveData]
OriginDirectory = %CONF::GameSaveDirectory%
TargetDirectory = %CONF::DesiredSaveDirectory%

[FilesystemRule:ConfigData]
OriginDirectory = %CONF::GameConfigDirectory%
TargetDirectory = %CONF::DesiredConfigDirectory%

Individual Files Beside the Executable

This example configuration is slightly more complicated. It assumes that the game:

  • Places its save data, and nothing else, in "Game Executable Directory\Save\".
  • Places its configuration data in "Game Executable Directory\".
    • Files "config.bin" and "input.dat" are configuration data.
    • All other files are game data and include the executable itself.

What differs in this example compared to the last example is the use of file patterns for the configuration data rule. The origin directory refers to the game's executable directory, and file patterns are used to limit the scope of the rule just to the individual configuration files.

[Definitions]

; Game name. For convenience of reuse later in this file.
GameName = My Example Game

; Where the game places its save data.
GameSaveDirectory = %BUILTIN::ExecutableDirectoryName%\Save

; Where the game places its configuration data.
GameConfigDirectory = %BUILTIN::ExecutableDirectoryName%

; Base directory for where game data should be redirected.
DesiredDataDirectoryBase = %FOLDERID::SavedGames%\%CONF::GameName%

; Where the save data should be redirected.
DesiredSaveDirectory = %CONF::DesiredDataDirectoryBase%\SaveData

; Where the config data should be redirected.
DesiredConfigDirectory = %CONF::DesiredDataDirectoryBase%\ConfigData\%BUILTIN::DnsHostname%

[FilesystemRule:SaveData]
OriginDirectory = %CONF::GameSaveDirectory%
TargetDirectory = %CONF::DesiredSaveDirectory%

[FilesystemRule:ConfigData]
OriginDirectory = %CONF::GameConfigDirectory%
TargetDirectory = %CONF::DesiredConfigDirectory%
FilePattern = config.bin
FilePattern = input.dat

Documents and LocalAppData

This example supposes that the game already writes to per-user locations, but that these locations are not optimally organized and not necessarily cloud-synched. It is assumed that the game:

  • Places its save data, and nothing else, in "%USERPROFILE%\Documents\Game Name\"
  • Places its configuration data, and nothing else, in "%LOCALAPPDATA%\Game Name\"

The actual configuration file is similar to the first example, but it shows different usage of dynamic reference resolution for composing the game's save and configuration data directories.

[Definitions]

; Game name. For convenience of reuse later in this file.
GameName = My Example Game

; Where the game places its save data.
GameSaveDirectory = %FOLDERID::Documents%\%CONF::GameName%

; Where the game places its configuration data.
GameConfigDirectory = %FOLDERID::LocalAppData%\%CONF::GameName%

; Base directory for where game data should be redirected.
DesiredDataDirectoryBase = %FOLDERID::SavedGames%\%CONF::GameName%

; Where the save data should be redirected.
DesiredSaveDirectory = %CONF::DesiredDataDirectoryBase%\SaveData

; Where the config data should be redirected.
DesiredConfigDirectory = %CONF::DesiredDataDirectoryBase%\ConfigData\%BUILTIN::DnsHostname%

[FilesystemRule:SaveData]
OriginDirectory = %CONF::GameSaveDirectory%
TargetDirectory = %CONF::DesiredSaveDirectory%

[FilesystemRule:ConfigData]
OriginDirectory = %CONF::GameConfigDirectory%
TargetDirectory = %CONF::DesiredConfigDirectory%

Enabling Cloud Synchronization

All of the examples in the preceding subsection used "%FOLDERID::SavedGames%" as the base directory for game data, which by default resolves to "%USERPROFILE%\Saved Games". Unless otherwise configured, this location uses local storage and is not synchronized to the cloud.

There are two ways to enable cloud synchronization for the configuration templates in the preceding subsection. Only one of these is needed.

  1. Change DesiredDataDirectoryBase to a location that is a subdirectory of a cloud synchronization directory, for example "%USERPROFILE%\Dropbox", "%USERPROFILE%\OneDrive", "%USERPROFILE%\iCloud", and "%USERPROFILE%\Nextcloud", depending on the cloud synchronization service being used.

  2. Change the physical location of "%FOLDERID::SavedGames%" so that all game save data goes to a cloud synchronization directory instead of to local storage. To do this: a. Open File Explorer, type "%USERPROFILE%" into the address bar, and press Enter. a. If you do not see the "Saved Games" directory in the list, click once on the address bar (the current path will be highlighted) and then press Enter. a. Right-click on "Saved Games" and then choose "Properties" from the context menu. a. Go to the "Location" tab in the window that appears, and then click the "Move..." button. a. Choose a new location for the "Saved Games" folder. Ideally this will be a folder that is a subdirectory of a cloud synchronization directory.

Clone this wiki locally