Future way of packing nav files into bsp and getting them to work properly with workshop + elsewhere

ics

http://ics-base.net
aa
Jun 17, 2010
841
543
I reported a bug to Valve about workshop maps not getting their nav files loaded, when the map file is used directly on a gameserver by loading it through workshop or when a player loads the map up with "map workshop/mapworkshopIDhere".

So that the players should not need to copy it from the workshop location manually to their tf/maps directory, to test out with bots and so that the files work on a gameserver too through workshop - there is a better way.

I received a reply on the bug. It's not a bug, it's a new feature. Valve has somewhat recently added a thing within the engine, which allows nav files to be loaded by any method available. Instead of packing your maps navigation file (nav) as mapname.nav, you should name it as embed.nav.
This makes them map-name agnostic and doesn't matter if the map is loaded by any means, from server, from console, from workshop, it will always work regardless.

Doesn't this cause issues with multiple map navs named the same you ask? No, if you do it correctly. You do not need to manually to rename your maps nav as embed.nav. Just keep it as mapname.nav (for example pl_millstone_ugc_5.nav) along with your map.bsp (example pl_millstone_ugc_5.bsp).

How to pack your nav file easily:

Create file called nav.bat into your maps directory. This can be with any name so name it as you like so you can always find it when you need it. Put this content inside of it:


"..\..\bin\bspzip" -add filemapname.bsp maps\embed.nav mapname.nav mapname.bsp
@pause

To make this more clear, here's a working example:

"..\..\bin\bspzip" -addfile pl_millstone_ugc_5.bsp maps\embed.nav pl_millstone_ugc_5.nav pl_millstone_ugc_5.bsp
@pause

So edit the file to your needs whenever you need it. You can simply change the ending of the .bat file to .txt to edit it, add your proper map name in, save the file and rename back to .bat. If you dont see file endings, you need to change your windows folder settings to display those.


To pack nav in with the bat, just doubleclick that file to pack in your nav file as embed nav. The bat file will open your bsp, pack in the nav as embed.nav into maps directory and save the file. Just hit enter after a while and you are done.

How to pack your map files as harder way:

The syntax is:

"-addfile <input map> <embedded name> <file to embed> <output map>".
So, assuming your map is "cp_mymap.bsp" and your nav file is
"cp_mymap.nav", both in tf\maps, this command would pack your nav file
into the map as "embed.nav", and save the result as "cp_mymap_withnav.bsp":

bin\bspzip.exe -game tf -addfile tf\maps\cp_mymap.bsp embed.nav
tf\maps\cp_mymap.nav tf\maps\cp_mymap_withnav.bsp

All community compilers should be updated to use this method so if you know a developer, hint them about this. If i speculate a bit, i think this embed.nav was not made without future use so better to start use it sooner or later.

Otherwise if you do not use this method and upload map to the workshop with packing it the old way and some servers run it directly from workshop, nav fails to work and bots wont move. This is an issue for any map but bigger issue for halloween maps where bosses require nav files to work.

I have this fix live and tested on the example map, pl_millstone_ugc_5 on workshop.

Thanks to both Eric & Jill for this information. I thought i'd share this here too.


 
Sep 14, 2015
13
147
The approach here is to allow all map-named files (pop files, nav, soundscape, particles...) to have a nameless variant that works when embedded in the map. Also functional now are popfiles -- you can embed mvm_foo_normal1.pop as just normal1.pop (you can also now have multiple pop files per map and voting/switching between them will work). We will have more juicy patch notes as more subsystems hooked up.
 

Pikachu on LSD

L1: Registered
Jul 2, 2017
2
1
Soundscapes are usable without being dependent on map name by packing them as scripts/soundscapes.txt, though attempting to play custom sounds from a Workshop-downloaded map still throws a "Cannot figure out which search path $sound came from" error.
 

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,774
Just to be clear, if the soundscape is named to match the map, it won't work in the workshop, but if it's named generically, it WILL work?

So "scripts/soundscapes_cp_antiquity_b15.txt" will not work, while "scripts/soundscapes.txt" will, if packed in?

I've had reports that the soundscapes aren't working for antiquity, so I just want to be sure it'll work fine next iteration. I'm not using custom sounds fwiw, just the usual TF2 stuff.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
I don't ever remember soundscapes working from workshop maps, would love some confirmation that they do?

Same with tf/maps/<mapname>_level_sounds.txt as I make frequent use of that one
 

Void

Local Man Unable To Map, Sources Say
aa
Sep 14, 2008
1,868
2,977
Jill et al have a way of looking at maps that doesn't break custom soundscapes, level sounds, etc. I don't know how exactly, but there aren't any issues with soundscapes and such on Valve's end - but it's a known issue for anyone subscribing to maps on the workshop, as said by Jill in an email a few weeks back.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Ok sooooo:

scripts/soundscapes.txt

❌maps/level_sounds.txt
❌maps/<mapname>_level_sounds.txt

particles/particles_manifest.txt

This means Sacrifice's jungle soundscapes and idol particles work, but the announcer voicelines don't :(
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
What about custom sounds and soundscripts?
Soundscripts are <mapname>_level_sounds.txt

You can add announcer lines just using ambient generic, but you can't gag the normal announcer without a soundscript for that level
 

ics

http://ics-base.net
aa
Jun 17, 2010
841
543
I assume there is some work being done for the implementing of sounds just as the nav stuff in the past, since i asked about this and received no reply for 2 months now. Soundscapes from workshop maps are broken, if they are loaded from the workshop file (like with a console command map workshop/idhere). This means on your own pc or if a gameserver uses them directly from the workshop, soundscapes do not load.

They will work if you copy the map (the bsp, not the folder) from the workshop location such as STEAM\SteamApps\workshop\content\440\workshopmapidhere to maps directory, for example STEAM\SteamApps\common\Team Fortress 2\tf\maps.

Then load the map through console with map mapname or on a server with just like any other regular map, they work ok, provided that the soundscape file has been originally packed into the file itself.

I assume they will announce later another way to implement soudscapes into the bsp files. I bet Valve just takes the maps out from their workshop location and run them from an internal server, so that the sounds work properly.
 

Pikachu on LSD

L1: Registered
Jul 2, 2017
2
1
Turns out this is kind of a dirty hack.

I completely overlooked the fact that scripts/soundscapes.txt is actually an existing file in the game files (containing only "tf2.respawn_room" and "tf2.general_ambient"), so the engine's just loading the ones packed into the map instead of Valve's copy, and this isn't actually a true nameless variant like I originally thought. My mistake.

For what it's worth, the soundscape entries get reloaded after level init (citing the SDK), so I believe the custom soundscapes will be unloaded after the map is.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Then perhaps "scripts/game_sounds_manifest.txt" will work as a replacement to "maps/<mapname>_level_sounds.txt"

Will test shortly
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Can confirm:
scripts/game_sounds_vo.txt does not work
scripts/game_sounds_manifest.txt and scripts/game_sounds_<blah>.txt does not work

I don't think there's any way for us to get soundscripts working from the workshop :(
 

MOCOLONI

L6: Sharp Member
Dec 16, 2014
373
89
Sorry for bumping the thread, but did they really not let anyone know about the new nav feature before ics contacted them?

This thread should be pinned to the "Tutorials & Resources" subforum as it took me 'a while' to find this out (before). Thanks for letting us know!
 

BIO BENNY

L1: Registered
Jul 23, 2017
17
1
This helped me quite a bit, just learning how to do .nav files and just built some both using automatic generation with tweaking, and manual for my multi-layered halloween map. Very tedious, but worth it. Easiest time I'd had getting something to work, thank you! Also excuse the bump, sorry!