2
\$\begingroup\$

So my questions are:

  1. Is it possible to mod a game to use a scripting language?
  2. How would I go about doing so?

I really like Arma 2 but like many games it does not have much in terms of capabilities beyond using server commands in scripts. That makes it pretty limited.

Personally I would like to add the ability to use a different language than Arma 2's scripting language; possibly Lua.

How could I make Arma 2 use Lua? Is there a way?

I remember from when I just a teenager and into modding Halo PC some people had created scripting mods for that game. How did they do that? I hope this question isn't too general or difficult to answer.

\$\endgroup\$
  • 1
    \$\begingroup\$ Yes. Yes, it is. Although, it won't really be easy... :) \$\endgroup\$ – Vaughan Hilts Apr 29 '14 at 14:54
  • \$\begingroup\$ The game company must expose an interface which you can script against. I don't know if Arma 2 does this. \$\endgroup\$ – ashes999 Apr 29 '14 at 15:08
7
\$\begingroup\$

It depends on what kind of modding the game allows.

When the game in question already includes a sufficiently powerful script interpreter, one could write a transcompiler which takes a script written in Lua and transforms it into a program in the scripting language of the game so that it can be executed. Alternatively, one could even create a Lua interpreter in that scripting language directly when the language is powerful enough to do so. But seriously, when the scripting language is already that powerful, I would recommend to just learn that language instead, because this approach will not enable you to do anything not already possible with the existing language.

When the game is modded via plugins in form of dynamically linked libraries (DLLs), one could write such a library which includes a Lua interpreter and exposes the whole API of the original engine to that interpreter.

When the game has no modding support at all, you would need to create some through hacking the binary code of the game executable. This is a very hard and tedious way of doing software development, so when you are determined to create a very ambitioned mod for a game which isn't meant to be modded, it would not be a bad idea to start with paving a way to get stuff done in a more high-level language like Lua so you can work more productively. This could take the form of jumping into a Lua interpreter while also exposing all kinds of interesting functions of the game to that interpreter so it can call them.

Usually mod-friendliness is a complex design requirement you need to take into account during the whole development process of a game. Adding it later as an afterthought is often difficult, and even moreso when you don't have access to the original sourcecode. It might in fact be easier to create a clone of the game from scratch.

\$\endgroup\$
  • \$\begingroup\$ I remember moding Starcraft AIs. There was no support for what I was doing. The mod consisted of poking assembly instructions into the code after it was loaded. \$\endgroup\$ – Cort Ammon Oct 5 '17 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.