Big rpak loading refactor - #766
Conversation
There was a problem hiding this comment.
The new method of loading/unloading rpaks seems to have been working fine in the ctf playtest we did. Didn't run any mods that load the old method though.
edit: turns out I was also running a mod that used Aliases so that is also confirmed to be working.
second edit: just tested with a mod that used Preload and that also works fine
epic third edit: went ahead and tested Postload mods as well, also seem to work fine. Notably they got unloaded when disabling the mod but didn't appear to get loaded again afterwards when re-enabling the mod.
|
Ok this commit should make Postload and Preload rpaks get reloaded nicely when doing |
Alystrasz
left a comment
There was a problem hiding this comment.
From quick testing:
- troll face did not appear with
mainbuild; - with PR, troll face did appear on angel city;
- with PR, updating
rpak.jsonfile (to"trol.rpak": "mp_drydock") and then runningreload_mods, thenmap mp_angel_citymade the troll face disappear, as expected.
Could you also provide more detailed instructions regarding Preload, Postload and Aliases testing? Maybe by updating the test mod?
(I still have to take a look at the code.)
That stuff is just maintaining old behaviour. Best way to test would be to grab some mods and give them a go, make sure they act like normal. Any mod made with advocate should be using Preload. Most model mods (that arent using advocate) will probably be using Postload, and camo mods tend to use Aliases. All of these should work as usual, with Preload and Postload also supporting hot reloading now (though no model reloading so model textures will be reloadrd but not the models themselves) |
Alystrasz
left a comment
There was a problem hiding this comment.
Code looks good to me afaik.
I tested the PR with these 3 mods:
- XenonSet2 uses
Preloadfor a Devotion skin; - SpecterMDL uses
Postloadfor specter models; - Sweater_Camo uses
Aliasesfor a pilot skin.
All 3 mods behave the same on this PR than on main, and I confirm Preload and Postload support hot reloading (with reload_mods + reload commands ran successively).
|
The fact that this is even fully backwards compatible with current |
F1F7Y
left a comment
There was a problem hiding this comment.
Gotta say this is very much northstar code. I'd say any improvements should just be separate PRs or this gets stuck we know where :)
This reworks how rpaks are loaded, unloaded and tracked. It allows for rpak reloading between map loads, meaning that skins and map overhauls could be enabled and disabled on the fly. Previous methods of loading rpaks still work.
Related docs PR: R2Northstar/ModdingDocs#251
Well this branch got out of hand.
Anyway, this PR reworks how rpaks are loaded, unloaded and tracked.
It allows for rpak reloading between map loads, meaning that skins and map overhauls could be enabled and disabled on the fly.
Previous methods of loading rpaks still work, but the new cool way is to format the
rpak.jsonfile like this:{ "mp_colony_snow.rpak": "mp_colony02", "multiplayer_only.rpak": "mp_.*", "singleplayer_only.rpak": "sp_.*" }An rpak will be loaded if the map that is being loaded matches the regex given in the json.
How to test:
Ensuring old behaviour
Testing new behaviour
reload_modsUpdate for testing new behaviour:
Here is an example mod that uses the new rpak loading system. It's a skin for the satchel and with the
rpak.jsonsetup it will only load onmp_angel_cityTo further test this example mod, change the
mp_angel_cityto some regex that will match some maps, all maps, or whatever and test it. You shouldn't need to restart the game entirely for these changes to be respected, simplyreload_modsand then load a level. For examplemp_should match any multiplayer map and.should match every map.