Please or Register to create posts and topics.

How to alter code in a Portal 2 mod?

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?

Does the src folder from SDK 2013 just go straight into my mod folder?

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.)

My stuff:
[spoiler]- BEE2 Addons | (BEE2)
- Hammer Addons
Maps:
- Crushed Gel
- Gel is Not Always Helpful[/spoiler]

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)

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.

Falsi sumus crusto!
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?

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.

My stuff:
[spoiler]- BEE2 Addons | (BEE2)
- Hammer Addons
Maps:
- Crushed Gel
- Gel is Not Always Helpful[/spoiler]

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?

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).

oh my god please HELP ME

please
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.

Falsi sumus crusto!