I’m working on a turn-based strategy game and make a level editor for designer to create some pre-made levels in game, which are now stored in .sav files. However, as now we want to open this level editor to players (so they’re able to make some custom levels), there’s chance that players modify those pre-made levels with that editor, which we don’t want it happen… So I’m wondering if there’s a solution to package those pre-made levels together with the assets so they’re not available to the players?
In your UE4 project settings > Project > Packaging > Packaging you have advanced options (click on the arrow down icons to reveal them).
There is an option “Additional Non-Asset Directories to Package” which should package any additional files in folders you add there. The tooltip says that you need to use the Unreal File System to load these files, however i have no experience with it.
That being said : If your only reason to package these files is to make them “not available to the player”, my advice is : Don’t bother. If players want to modify it, they can simply unpack the file, modify it and repack it. AAA gaming companies spend hundreds of hours developing techniques to"protect" their files from player modification but in the end it’s usually useless. If people want to modify something, they’ll find a way.
Instead i’d advise you to just make different folders for your maps, something like
Gamefolder/Levels/Campaign/.sav <- Premade singleplayer levels go here
Gamefolder/Levels/Multiplayer/.sav <- Premade multiplayer levels go here
Gamefolder/Levels/Custom/*.sav <- Custom multiplayer levels go here and the level editor only saves into this folder to avoid accidentally overwriting premade levels.
Alternatively you could but some kind of data flag in your premade level data and the public level editor checks for that flag. If the flag is set,it won’t load the level in the editor or refuses to save it. But then again, players can just modify that flag if they really want to…