I might as well answer some questions while I'm around. I'm not OP, but I know plenty about this stuff.
fdagpigj wrote:First of all, do you have any clue if this'll work on all three operating systems? ...
Would a mod made for one work on all?
This method works on all operating systems, but you pretty much have to implement your "mod" separately for each platform. If the FTL executable was compiled with a different compiler on different platforms, the assembly code will almost certainly be completely different between executables. This means you will have to reverse-engineer the game 3 times, and implement your mod 3 times.
fdagpigj wrote:Do you know if there are tools available to do this kind of thing on the other OS'es?
There definitely are.
fdagpigj wrote:One thing of course will be safety, since I imagine if it injects assembly code into the program it could be used to transfer viruses
This is 100% true. If you're running a script that modifies the game's code, you are effectively giving the script 100% control of your computer. From a security perspective, it's the same as running an executable that someone has made. Ideally, you would want "mods" like this to be open-source so that you can read through the source code and make sure it's safe, and you have a good point that mods that involve modifying assembly could be quite hard to read.
There are a whole lot of windows reverse-engineering tutorials on the internet. If OP disappears, I could probably make an FTL-specific video tutorial, but any "complicated" modification is going to require modders have a whole lot of experience with this stuff, and one tutorial really won't be enough to get people there.
NarnKar wrote:I'm not entirely sure it's assembly; it might be bytecode? IDK. If it's a series of hex values it's bytecode
"Machine code" is the binary code that your CPU executes.
"Bytecode" reffers to machine code designed for a virtual machine (i.e. a fake CPU, e.g. Java)
"Assembler" is a human-readable textual representation of machine code.
For example, the x86 Assembler instruction "pop eax" is represented as the hexadecimal byte "58" in x86 machine code (or "1011000" in binary if you're an edgy kid).
A disassembler (what OP and any sane reverse-engineerer uses) displays a program's code as assembly, human-readable machine code. Usually, the disassembler will also have the hexadecimal machine code representation for each displayed instruction juxtaposed next to it.
NarnKar wrote:One thing I thought of for mass/casual distribution was this:
This is exactly what I was working on two years ago! Except it exposed a full-feature programming language for modders to use, with simple-to-use hooks so they could change core aspects of the game in any way they wanted. Unfortunately, at the time I couldn't find anyone to work on it with me, and I really did not have enough time to implement it by myself (work, uni, etc
). Again, if there are any programmers around here who want to help, I'd be more than happy to start working on that project again.
And here's my input for anyone interested in this thread:
Working in assembler isn't particularly easy to get into, even for people with existing programming experience. In fact, there's a beautiful image on the internet that sums it up pretty well:
That's why I was previously working on building a simple scripting API built on top of my own interface with the game, so that no modder would have to come anywhere near the game's machine code. this would also allow modders to write their mod on one platform and have it work on all. It would also alleviate some of the security concerns, since the interface layer between FTL and the modders scripts is the only part that would need to have access to the game's assembly. The modders scripts themselves wouldn't need to directly modify the game's assembly at all.
Apart from that, to answer all your questions of what is and isn't possible, literally anything
is possible when "modding" the assembly in the game, since you are literally re-programming the game.
Wow... this post ended up a whole lot longer than I thought it would.