Pak File Loader Plugin

There must be something i’m missing because the cook fails for me even with this version. The only way that ModPluginA build (cook/package) works is if I keep the plugin enabled when i build the first main build, which i think defeats the purpose of having the main build built without knowledge of the plugin. I’ve went over project launcher settings several times so it must be something else. As it’s unrelated to PakLoader, I’ll send you a p.m. to what I’m seeing. Definitely helpful for my understanding anyway even with them not working with disconnected builds. so thanks.

@Rareden
That’s a really strange pak layout. If you want the assets to be available in /Game then this will work (Tested and it works):

Pak File layout:

"ModProject": Name of the Unreal project. All content is from /Game
Mount point must be [FONT=courier new]…/…/…/

Mount with the Pak Loader plugin:
[FONT=courier new]MountPakFile(“D:\MyGamePak.pak”, “”) ← Leave the mount point parmeter empty (mount point from the pak will be used which is …/…/…/)
[FONT=courier new]RegisterMountPoint("/Game/", “…/…/…/ModProject/Content/”) ← RootPath and ContentPath.
(Optional) [FONT=courier new]LoadPakAssetRegistryFile("…/…/…/ModProject/AssetRegistry.bin")

Now you can load assets like this: [FONT=courier new]GetPakFileStaticMesh("/Game/Tents/Meshes/SM_Tent")

@MagicBots
I would assemble the pak so it looks like this.

Mount point: …/…/…/

“Pod/Plugins/ModPlugin/Content/Cube.uasset”
“Pod/Plugins/ModPlugin/Content/M_Cube.uasset”
etc.

Then your RootPath is “/ModPlugin/” and your ContentPath is “…/…/…/Pod/Plugins/ModPlugin/Content”

ok, trying this. I noticed that i’m getting a .pak generated for the mod packaging approach that looks like this:

Pod\Plugins\ModPlugin\Content\Paks\WindowsNoEditor\ModPluginPod-WindowsNoEditor.pak" -List
LogPakFile: Display: Using command line for crypto configuration
LogPakFile: Display: Added 0 entries to add to pak file.
LogPakFile: Display: Mount point …/…/…/Pod/Plugins/ModPlugin/
LogPakFile: Display: “AssetRegistry.bin” offset: 0, size: 44 bytes, sha1: CC66D83CB38DE2F3A30822A68EB38A3865471816, compression: None.
LogPakFile: Display: “Metadata/DevelopmentAssetRegistry.bin” offset: 2048, size: 143066 bytes, sha1: A9820C94D2CDF676DD30655C61BBBC57E5E560DF, compression: None.
LogPakFile: Display: 2 files (143110 bytes), (0 filtered bytes).
LogPakFile: Display: Unreal pak executed in 0.003891 seconds

If i want to read the AssetRegistery with the .pak I create for my cube, do i add it with the same approach as content
(same mount points etc) or is there a different procedure?

For some reason I cannot get my packaging approach
for my mod plugin to include the content both the asset registry and the content… So i’m having to manually pak the
content. Not sure why.

I suppose I can also manually pak the registry in with the content but maybe it’s better to keep
them separate if the registry needs a different rootPath and contentPath generally…?

Ty good sir, its working now.
I had to Append the" …/…/…/" into the response file array as a individual index to get the unrealPak to have the mount point as “…/…/…/” in case anyone else runs into the problem too

@Rareden, what does the line need to look like exactly? I put “…/…/…” as its own line in the top of the response file and it zipped my whole project into the pak =)

@MagicBots
Need a extra / at the end there,
The code line is simply this


  
 // Add the base path to the file list array so the mount point is correct and assets can be accessed through /Game/
  FileList.Add(TEXT(".. / .. / .. /"));

It dosnt matter where in the response file list it is, just that it has it in there.

@BlueMountainsIO I was wondering if it’s a necessary requirement to package for shipping for this to work, and if so why? Past experiments I’d done with paks, had them working fine when packaging for development. I know there is the loghelper you’ve provided for logging when packaging in shipping mode, but for other reasons i was wanting to have it work packaged for development as well. I’ve tested PakLoader with development mode and it all seems to work the same for me as i can tell so wanted to check.

Also mounting and registering are both working for me at Engine level …/…/…/ as was suggested, however I’m mounting multiple paks into the same mount root /ModPlugin/, and the AssetRegistry.bin that I’m reading won’t update registry since the AssetRegistry.bin file always has the same path. Is there a way to have the AssetRegistry.bin append to the existing registry at the mountroot?

Essentially I have a whole bunch of small paks with a few files in them that I want to mount and register beneath the same root each time… But the AssetRegistry.bin won’t register because there was already an existing one at the path for that mount root ( it seems ). Not sure how to solve this. If I don’t read in AssetRegistry.bin then I have to spawn them with your getpakfilestaticmesh in order for the registry to know about them. What I’m seeing currently is the first AssetRegisty.bin I read updates the registry and the rest don’t update so i’m stuck with the registry only knowing about the first one…

