Modding ITB: R&D And Current Findings

Discuss and distribute tools and methods for modding.
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Modding ITB: R&D And Current Findings

Postby Sleeper Service » Tue Feb 27, 2018 12:14 pm

This is a place to post any new findings you deem notworthy regarding modding ITB, so that other modders and the community as a whole can make use of them. Happy hunting!

Hi all, just starting the usual modding R&D thread, basically works the same as the one we had going for FTL in the early days. Good times. I'll start:

ITB uses the same .dat format as FTL (at least up to now during the beta, I doubt that'll change on launch). This means you can use tools like the good old FTL unpacker to unpack ITBs data and assets. Just tell it where ITBs .dat file is (look for it in ITBs steam folder) and it'll unpack it for you, no questions asked. So technically you should be able to unpack change and repack the .dat from day one. Almost like day one mod support! :D Handling multiple mods simultaneously will probably require a dedicated ITB mod manager though.

ITB doesn't use .xmls to handle gear and units, rather it uses lua (?) scripts, actual accessible game code you can modify and potentially extend. The scripts can be found in the steam folder even without extracting the dats I think? (Sorry, been a while since I looked at this, needs confirmation)
Image
User avatar
Jumbocarrot0
Posts: 422
Joined: Sat Oct 21, 2017 1:18 am

Re: Modding ITB: R&D And Current Findings

Postby Jumbocarrot0 » Tue Feb 27, 2018 7:37 pm

The accessible game code seems exicting. Greater modding potential is always fun.
Image
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: Modding ITB: R&D And Current Findings

Postby kartoFlane » Wed Feb 28, 2018 12:02 am

So, to start off. I poked around the files for a short while before playing the game. Some notes:
  • Like Sleeper mentioned, it seems most of the game mechanics have been implemented in lua scripts. This is great news -- this means that mods will have crazy potential. Pretty much no more "can't do that because hardcoded" (though limits will probably still exist in some form).
  • A list of all scripts in scripts.lua -- adding new script files will probably require adding their name to the list there.
  • Sprites, animation sprite sheets, and fonts stored in resource.dat, with the same .dat format as in FTL. So same principles apply.
  • Music and sounds stored in .bank files. I'm not familiar with this -- these seem to be FMOD bank files (further evidenced by the presence of fmod.dll in game directory). Anyway, looks like adding new music or sounds will require a little more effort/research.
  • Map data stored in what appears to be just lua objects (tables/dictionaries). So new maps should be fairly straightforward to add. These files are probably later referenced by lua scripts which describe missions or islands. Custom sizes (other than 8x8), precise control over which tiles are what (building, grass, water, forest...), possibly pre-set spawn points for enemies. No idea how the game will handle non-standard map sizes, though.
Overall this looks really good. A lot more possibilities here than in FTL.
Superluminal2 - a ship editor for FTL
wcarss
Posts: 1
Joined: Wed Feb 28, 2018 12:51 pm

Re: Modding ITB: R&D And Current Findings

Postby wcarss » Wed Feb 28, 2018 2:02 pm

As expected, the ftl_dat extractor worked great for unpacking the images. :D

For the .bank files: I did some digging and got them to extract to wavs, but I don't think this method will help to repack them. I haven't tried using real fmod tools yet. Here's what I did instead:

  1. download QuickBMS custom-file-extractor from here (the very top bullet-pointed line is the windows exe link)
  2. drop the script from the snippet in this post into a text file near the QuickBMS executable
  3. run the QuickBMS executable and, following its direction, select the BMS script, .bank file, and extraction folder to receive an FSB file named like 00000000.fsb
  4. download id-daemon's fmod_extractors tools and the fmod dlls also linked there (aezay's fsbextractor seems better known, but doesn't work well here. Explanation below.)
  5. run the fsb_aud_extr.exe file from the fmod_extractors on the fsb file that the QuickBMS extractor pulled out of the bank file. :lol:
  6. wav files appeared in the folder where the extraction tool was run. One note of caution: the wavs are huge! There will be GBs of sound data overall.
(disclaimer: I accept no responsibility for the results of downloading+running anything linked above, at the least scan things with antivirus software before running them!)

Explanation: the .bank file is a RIFF file, which is a common container-format (RIFF stands for Resource Interchange File Format). This is likely just the format output by fmod studio or whatever specific tool subset used to pack up the audio. It contains both the FSB file (the actual sound bank) and an FEV file (I think this is metadata like revision info, etc). The FSB file is a well-known format that people have written extractors for -- it's just a collection of audio files. Unfortunately, a quirk of the format seems to be that audio files stored in it don't have any header information with them, likely to save space.

aezay's really nice fsbextractor tool can scan through the .bank file and find the FSB in there, and then pull out all the audio files from the FSB. It can even get .oggs out, and those are what are inside Into the Breach's sound banks! But, sadly, it cannot currently handle the fact that the .oggs don't have headers, so they're all unplayable. You might be able to use an ogg-fixing tool to fill header info in for them -- I didn't go down that path.

Instead, you can use id-daemon's slightly more rustic fmod_extractors tools, which can read from an FSB and grok the .ogg files well enough to write them out as playable .wavs. Unfortunately though, this tool cannot scan through the .bank file that we actually have like aezay's tool can -- it needs the FSB file to be out on its own.

So that's why we need to use a custom file extractor that searches through a .bank file for an FSB version 5 header, and then dumps that content out as a file. aluigi's really cool QuickBMS program is just such a tool, that lets you write custom extraction scripts to do that kind of thing. And aluigi even wrote a short script to handle this exact task, which you can copy and use to get the FSB file out of the bank.

With the FSB file in hand, id-daemon's extractor will get out the .wavs, and you have access to the audio resources. I think we'd need to write some custom software to repack these resources if we can't just use fmod's tools for all of this. Which I'm only bothering to check out after writing this post!

Update: FMOD's tools appear to (by design) be not capable of opening packaged .bank files, to make it a little bit less easy for bad folks to steal audio assets wholesale. Fair! It seems like they contain much richer data than I understood at first, so my theory is that someone would need to write a bank extractor that generates an FMOD-compatible project if people want to correctly modify the in-game assets for use in a mod.
User avatar
Crazybat
Posts: 49
Joined: Sat Jun 20, 2015 6:08 pm

Re: Modding ITB: R&D And Current Findings

Postby Crazybat » Wed Feb 28, 2018 9:47 pm

It's good to hear that the game code is turning out to be far more flexible than FTL. More than anything, I'd hope we figure out a way to add modded mechs into the game as opposed to replacing them ala FTL.
User avatar
stickthemantis
Posts: 37
Joined: Wed Jan 29, 2014 4:16 pm

Re: Modding ITB: R&D And Current Findings

Postby stickthemantis » Wed Feb 28, 2018 9:54 pm

Heya, I'm Cyberboy2000 from the Invisible, Inc. community. I tried to make an account for this forum but it's been over a day and the verification email hasn't arrived so I'm using this old account I made a long time ago. If there is a way for me to change my name I'd appreciate knowing about it.

Anyways, I am excited to see what ways this game can be modded, especially since I am know lua from modding Invisible, Inc., which has some amazing modding capabilities since basically all of its game logic written in lua and the majority of all other code is too.

I've looked at the lua scripts for this game and unfortunately the core simulation engine doesn't seem to be in there, nor is anything UI related except for the text. So even with lua it's not as flexible as we might have hoped for. You can't for example add new effects like acid or fire. It might still be possible to come up with some clever workaround for this, but it's not looking good.

What can you do? Well it looks like you can add new mission types. Since you can actually script these rather than relying on event trees this appears to be more flexible than events in FTL, which is definitely cool. You can add new weapons and mechs, but they unfortunately seem to be under roughly the same limitations as weapons and ships in FTL. Yes that probably includes being limited to the same number of starting loadouts as in the base game.

Sadly, the pilots seem to have their abilities hardcoded. Not sure if you can add in your own and reuse someone else's ability.
I'm Cyberboy2000, known as a modder and community leader of Invisible Inc.
I'm using this old account because I've been unable to get any verification email for a new account. Help with changing my name would be appreciated.
rannl
Posts: 335
Joined: Sun Nov 25, 2012 11:13 pm

Re: Modding ITB: R&D And Current Findings

Postby rannl » Fri Mar 02, 2018 2:24 am

Hey there Sleeper (St) and Karto (To).
You guys want to join forces again and work on modding ITB ?
leper911
Posts: 3
Joined: Sat Mar 03, 2018 12:25 pm

Re: Modding ITB: R&D And Current Findings

Postby leper911 » Sat Mar 03, 2018 12:36 pm

Press "~"(tilda) and console appear.
command on map screen:
debug - debug on/off
mapedit - builtin map editor (edit null.map for default setting)
rich - you are rich
help - show command
victory - instant victory
kill - kill all enemies on current map
save -save current
loadfonts
undoturn
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: Modding ITB: R&D And Current Findings

Postby kartoFlane » Sun Mar 04, 2018 1:54 am

Do you have anything specific in mind, rannl? I think in the first place we need to figure out a standardized way to install mods, like an equivalent to .ftl files -- simply copying the .ftl approach is a good start, but appending stuff to lua files is not gonna work.

In other news, I've been taking jabs at the island system, trying to see how flexible it is. It seems that islands can be reordered, and new ones added. However, there's one issue: even though region graphics can be changed, it seems that the game uses the old hitboxes anyway. My guess is that the game is hardcoded to look for region names 'island_0_#_OL.png" for the first island, without really caring about the name provided in the lua script, and uses that graphic to generate the hitbox. This means that it's not gonna be possible to make randomized islands purely via scripts -- this is going to require third-party programs to modify image names.
Superluminal2 - a ship editor for FTL