Tuesday, December 6, 2011

Portal 2 Modding Minutiae

While working on Level With Me, I've gathered a set of random Portal 2 modding knowledge that might be useful. Please profit from my trial and error:
  • If you want to have your levels selectable from the menu and everything, you have to make your own custom VPK to override some menu scripts, and reskin the "Extras" menu to appear to be the single player menu. Marcus McKay has a comprehensive tutorial here.
  • Currently, custom sounds don't automatically get added to the sound cache, so you'll always get errors that the "file is missing from the repository" or something when you play the sounds in-game. You can either re-build your entire sound cache every time, or use PakRat to pack the sounds into the BSP. It's just another extra step to the map compile pipeline. More details here.
  • Switching videos dynamically, in-game, is kind of problematic. Only the first set of .BIK files get cached, so when you load the rest, there's a slight hitch. Maybe if you make a set of invisible vgui_movie_display entities in some hidden room, the map will pre-cache those files? Also, to switch a movie, the only method I've been able to find (with varying degrees of success) is to send a "TakeOverAsMaster" input to a former vgui_movie_display slave, which seems to "refresh" the entire entity group.
  • The lighting in the elevator rooms will only work if you compile vrad.exe with -staticproppolys or something, otherwise the ceiling rotors always block the light_spot entity. It's a feature.
  • When you buildcubemaps, you have to quit, use mat_reloadallmaterials, then load the map again to get the cubemaps showing.