Retasking an existing OOP oriented code base is like playing Jenga. You pull one block out, and no matter how careful you are when you pull the block out there’s always going to be the chance that there’s other blocks weighting themselves fully onto it. Crash.
When approaching the job of modifying the Portal2 code to become Dear Esther I decided at first to go with the option of removing the preprocessor commands that specified that I was building the Portal2 specific game dlls (server and client). This was akin to approaching a game of Jenga by knocking the whole tower down and rebuilding it. Jenga in reverse… Maybe ‘pick up sticks’ is a better childhood game related analogy to use.
I was faced with over 300 linker errors where files were demanding that the portal2 files be located (and low level objects at that) I shifted my tact to pulling thing out bit by bit and leaving the preprocessor commands in. 300 linker errors isn’t 300 linker errors. Each file you remove will often cause another file/s to scream out with it’s own linker error demanding you locate the file you just removed… And you go on like this until you can either negate the screaming (with hacky macros oh joy!) or the screaming stops.
I quickly got a game running this way but unfortunately it suffered erroneous rendering (it was rendering EVERY viewport overlay material all at once aswell as rendering in splitscreen with the second player screen rendering an empty frame buffer). So then, and I guess this is where the Jenga analogy comes in, I set about carefully removing all the non-Dear Esther vital components hoping to be able to strip out all the Portal2 specific objects without causing too much of a hassle… There was hassle. All too quickly I was facing 200+ linker errors and realised that my original plan was probably just as good.
So I re-removed the preprocessor definitions and have spent the last 20 hours dealing with them all one at a time (aswell as building a dummy UI which is essentially a carbon copy of the Portal 2 UI with Portal2 specific features ripped out of it). Finally now I can run a game, there aren’t too many asserts being thrown to the debugger (for some reason it hates me noclipping around…) and by 3am this morning (or 3 am tomorrow we’ll see) I should have a build fresh off the press to run over to Robert.
I have drunk upwards of 20 cups of coffee in this period… Probably well up