H
H
hleb12022-03-09 20:19:51
Game development
hleb1, 2022-03-09 20:19:51

How are game mods written?

We have a game. Let there be Minetest (Free Minecraft clone). Naturally, source codes are attached to Minetest (if it somehow alleviates the situation).
Question: how should I write a modloader for the game?
Those. as I see the situation: I am writing a mod that adds new creatures. And how do I "link" it with the game? Re-compile chtol?
(!!! I understand that you can take and read the documentation on modding for Minetest.
I want to understand: how to add mod support for YOUR game )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2022-03-09
@hleb1

Question: how should I write a modloader for the game?

An abstract modloader is needed only when the game developers did not provide mods from the very beginning.
I want to understand: how exactly to add mod support for YOUR game

Depending on what language you are writing the game in, you will need to somehow dynamically load external modules and run code from them.
For example, in C# and Java, this is done using reflection.
Here is a specific example of how this can be done in C#:
https://docs.microsoft.com/en-us/dotnet/core/tutor...
In compiled languages ​​like C++ or Rust, you will have to drag some kind of interpreter with you (well this is the easiest option for both the game developer and the mod developer).
For example lua or wasm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question