Can I use .NET to write business logic for external function hooks? #704
-
Hi, @julianxhokaxhiu! Hello, I would like to contribute to this project (for example, implement a turn-based combat system similar to what I did for Final Fantasy IX or loading texts from external .resjson files for easier localization). But I am very bad at C/C++, and I also think that this is a very dangerous language for developing such mods, since it is easy to generate AccessViolation and crash the game process. At the same time, I know .NET well and actively write game logic mods on it for various games, including games written in C/C++. Ideological question: can I raise the .NET domain inside the game process and write hook logic in C#? This will require the .NET Runtime and will slightly increase memory consumption (theoretically, we can make mods based on .NET optional to avoid id). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hello @Albeoris nice to see you here :) And thanks for rising this discussion, it's a very interesting one to unpack. While the integration can technically be done, it's not an easy one to tackle. We've done this already in 7th Heaven ( see the C++ loader that loads the .NET VM inside the native binary, the bridge between the C++ layer and the .NET layer, and finally the real .NET binary that we make use of to load mods ). Assuming the mod will be distributed with 7th Heaven my first idea would be to see how we could extend this layer to additional external .NET libraries that might want to manipulate the game memory, which I'm not against it but I've never explored it. If you're willing to take the adventure I'll be happy to support. I think it would make an interesting use case, and would open doors to .NET mods ( as we have the VM loaded anyway ). Let me know what you think, open for feedback! Thanks P.S.: https://github.com/quantumpencil did start something very similar back then, his mod is named SisterRay and it was supposed to tackle exactly the same area. You might want to have a talk with him as well, although the mod is supposed to be implemented in C++. Anyway it's safe enough to try. |
Beta Was this translation helpful? Give feedback.
Hello @Albeoris nice to see you here :) And thanks for rising this discussion, it's a very interesting one to unpack.
While the integration can technically be done, it's not an easy one to tackle. We've done this already in 7th Heaven ( see the C++ loader that loads the .NET VM inside the native binary, the bridge between the C++ layer and the .NET layer, and finally the real .NET binary that we make use of to load mods ).
Assuming the mod will be distributed with 7th Heaven my first idea would be to see how we could extend this layer to additional external .NET libraries that might want to manipulate the game memory, which I'm not against it but I've never explored it. If you're willing …