Rough'n'ready Portal 2 SDK

Feb 14, 2008
1,051
931
You'll need
Alien Swarm + Alien Swarm SDK + Source SDK
the latest version of GCFScape (or your pref
http://dl.dropbox.com/u/9133125/FGD/fgd.zip (collaboratiion with DeanWinchester from FP, contains the FGD and a sample map with most entities as well)

so the steps are
1) open up the pak_01dir VPK in GCFScape
2) extract the models/materials folders to steamapps/common/alien swarm/swarm folder
3) place http://dl.dropbox.com/u/1085379/fix_models.bat in the models folder and run it (double-click, takes a little time)
4) materials and models should now work in the Swarm SDK
5) place portal2.fgd in the steamapps/<username>/source_sdk/bin/orangebox/bin folder
6) open Hammer and go to tools > options
7) next to game data files, click add, and choose the portal2.fgd you just put in the bin folder
8) use the keyword "portal 2" to filter for Portal 2 textures

tip: If you want to fix the way the Swarm SDK compiles things, then remove the "-alldetail" parameter in the advanced compile.

decompiling maps
1) get http://nuclearvelocity.com/barracuda/bspsrc/downloads.html and run it on a Portal 2 BSP
2) open the resulting VMF in notepad, and scroll to the bottom, the last entity { ... } definition is usually incomplete (lacks the second curly brace), so delete that from the file (this results in some missing bits in the map but this decompiler isn't finished yet)
3) open in Hammer, enjoy

So apparently people are extracting all the P2 content and the decompiled maps are missing static props.

Make a config in the Alien Swarm SDK
The edit config in the SDK launcher should go to <your folders here>\portal 2\portal2

In hammer:
Game Executable Directory:
$SteamUserDir\portal 2

Game Directory:
$SteamUserDir\portal 2\portal2

Copy these folders with their contents from AS to P2:
alien swarm\platform\materials\editor
alien swarm\platform\materials\editor\models\editor
alien swarm\platform\models\editor

into, respectively:
portal 2\portal2\materials\editor
portal 2\portal2\materials\editor\models\editor
portal 2\portal2\models\editor


For decompiling, I'm using BSPSource 1.1.1, and check Fix Rotations, otherwise a bunch of brush ents get rotated off where they should be.

making paint work
1) open up map > map properties in hammer
2) deselect the SmartEdit button
3) add 2 new keyvalues, paintinmap with value 1 and maxblobcount with value 250 (though you can change this)

p2_victory_for_mapping.png


The decompiler I found only has basic Portal 2 functionality, probably why the VMFs have errors you need to get rid of. Should be fine for compiling and running maps of your own though. Entities will have to be copy+paste for now, until Valve or someone makes an FGD.

list of entities and properties (missing tractor beam reversal, "map portals", and bombs)
Code:
func_noportal_volume
	name
	spawnflags

func_portal_bumper
	angles
	origin
	spawnflags

func_portal_detector
	spawnflags
	-OnStartTouchPortal1
	-OnStartTouchPortal2
	-OnStartTouchLinkedPortal

npc_personality_core
	angles
	disablereceiveshadows (bool)
	DontUseSpeechSemaphore (bool)
	hintlimiting (bool)
	ignoreunseenenemies (bool)
	ModelSkin 1
	parentname
	physdamagescale
	renderamt
	rendercolor
	renderfx
	rendermode
	sleepstate
	spawnflags
	targetname
	wakesquad
	thinkfunction
	wakeradius
	-OnPlayerPickup

npc_security_camera
	angles
	disableshadowdepth
	disableshadows
	drawinfastreflection
	LookAtPlayerPings (bool)
	shadowdepthnocache (bool)
	skin
	spawnflags
	TeamToLookAt

prop_portal
	Activated (bool)
	angles
	PortalTwo (bool)
	targetname
	+SetActivatedState

prop_testchamber_door (model ent)
	angles
	AreaPortalFadeEnd
	AreaPortalFadeStart
	AreaPortalWindow
	targetname
	UseAreaPortalFade (bool)
	+Open
	+Close
	-OnFullyClosed

trigger_portal_cleanser
	Visible
	origin
	targetname
	spawnflags
	StartDisabled (bool)
	-OnUser1
	-OnUser2

prop_button
	angles
	Delay
	-OnPressed

prop_floor_button
	angles
	model
	skin
	-OnPressed
	-OnUnPressed

prop_indicator_panel
	angles
	IndicatorLights
	targetname
	+Check
	+Uncheck

prop_weighted_cube
	allowfunnel
	angles
	CubeType
	NewSkins
	PaintPower
	skin
	SkinType
	targetname
	-OnFizzled
	+OnEndTouchAll
	+OnTrigger

trigger_catapult
	AirCtrlSupressionTime
	applyAngularImpulse
	entryAngleTolerance
	launchDirection
	launchTarget
	lowerThreshold
	origin
	physicsSpeed
	playerSpeed
	spawnflags
	targetname
	StartDisabled
	upperThreshold
	-OnCatapulted

env_portal_laser
	angles
	AutoAimEnabled (bool)
	model [default: models/props/laser_emitter_center.md]
	scalevalue
	skin
	StartState (bool)
	targetname
	+TurnOn
	
info_overlay_accessor (looks like a normal overlay to me, except UVs)
	angles
	BasisNormal
	BasisOrigin
	BasisU
	BasisV
	EndU
	EndV
	fademindist
	material
	OverlayID
	sides
	StartU
	StartV
	targetname
	uv0
	uv1
	uv2
	uv3

info_placement_helper
	angles
	hide_until_placed (bool)
	radius
	snap_to_helper_angles (bool)

prop_laser_catcher
	angles
	IndicatorLights
	targetname
	model
	skin
	SkinType
	vscripts
	-OnPowered
	-OnUnpowered

npc_portal_turret_floor
	angles
	PickupEnabled (bool)
	TurretRange
	-OnTipped
	
info_paint_sprayer
	radius_grow_time_min
	angles
	radius_grow_time_max
	blob_spread_radius
	targetname
	min_streak_time
	start_radius_max
	blobs_per_second
	start_radius_min
	silent (bool)
	min_streak_speed_dampen
	end_radius_max
	end_radius_min
	max_speed
	max_streak_speed_dampen
	max_streak_time
	min_speed
	maxblobcount
	AmbientSound
	PaintType
	start_active (bool)
	+Start
	+Stop

prop_under_button
	angles
	Delay
	-OnPressed

prop_under_floor_button
	angles
	-OnPressed
	-OnUnPressed

npc_wheatley_boss
	(unlikely to be used for mapping, same as npc_personality_core)
	disableflashlight (bool)
	disableshadowdepth (bool)
	disableshadows (bool)
	+RunScriptCode

prop_monster_box
	angles
	BoxSwitchSpeed
	disableflashlight (bool)
	disableshadowdepth (bool)
	disableshadows (bool)
	fademindist
	fadescale
	inertiaScale
	physdamagescale
	spawnflags
	targetname
	-OnFizzled

prop_wall_projector (hard light bridge)
	angles
	StartEnabled (bool)
	targetname

prop_tractor_beam
	angles
	disableshadows
	linearForce
	StartEnabled
	targetname
	+Enable

Please add this to the OP:
ALL 105 ORIGINAL PORTAL 2 MAPS DECOMPILED, WITH STATIC PROPS AND FIXED ROTATIONS ON INSTANCES: http://dl.dropbox.com/u/813382/VHT/Original Maps.7z
 
Last edited:

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
Where doth I download the latest GCFScape from? Nem's stie is stuck in 2006.
 
Feb 14, 2008
1,051
931
A little clarification, open the VPK at this location C:\Program Files (x86)\Steam\steamapps\common\portal 2\portal2\pak01_dir.vpk (or whatever your computer has) to extract models/materials.
 
Feb 14, 2008
1,051
931
I updated the OP with a list of new entities we can use, and their properties (that I could find), I'm going to look into formalising this into an FGD.
 
Feb 14, 2008
1,051
931
If someone hasn't beaten P2 that entity list comes with a pretty big spoiler

I think that's a risk you take if you decide to map for a game before you beat it.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Where doth I download the latest GCFScape from? Nem's stie is stuck in 2006.

Don't. Crafty has a file system browser that's meant to replace it (although there haven't been any changes to Source that break the former yet), so you might as well start using it now if you don't already have GCFScape.
 
Jan 20, 2010
1,317
902
It seems that whenever I load maps, it crashes a lot. Not sure what from, but it always seems to be when looking at certain things in a map.
 

pisaman2

L1: Registered
May 27, 2009
34
1
Is there any way to filter the models like the textures? Don't wanna use any from alien swarm
 
Feb 14, 2008
1,051
931
I'm not sure pisaman.

I've just add a draft of an FGD to the OP. It's missing a few entities, such as linked_portal_doors, most NPCs (except turrets, which are there), and bombs. Some functionality such as reverse tractor beams is also missing, but hey, it's only a draft. This lets you add entities using the entity tool, and use the SmartEdit feature when editing their properties.
 

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
How do I make the AS compiler NOT turn everything into a func_detail?
 
Feb 14, 2008
1,051
931
How do I make the AS compiler NOT turn everything into a func_detail?

Go to advanced compile, and in the $bsp_exe bit, remove the "-alldetail" parameter.

I just updated the FGD to fix some stuff with cubes and lasers.
 
Last edited:

Yacan1

D I G I T A L I N F L U E N C E R
aa
Nov 7, 2010
411
793
Between steps 4 and 5, where can p2_Draft be found? I searched for it after I ran fix_models but, it isn't present. Or did I mess up as usual?
 
Feb 14, 2008
1,051
931
I've added instructions on how to get paint working.
 

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,818
The fgd link is broken. caused my hammer to crash twice before I realized I tried to load dropboxes 404 html page as a fgd.
 

dubca7

L1: Registered
Apr 21, 2011
2
0
I registration just to thank you for this awesomeness, can you re-upload p2_draft.fgd so I can try it out :)