beyond-all-reason / beyond-all-reason/RecoilEngine

`VFS.UseArchive`: support loaded/shadowed archives

Open
#1,397 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

The basic task is to make `VFS.UseArchive("some_already_loaded_archive.sd7", bla)` work without erroring. The caveat is that just removing the check will lead to the following failure mode.

Consider this set of archives:
* `basegame.sd7`, some game. It contains `modoptions.lua`.
* `mod.sd7`, a mod which has `basegame` as a dependency and contains its own `modoptions.lua` which overrides the base game's.
* `chobby.sd7`, chobby lobby.

You may want to have Chobby do `VFS.UseArchive("basegame.sd7", bla)` to read a game's modoptions when setting up a game. But consider this chain of events:
* load up chobby.
* launch a game of `mod`. Both `basegame` and `mod` are now loaded because `basegame` is a dependency. VFS functions access the `modoptions.lua` as it appears in the mod though because that's what you're playing (or technically because it is loaded last, after the dependencies) so it overrides the files that may be present in the other archives.
* decide you'd rather play `basegame`. Without quitting the match, tab back to chobby and setup a game of `basegame`. This involves a call of `VFS.UseArchive("basegame.sd7", some func that loads modoptions.lua)` from chobby.

Right now, it detects that `basegame.sd7` is already loaded and errors.
A naive removal of the "already loaded" check would result in files from `mod.sd7` being loaded, because that is what is currently loaded with override priority.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the VFS.UseArchive entry point and the handling of already loaded archives. Reproduce the basegame/mod dependency scenario described with modoptions.lua, then ensure explicitly selecting basegame reads its files rather than the higher-priority mod archive, without raising the already-loaded error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.