How to load a map from a dynamic level

So I have just packaged my files for WindowsNoEditor and it looks very similar to yours and it still says it can’t resolve maptest.umap. The Mount point is the same and it has all of the Engine content as well. Where yours gets to EngageFootprints/Content/... is there a map in there too? if so is it a .umap or just a .exp and .ubulk.

When mine stops listing the engine content and starts listing the PakSource content it looks like this:

LogPakFile: Display: “PakSource/AssetRegistry.bin” offset: 35395584, size: 20492 bytes, sha1: E91B38BF6C9AB16C009483CDC4D047F26D832524.

LogPakFile: Display: “PakSource/Config/DefaultEditor.ini” offset: 35416165, size: 0 bytes, sha1: DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.

LogPakFile: Display: “PakSource/Config/DefaultEngine.ini” offset: 35416218, size: 660 bytes, sha1: 8E2BE430B3E3B0B8CBA65AC765633E0905C38E57.

LogPakFile: Display: “PakSource/Config/DefaultGame.ini” offset: 35416951, size: 157 bytes, sha1: E281B3A31E4A4CA85477C59F76D2518DD6581B06.

LogPakFile: Display: “PakSource/Content/maptest.ubulk” offset: 35418112, size: 40996 bytes, sha1: 6E25136D59C1D0CEAE92EEEE4A4868E6428543A7.

LogPakFile: Display: “PakSource/Content/maptest.uexp” offset: 35461120, size: 349218 bytes, sha1: 21C8173C7506E720FEC33D226A2CB91BB820265B.

LogPakFile: Display: “PakSource/CookedIniVersion.txt” offset: 35811328, size: 48484 bytes, sha1: C5805036265936F59A8E2F194F1A6AB06980381E.

LogPakFile: Display: “PakSource/DevelopmentAssetRegistry.bin” offset: 35860480, size: 34407 bytes, sha1: 7C3969BA58B41651CD61EF50FF5DE950057C9283.

LogPakFile: Display: “PakSource/PakSource.uproject” offset: 35894992, size: 79 bytes, sha1: 92413C96F9B1A146AD2B5E86C56EDF80CD9AA62B.

Do you know what version of the editor you were using? It looks like .uexp and .ubulk were added sometime around 4.15 to reduce the filesize of .umap so this is probably a non issue but still neat to see lol

Yeah, when I print out the contents of the mounted pakfile it shows this:

LogTemp: Warning: File: /Game/PakSource/Content/maptest.umap

LogTemp: Warning: File: /Game/PakSource/Content/maptest.ubulk

LogTemp: Warning: File: /Game/PakSource/Content/maptest.uexp

so it must build that when it mounts or something, not sure

I’ll give it a shot now and let you know. By load the umap into memory do you mean try to open it?

Yeah, but unless I go in and change what gets added to the pakfile instead of just building for WindowsNoEditor I’m not sure there is a way around that :confused:

But even when I did edit the pakfile to only contain the map and material and it was showing as “/Game/Content/” it still couldn’t resolve it

yeah I was working in 4.10 - that’s cool, good to know :slight_smile:

They narrow down as you approach victory… well my fingers are crossed for you on this front!

Branching down to a more sensible width…

@TestyRabbit I’m including a file with my full pak file mount code. This allows me to read raw files from the pak file. I’m not saying it will fix your problems but thought it might be worth adding here.

Question: Can you load a file - for instance use the file system to load that umap into memory? Sorry if I missed you being able to do this, the thread above is EPIC.link text

cool - but it’s still showing “/Game/PakSource/Content/” rather than “/Game/Content/” which is worrying me…

Yeah - using something like FFileHelper::LoadFileToArray.

Whjat is this? Warning: This code is not running the Matchoo modified UE4 engine and will not work in packaged builds (should work for development)

@RichardB I don’t think this is going to work this way, I might look into utilizing the DLC system to see if I can get something working there. You should send me your paypal so I can at least buy you a beer, you took basically your whole day to help me with this and I really really appreciate it. I’d like to keep the positivity going somehow haha

@theonecalledtom

