But we have the source code.. we can patch in any hooks we want..
Sure, bar new assets we can do whatever we want. No limits.
Also you can always do code injections even if that wasn't the case to hook your code into the existing methods..
Hm, let's see...
Yes, you're totally right. It only requires the target runtime to be exactly the same as the one you used to build your new code to be injected. Or, in other words: without any other mods.
None of this stuff is new or difficult. For C# or Java you can simply inject classes or methods into the IL/Bytecode and add a @Before and @After call to your code blocks.. or just subsitute the method call completely.. it's all fully decompilable.
For C++ you just need to hook in a few detours and from there you can write a .dll file that has callable methods.. This is how D2Hackit and many code injections work.
I agree, no problems there, as long as your target code stays the same. No updates, no other mods.
Mods won't be compatible with one another, though. Pick one, and only one, or roll your own.
Again this isn't fully correct.. Mods will step on each other if we are just patching in code to the CSharp Assembly.. which is what i was currently working on.. it's a heuristic nightmare trying to get a proper changeset that compiles in the same method though so I have abandoned that idea (Although it did work if the mods never touched the same code).
Exactly.
As I said before the best way is going to be creating hooks into the code you want and allowing a user to easily define new objects that get generated through reflection or dataloaders and passed into the main game, so you can regulate and moderate all the mods with a patcher tool.
What you're proposing is writing a generic API. No problem there. Can be done.
Then again, how are you going to get every other modder on this planet to use your API, instead of just modding whatever code of the base game?
Thinking of a solution? Easy. Implementing that solution? A bit harder. Selling it to everyone involved? Only the very best are to have some hope of succeeding.