Injected native code plug-in support

Post Reply
pevernow
Member
Posts: 10
Joined: Sun Oct 04, 2020 04:33
GitHub: pevernow
IRC: pevernow
In-game: pevernow

Injected native code plug-in support

by pevernow » Post

At present, Lua mod has the advantages of cross platform and relatively high performance.

However, it is also obvious that the minetest engine is written in C + +, but mod uses the Lua environment.

Mod cannot access and modify the content in the engine (rendering part or network transmission part).

Executing some code that requires higher performance in Lua will greatly reduce performance.

Referring to the relationship between minecraft and forge, they are executed in the same language and support modification engines (such as optifine and sodium), which can greatly improve the customizability of users.

In my opinion, it seems that the native plug-ins can modify the engine functions by using C + + injection.

If you can develop an external engine similar to forge and provide methods similar to Lua API and modify the engine, you may be able to change this.

Mineminer
Member
Posts: 325
Joined: Mon Mar 05, 2018 04:05

Re: Injected native code plug-in support

by Mineminer » Post

pevernow wrote:
Thu Aug 05, 2021 04:56
At present, Lua mod has the advantages of cross platform and relatively high performance.

However, it is also obvious that the minetest engine is written in C + +, but mod uses the Lua environment.

Mod cannot access and modify the content in the engine (rendering part or network transmission part).

Executing some code that requires higher performance in Lua will greatly reduce performance.

Referring to the relationship between minecraft and forge, they are executed in the same language and support modification engines (such as optifine and sodium), which can greatly improve the customizability of users.

In my opinion, it seems that the native plug-ins can modify the engine functions by using C + + injection.

If you can develop an external engine similar to forge and provide methods similar to Lua API and modify the engine, you may be able to change this.
I think the underlying issue with such implementations that it's a huge resources' and time sink.

Minecraft and Forge both have resources' and time at their disposals that its extremely proportional to what's Minetest gotten to this point.

Maybe there's a less intensive way to reach the same set of goals as your trying to resolve though...

User avatar
Blockhead
Member
Posts: 1624
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Injected native code plug-in support

by Blockhead » Post

Dealing with the Lua interface to send stuff back to lua is an overhead in and of itself. You should probably very critically look at what would be really, properly useful to have in C++ and infeasible in Lua, and contribute that back to the engine with a Lua interface. Native code has other major drawbacks, like requiring compilation ahead of time which has to be done for each operating system and CPU architecture.

The implementors of Lua and the minetest engine also have the advantage of a much bigger user base than whatever your plugin/mod would be. This means the Lua/LuaJIT authors have spent time making sure that Lua does actually run faster than you might assume. Show me data that your native code will be as fast and then I might be convinced.

Minecraft Coder Pack, Minecraft Forge et cetera are also not ideas we should think positively of. They are a product of the proprietary, non-cooperative nature of Mojang, a subsidiary of Microsoft, and its refusal to acknowledge the modding community of that game. It's not in the commercial interest to make an official API either, because there's a millions-strong useds-base (see Stallman's definition of used as opposed to user) that will do their work for them. Not only is the core product of Minecraft proprietary and obfuscated, which is only undone by Forge, but also many of the mods, because the proprietary nature of the core perpetuates proprietary extensions. The end result is a mostly opaque game where you have to put Java code that you just choose to trust into your game and the only way to know it's safe is to put it through a Java decompiler and audit the decompilation.

Minetest is fundamentally different. Minetest is free software and most mods for Minetest are free software. You can obfuscate your Lua code if you want, but someone who wants to study your code still wouldn't even need a decompiler, only a de-minifier and patience. Native code blobs on the other hand will please people who want to obfuscate their code more. See also: Is Minetest secretly SaaSS?, where it turns out the real way to keep your Minetest mods proprietary is to only run them on your server.

Sorry, I got off-topic there for a bit. Anyway the whole thing has been discussed ad nauseam here: https://github.com/minetest/minetest/issues/4064
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest