Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steam Workshop mounting system #325

Merged

Conversation

Blixibon
Copy link
Collaborator

@Blixibon Blixibon commented Jan 31, 2025

This PR adds a proper Steam Workshop mounting system to the game. Currently, Steam Workshop addons are mounted directly by searching for a relative file path to the main workshop directory in gameinfo.txt. This method contains several weaknesses, including the inability to include VPKs, the inability to dedicate addons to specific episodes (a hypothetical problem), and the fact the game continues to search paths even when addons are no longer subscribed to, causing the game to slow down.

This new system solves all of those problems. It uses the Steam API to get the directory for each subscribed workshop addon, and then manually mounts them. If there are any VPKs in the directory, then it will mount the VPKs instead.

The system will also search for an addoninfo.txt file at the root of each addon directory. This file is currently only used to allow addon authors to specify which game/mod/episode the addon is for.

For example:

"AddonInfo"
{
	"game"	"axonpariah"
}

When a game keyvalue is specified, the mounting system compares its value to the name of the mod's folder. For example, if an addon is specified to be for axonpariah, but the currently loaded mod is entropyzero2 (the main game), then the addon will not load.

This parameter supports multiple mod names separated with the + character (e.g. axonpariah+progenitors) and negation operators (e.g. !axonpariah). This parameter also supports the following two "special" commands:

  • #episodes - Equivalent to axonpariah+progenitors. Would automatically cover all potential future episodes.
  • #all - Allows any game. Can be used in conjunction with + to negate specific games (e.g. #all+!progenitors for all except progenitors).

Addons which do not have this file or its game parameter will be mounted in any game.

Weaknesses of this system

  • Since this system uses the game DLLs instead of gameinfo.txt, the SDK tools cannot mount addons in the same way. Addons can still be mounted through the custom folder or through local gameinfo.txt changes if a developer prefers.

Things I still plan on doing

  • Make addons which have VPKs also mount loose directories. I originally wanted to make VPK addons VPK-only to make this more efficient, but I forgot that some files cannot be included in VPKs and may need to be included separately.
  • Potentially remove unnecessary GetItemInstallInfo params.
  • Potentially add a new field to the Workshop Publish GUI which allows you to specify which game you're making the addon for. Considering this out of scope for now.

@Blixibon Blixibon force-pushed the ez2/feature/workshop-mount-system branch from ea72d6d to 3fd7764 Compare January 31, 2025 15:52
@Blixibon Blixibon marked this pull request as ready for review January 31, 2025 16:09
Copy link

@1upD 1upD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need lots of testing. Also, we will need to remove the search paths for addons from gameinfo.txt, right?

But I've reviewed this code and it looks good to me, so I am approving

@1upD 1upD merged commit 33cde69 into entropy-zero:ez2/mapbase Feb 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants