Possibility of Portal 2 SDK/Source Code Release
Hello,
Several months ago, I opened an issue on the Source SDK 2013 issue tracker, requesting the inclusion of Portal 1's code within that SDK. Although that inclusion has yet to occur as of me writing this, I believe an accompanying issue for Portal 2 is a good idea, as this is also widely desired within the modding community (arguably even moreso than for Portal 1), and there would be some differences compared to making a Portal 1 SDK available.
The underlying reasons for why a Portal 2 SDK is highly desired are much the same as the first game. Modding Portal 2 is possible, and the modding community is fairly active, but it has always been hampered by the lack of source code access, preventing projects equivalent to Mapbase from being created or even just modders making small changes to suit their own mods. This is worsened for Portal 2 due to the game's reliance on specialized entities for its various test elements, as well as the game making use of hard-coded string lists for various things, most notably the new game chapter list. All of these things cannot be modified without code access, or maybe hex editing if the changes you need are small.
Obtaining Portal 2's code in any form is difficult. Even leaks are not an option, as unlike the first game, Portal 2's code has never leaked in full. Effectively your only option is acquiring an official engine license. The project Portal 2: Community Edition got licensed a few years ago, with the goal of attempting to sort of stand in for an SDK by providing extended scripting functionality, but as I explained in the corresponding Portal 1 issue:
While I believe there is still a place for projects like P2:CE in the Portal modding scene, so far it has yet to get anywhere close to matching what would be possible with a proper SDK, and likely never truly will.
(Also, while P2:CE itself is officially licensed, the legality of other mods bundling P2:CE's precompiled binaries to make use of its scripting functionality is unclear, and may not be viable for mods wanting to release on Steam or simply be free of legal baggage.)
Thus, many projects that want to go beyond Portal 2 or P2:CE's capabilities are forced to attempt to obtain an engine license directly from Valve, which is a vague and difficult process. There's no clear path to doing so, you need already to have an established project to acquire the license for (if your project idea completely hinges on custom code, tough luck!), and on top of all this, licenses have continued to become harder and harder to obtain over the years as a result of the large volume of leaks and simply Valve moving away from Source 1. Some mods like Desolation have managed to get licensed successfully, but others such as Catalyst have become stuck in "licensing limbo", with their support tickets seemingly having been lost amongst the mountains of others received by Steamworks support every day.
Making a Portal 2 SDK available would not only be a huge boon to the modding community, but would also take the responsibility off of Valve's shoulders of having to license Portal 2 mods, as those projects could simply be pointed to the SDK instead. Most of the same points I listed in the Portal 1 issue for why there seems to not be anything against an SDK apply here too:
- Portal 2 has multiplayer, but given that we got a TF2 SDK earlier this year, there seems to be enough confidence in the engine's security for this to not be a concern. Portal 2's multiplayer is also much smaller scale (2 players only) so things are easier to manage (although mods might increase this).
- Portal tech in games is well documented all over the internet at this point and there seems to no longer be much reason to try and keep the details secret - or even a desire to, given that Valve employees have hosted official presentations talking about it. The paint tech is less well documented to my knowledge, and could perhaps still be meant to be a secret (probably not), but most of that is in engine code which wouldn't be a part of an SDK anyway (though it would be awesome if it could be moved into game code somehow).
- A lot of the original Portal devs no longer work at Valve, but the same can be said about a lot of other games including HL2 and TF2, and that hasn't stopped them from getting SDKs.
- Portal 2 is no longer actively updated, although it does technically have an item economy, but that didn't stop TF2 from getting an SDK. (And let's be honest, when was the last time you heard of someone buying a Portal 2 Hat?)
That being said, there are various reasons making a Portal 2 SDK would be more difficult than for the first game, but none of these seem like they should be deal-breakers:
- Portal 2 runs on its own unique branch of the engine, which isn't shared with any other first-party games - this means an existing SDK base cannot be used/updated, there would need to be a dedicated "Portal 2 SDK Base" app made (or mods would need to run on the base AppID which would risk updates breaking them). Making new AppIDs isn't that hard though (surely even less so if you're Valve), and it could simply be added to Portal 2's Steam "package" so that purchasing the base game gives you the SDK base automatically. It could probably even share content depots!
- Item economy integration for mods would need to be implemented. This should just be handled the same way as TF2 (mods getting read-only access).
- Code for
matchmaking.dllwould need to be included, which it was not in Alien Swarm. This is essential for Portal 2 code modding, as a number of things were relocated here which were in the client/server DLLs in prior games (e.g. achievements). The matchmaking DLL is already located in the game bin folder and set up to be modified per-game, so this should not be difficult. - There are various Portal 2 specific
#ifdefsin the engine code which should ideally be removed to allow mods to make use of the original functionality if they want. - Worse, there are a few checks for the
portal2game directory in engine code - notably, one in the material system which causes mods to crash on large maps that work fine in the base game. These should ideally be changed to either always use the vanilla behavior, or be manually configurable by mods in cases where that would be beneficial. - Dedicated server support would be nice - simply including the executable so mods can use it is good enough, even if it doesn't work with the vanilla game DLLs.
- Alien Swarm's
-override_vpklaunch argument would be nice to have for development purposes. (Alternatively, the entire Source 2013 search path system could be ported, but this would require more effort.) - There are some portions of the Portal 2 game code which aren't even given out to licensees currently (puzzlemaker, motionpack, educational version). It would be nice if these could be included, but if they can't be, it's not a big deal.
Once again, I ask whoever at Valve reads this to please consider trying to make this a reality. If you can't, then talk to someone else in the company who can. The entire Portal modding community would be grateful to you, and I think the staff who have to deal with engine licensing would be too. If Team Fortress 2, a live-service, still-somewhat-supported multiplayer shooter with an active item economy could get a code SDK, then I see no reason why Portal 2 couldn't. It would be a bit of work, but it would be worth it in the end. Thank you.
(Note: I'm aware of issue #21. While the title makes it seem similar, the post seems to moreso be opposing the usage of GitHub issues for a closed-source project, rather than actually requesting the inclusion of the source code. It's also over 10 years old and not really reflective of current circumstances.)
My own personal addition to this is, I would be okay sacrificing the prospect of a SDK for Portal 1 if it meant we get one for Portal 2 instead, given by default Portal 2 is going to share a lot of the base underlying features that make the Portal games distinct in the first place.
While most people would argue about how there are some major differences between the two games that could rationalise both games getting SDKs (i.e. Firing a portal is hitscan in Portal 2 but a projectile in Portal 1. The game movement is different between the two games due to using differing values.), these could be reimplemented by modders if the Portal 2 code was made available in the first place.
I think if a Portal 2 SDK was going to happen, Portal 1 might as well also get one, since the amount of work for that would be trivial compared to Portal 2, and any legal clearance or whatever that needs to be done before releasing the code could probably be done at the same time for both games.
That being said, if it really came down to having just one or the other (or having one of the two first), I would also prefer Portal 2 being made available over Portal 1.
I support this!
I wholeheartedly support this.
I'm unsure as to what would have to happen behind the scenes at Valve to make it happen, but with how open Valve has become (with Source 1 at least) it is definitely in the realm of possibility now. Good chance we'll have to wait until 2027 (20th anniversary of both Portal and The Orange Box) although really anything is up in the air at this point.
It would be fantastic to have this! It would make it much easier to make custom systems for our projects rather than trying to jankily hack around it with map logic, VScript, or random commands that most people don't even know exist.
yes. we NEED an offical portal 2 SDK that isnt just its authoring tools.
Bump..
it would make it so much easier to make a porta 2 mod if this happened
I'd LOVE it if valve released a Portal 2 SDK
totally agreed
From: 3kotyX @.> Sent: 22 October 2025 5:36 PM To: ValveSoftware/portal2 @.> Cc: Callum @.>; Comment @.> Subject: Re: [ValveSoftware/portal2] Possibility of Portal 2 SDK/Source Code Release (Issue #460)
[https://avatars.githubusercontent.com/u/142042334?s=20&v=4]3kotyx left a comment (ValveSoftware/portal2#460)https://github.com/ValveSoftware/portal2/issues/460#issuecomment-3433267911
I'd LOVE it if valve released a Portal 2 SDK
— Reply to this email directly, view it on GitHubhttps://github.com/ValveSoftware/portal2/issues/460#issuecomment-3433267911, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3FHBBMSK3AWXDD4KG4A4KT3Y6XCJAVCNFSM6AAAAACA2SKZ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMZTGI3DOOJRGE. You are receiving this because you commented.Message ID: @.***>