So I added in your code and just tried calling OpenLevel(GetWorld(), "maptest") and it actually opened the world in the cooked build!! It gave me an issue about not being able to find the material though :confused:

LogStreaming: Error: Couldn’t find file for package /Game/test requested by async loading code. NameToLoad: /Game/test

LogStreaming: Error: Found 1 dependent packages…

LogStreaming: Error: /DLC/PakSource/Content/maptest

I can send you the whole log file too if you would like

Ok, it’s possible something has changed between 4.10 and 4.17 - I hope you get success with the DLC! Hahaha don’t worry about the beer, I brew my own so there’s plenty :slight_smile: I was modelling today anyway so had half my brain free… Once I finish the small contract I’m working on at the moment I’m going to try and get dynamic map and asset loading working from 4.19 - Epic have done more work on the packaging and have even included encryption now…

That was an improvement then?

The logfile might be interesting. The error line you hit is because of a problem where an optimization stopped the file system loading data from lower file systems once you have mounted a pak file of dlc on top (which my code does). I put a pull request in about 4.15 but they didn’t approve of my solution so it’s not mainstream (I haven’t looked to see if an alternative exists in more recent builds as I’m still on 4.17).

It actually works and finds the material if I remove all of the unnecessary stuff from the pakfile and then mount it onto “/Game/” here:

StandardFilename = "/Game/";
if (!mp_DLCPakFiles->Mount(*rPakFileName, 0, *StandardFilename))

I have attached the logfile for if it can’t find the material (when I mount to the actual StandardFileName – D:/PAKS/ – instead of overwriting it with /Game/ using your sent code).link text

Mounting it ontop of “/Game/” works but it then overwrites all of my actual game files so that’s not really doable. Any thoughts?

Fun news is that I’ve actually gotten it to work! But only if I mount to the /Game/ directory, which doesn’t work for me because I can’t overwrite all of the content in the game just to mount one map. But it’s a step! Just has to do with the routes. If I get it working I’m going to probably write up a tutorial or something similar so there is a resource about this and I’ll keep you updated.

It seems it’s always looking for the material at /Game/material instead of using the mount location. Could this be a bug Unreal engine?

Okay, I have figured out a way to kind of spoof the pakfile into getting to the real path. I will type out an example I just tested.

  • I have a destination project located at D:\Projects\DestinationProj\ (The project I want to mount my pakfile in)
  • I have a source project located at D:\Projects\SourceProj\ (The project that I’m using to build my pakfile)
  • In my source project, all assets used in the map are in a subfolder called Map. So the directory is D:\Projects\SourceProj\Content\Map\<assets here>. NOTE: The map itself goes in the root content folder, i havent tested with it anywhere else but it probably would work.
  • In order to get my pakfile, I must package my Source project.
  • After packaging, I’m left with a txt file in C:\Users\<username>\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.17 called PakList_SourceProj-WindowsNoEditor.txt
  • I copy that txt file to an easier to access location and rename it. Now it is at D:\Paks\Paklist.txt
  • I open Paklist.txt to edit, removing all lines that don’t start with D:\Projects\SourceProj\Saved\Cooked\WindowsNoEditor\SourceProj\Content\...
  • Each asset in the .txt file is made up of two strings, ie D:\Projects\SourceProj\Saved\Cooked\WindowsNoEditor\SourceProj\Content\material.uasset and then to the right is ../../../SourceProj/Content/Map/material.uasset
  • Remove Map from the path on the right for each asset that is remaining
  • Save and close the .txt file.
  • In command prompt, run UnrealPak.exe D:\Paks\testpak.pak -Create="D:\Paks\paklist.txt". This will generate a pakfile that you will be mounting. Now you have a pakfile located at D:\Paks\testpak.pak
  • Using the code you sent me, I mount the pakfile to “/Game/Map/” (mp_DLCPakFiles->Mount(*rPakFileName, 0, TEXT("/Game/Map/")). And then I try open the map using UGameplayStatics::OpenLevel(GetWorld(), mapname);.
  • I package the DestinationProj and run it.
  • Map is loaded with assets.