How to alter code in a Portal 2 mod?

Avatar
Doomaflatchi
28 Posts
Posted Jul 17, 2014
I'm having trouble getting started on my project. I've created a Portal 2 mod by following the tutorial found here, and now I need to make a few alterations to the code in Visual Studio 2010. However, I'm having difficulty getting the files in the right place.

I've downloaded the Soruce SDK 2013 from GitHub and built the everything.sln and games.sln solutions out of it, which I can open in VS, but I don't know how to put the file structure together so that the code files I alter will work in my specific mod. Can anyone give me some help here? Or a basic walkthrough on how to get custom code into a Portal 2 mod?

Advertisement
Registered users don't see ads! Register now!
Avatar
Doomaflatchi
28 Posts
Posted Jul 17, 2014
Replied 4 hours later
Does the src folder from SDK 2013 just go straight into my mod folder?
Avatar
TeamSpen210
608 Posts
Posted Jul 17, 2014
Replied 1 hour later
You can't/shouldn't be able to edit Portal 2's code - it's closed source. (SDK 2013 doesn't include the code for portals, probably so Valve can keep that to themselves for future games.)
Avatar
Doomaflatchi
28 Posts
Posted Jul 17, 2014
Replied 11 minutes later
So, just to be clear, is it completely impossible to use a linked_portal_door entity (a Portal 2 entity) in the same map as any modified code or custom entities? (I don't even need to change any Portal 2 entities - just the player, and create some new ones from scratch)
Avatar
FelixGriffin
2,680 Posts
Posted Jul 17, 2014
Replied 1 hour later

Doomaflatchi wrote:
So, just to be clear, is it completely impossible to use a linked_portal_door entity (a Portal 2 entity) in the same map as any modified code or custom entities? (I don't even need to change any Portal 2 entities - just the player, and create some new ones from scratch)

Yes, unless you want to recreate the portal code from scratch.

Avatar
Doomaflatchi
28 Posts
Posted Jul 17, 2014
Replied 53 minutes later

FelixGriffin wrote:
Yes, unless you want to recreate the portal code from scratch.

facepalm If that's the case, how do people make custom gels without getting at the code?

Avatar
TeamSpen210
608 Posts
Posted Jul 18, 2014
Replied 1 hour later
Sicklebrick was able to edit the compiled code slightly to enable unused code, but I doubt you'll be able to add lots of entities that way. Reflection Gel is already in the game, just unpolished and unused. Other gels have been made in hammer using vscripts, triggers and other things like that.
Avatar
Doomaflatchi
28 Posts
Posted Jul 18, 2014
Replied 52 minutes later
Wow, that's really troubling... well, doing my custom entities with purely in-engine scripting will be possible, I suppose (though likely frustrating). Any idea how "editing the compiled code" works, or what its limitations are? Or just where I can learn more about it?
Avatar
opticalprocessor
88 Posts
Posted Jul 18, 2014
Replied 5 hours later
Just wanted to point out that the se2007 (portal, tf2 etc) leak exists, which would provide you with a variety (2) of options.

Option 1. Download the code and publish as an underground (illegal) mod.

Option 2. Download the code, study it and pretend that you simply came up with it (while still actually rewriting everything).

Advertisement
Registered users don't see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted Jul 18, 2014
Replied 2 hours later

Doomaflatchi wrote:
Wow, that's really troubling... well, doing my custom entities with purely in-engine scripting will be possible, I suppose (though likely frustrating). Any idea how "editing the compiled code" works, or what its limitations are? Or just where I can learn more about it?

You run the game/dll through a x86 disassembler, edit the semi-obfuscated and undocumented assembly code by hand, then assemble it again and see if it works. Sickle was mostly fixing and re-enabling code that was already in the game, and it was still an incredibly massive and impressive undertaking. Adding a custom entity would be near-impossible.