My asset AssetRegistry.bin in all of my small paks is always at:
Pod/Plugins/ModPlugin/AssetRegistry.bin

Is there a way I can manually add the object paths mounted from the pak to the registry object by object instead of serializing the AssetRegistry.bin?

EDIT:

Nevermind I got it registering!

@MagicBots
Sorry for the late reply. I can look into making the logging available to packaged development builds as well.

Glad that you have it got working. Good question to what happens when there you mount paks that have files that already exist. I think that the last mounted pak would win. Maybe a rescan of the ModPlugin/ path would work.

That’s how I got them registering was a rescan. For some reason rescanning with the root path throws a fatal error saying the path doesn’t map to a known root . I tried making sure it’s mapped just before the scan… and i assume it’s mapped because it’s working, but for some reason scanning the path always threw that error for me no matter what i tried. maybe it has to do with the fact that unreal has no way to know about the plugin root or something because it’s packaged separately in the case of a mod.

I’d rather scan by root path as it seems more efficient… Would you know how to solve the unknown root for plugin root paths packaged outside of where the main game is packaged problem? Not sure how to properly register root in this case. I guess maybe that ModSkeleton setup is doing it but I couldn’t get it working.

D: est\PAKTEST\Plugins\TestDLC\Saved\StagedBuilds\WindowsNoEditor\PAKTEST\Plugins\TestDLC\Content\Paks\WindowsNoEditor

this is too long,what can i do ?

No idea what went wrong there. The message says there are invalid characters “:”?

Ty good sir, its working now.

HOW to load LevelMap.pak??

Hello,

I’m trying to load a simple level with the plugin but It does not work and I can’t figured why. I’ve downloaded the sample project and It works well, however when I tried to reproduce it step by step (and building with the instructions described in the documentation) in my project in order to load a level, it seems like the loading failed but I have no error reported by the plugin (I’ve checked the output of “IsValidPakFile”, “MountPakFile” and “IsPackagedBuild” and all of the of them returns true). Does anyone have a solution or an idea to help ?

Did you open the level with the OpenLevel function? @Pangolin806

I have 3 Questions:

  1. Can you load maps with this?
  2. Can you make a progress loading bar?
  3. Does it run on Android? (For Oculus Quest)

Really want to try this and integrate it today,

Thank you!!

  1. This isn’t a map loader, it’s a pak loader. So, using OpenLevel should work fine: https://docs.unrealengine.com/en-US/…vel/index.html
  2. The pak mounting is synchronous as I far as I know. It’s almost instant for what I’ve noticed during testing.
  3. Tested it on Windows x64 only, as advertised on the store page.

Thank you, I appreciate the quick response!

As far as Question 2: I meant a progress bar for downloading the PAK files, not loading/using assets.

Thank you

Hey BlueMountainsIO
My problem was due to a dumb typo (and I spent way too much hours on it XD), it works well now.
But thanks for your help.

Hi, first of all I would like to thank you a lot for this work, it helps a lot.

I’m trying to load a pak file from another project and made sure dependencies are all within the pak file
Here is my steps: mount pak file with the correct mount point, change the mount point with a new mount point and then I try to load a map that is in this pak file, it finds it, check all the dependencies and end by a crash. This is the error:


​​​​​​​[2020.02.19-22.28.27:998] 16]LogMemory: Platform Memory Stats for WindowsNoEditor
[2020.02.19-22.28.27:998] 16]LogMemory: Process Physical Memory: 1011.29 MB used, 1075.68 MB peak
[2020.02.19-22.28.27:998] 16]LogMemory: Process Virtual Memory: 4640.42 MB used, 4664.96 MB peak
[2020.02.19-22.28.27:998] 16]LogMemory: Physical Memory: 15795.55 MB used,  16929.78 MB free, 32725.33 MB total
[2020.02.19-22.28.27:998] 16]LogMemory: Virtual Memory: 9266.67 MB used,  134208464.00 MB free, 134217728.00 MB total
[2020.02.19-22.28.27:998] 16]LogWindows: Error: === Critical error: ===
[2020.02.19-22.28.27:998] 16]LogWindows: Error: 
[2020.02.19-22.28.27:998] 16]LogWindows: Error: Assertion failed: CurrentPos + Count <= TotalSizeOrMaxInt64IfNotReady() [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncLoading.cpp] [Line: 8407] 
[2020.02.19-22.28.27:998] 16]LogWindows: Error: Seeked past end of file ../../../Garou/Plugins/252flat/Content/Resources/Textures/wood-109_walnut-black-american-1_b_1.uexp (1113541477 / 48001356)
[2020.02.19-22.28.27:998] 16]LogWindows: Error: 
[2020.02.19-22.28.27:998] 16]LogWindows: Error: 
[2020.02.19-22.28.27:998] 16]LogWindows: Error: [Callstack] 0x00007ffd801ba839 UnknownFunction ]
[2020.02.19-22.28.27:998] 16]LogWindows: Error: 

Would you have any insights on it?