0

My friend and I are working on a "mod" for a game called Stickfight. The mod is written in Kotlin (interoperable with Java), but it's limited due to the fact that we can't invoke methods.

Is this possible? Are there libraries for it?

If it helps, Stickfight was made in Unity.

ChrisUMB
  • 21
  • 1
  • Would do it via TCP commands – derHugo Oct 14 '19 at 05:12
  • Not unless stickfight offers some kind of interprocess communication (network communication or piping or something else) – Ruzihm Oct 14 '19 at 05:12
  • You could do it indirectly using anything existing with polling, eg a file or regkey. Directly you may be able to using iKVM (but it's no longer being worked on) or a command line argument that works on the exe independent, regardless if an instance of the exe is running or not. – Jeremy Thompson Oct 14 '19 at 05:18
  • I can't comment yet but this link might help?? [Call C# method from Java](https://stackoverflow.com/questions/33779069/how-to-call-c-sharp-function-from-java/33782015) –  Oct 14 '19 at 06:10

1 Answers1

0

Before anything else you should understand if the game was compiled with Mono or IL2CPP. If IL2CPP was used the original C# code is now C++ (compiled in native machine code) so you cannot call a C# method at all. If mono was used you should be able to invoke C# method but only if the developer of the game actually put some effort into the support of modding this way (more info here): http://www.somasim.com/blog/2017/12/tech-notes-unity-game-modding/

Of course there are multiple problems with this, one example is that this is only compatible with windows platform (but one of the awesome thing about Unity is that it will allow cross-platform support with a really small effort (the main thing to make it work on mobile is to create a touchscreen input system)).

Unity games are not easy to mod and the reason is that the framework is made to be cross-platform (and some platform do not support just-in-time and even IL2CPP does not support it). The only real solution is that the developer of the game decide to support a scripting language like lua with something like miniscript or moonsharp, but since you are not the developer I suggest you to contact the developer to understand if he/she will try to implement something to help you with modding.

LiefLayer
  • 977
  • 1
  • 12
  • 29