General stuff about how the porting went and what I did.
Tilesets:
Created a new base addon, "Dev/Tileset/Insert" after seeing the magnitude of the job
This addon completely automated extraction of the tile numbers/colors from the tileset raws (with the help of "Dev/Tileset/Extract").
Handled all the tileset d_init settings, this was more work than almost every other part of this job.
This step also included writing prep support, so prepping worlds with different tilesets should work fine
Added a custom version of "Base/Clear", the normal one will not work with Masterwork for Rubble as things stand.
(the custom version does not clear the creature graphics folder)
In the future it would be a good idea to allow multiple (completely different) sets of creature graphics (via addons).
Added the required SHARED_XXX templates, but only to the files that differ per tileset.
I really need to do all the files, but that will be a tremendous job, I'll probably just do a few at a time later.
Also the file formatting sucks, I really need to reformat all files, once again later.
Handled vermin tile numbers with the help of a slightly modified version of "Dev/Tileset/Insert", this addon rewrote all vermin creatures to use #TILE and #COLOR.
=================================================================
General Stuff To Do: (more things listed in individual files, search for "TODO:" and "TODO(Milo):")
TODO: How are buildings handled? I can't find their files. Do they even need to be different per tileset?
TODO: How should creature graphics be handled? Rubble supports graphics raw files natively so that's not a problem, but how does MW's launcher handle them? Some tilesets have files and others have none, it looks like the order that tilesets are chosen in determines the exact graphics configuration you get.
TODO: Find out who I need to talk to to get Rubble support for the launcher, it doesn't need to be complicated.
Basically it needs four things:
1) The ability to run Rubble to generate the raws using the selected settings
A nice prominent "Generate Raws" button, together with a simple reminder that settings only take effect after the next raw generation cycle would be needed.
2) The ability to select an addon based on tileset choice
This is closely related to #3
3) The ability to associate a setting with an addon
If a boolean setting is true then the addon should be active, it would be nice to use groups of addons for non-boolean settings as well, but that can be handled by config variables just as well (or better) (except in the case of tilesets, they have to be handled by addons, at least they do for now...).
4) The ability to associate a setting with a config variable
If setting is true variable should be "true" else variable should be "false"
(values chosen to allow easy integration with Rex, 0/-1, 0/1, T/F, YES/NO, ect. would work almost as well)
You can actually use any string for the value of a config variable, for some settings it makes sense to use booleans, but for others some kind of identifier (that a template handles) would make more sense.
For example the setting for when a civ should send caravans would be better if it was a short identifier string, then it would be easy to make a generic template that you just pass the variable in and it outputs the correct raws.
For now I have a simple hack I can use, so this doesn't need to happen right away as long as #1 and #2 are done
5) (Optional extra) The ability to run prep cycles.
Basically a simple list box that lets you pick a world to prep would be all that's needed
(a label explaining how prep works would be good as well)
(for those that do not know, prep is Rubble's way of dealing with worlds that have vastly different settings, to switch to a different world you use Rubble to "prep" the world you want and it make sure the tileset, init settings, and any other things like custom DFHack scripts are setup the same as when the world was generated)
Example Rubble command line:
Config variables:
TEST_1 = true
TEST_2 = false
SOME_SETTING = SOME_VALUE
Addons:
Masterwork/Base
Masterwork/Tilesets/ASCII
Command line (for the above settings):
`"./Dwarf Fortress/rubble/rubble.exe" -dfdir="./Dwarf Fortress" -outputdir="./Dwarf Fortress/raw/objects" -addons="Masterwork/Base;Masterwork/Tilesets/ASCII" -config="TEST_1=true;TEST_2=false;SOME_SETTING=SOME_VALUE"`
It should be possible to specify -config and -addons more than once, the results are just added together (I think)
It would also be best to use a copy of Rubble compiled as a wingui application, so the console window stays out of the way (this is easy).
It is also possible to start an application and order it not to display it's window, that may be easier.
If you wanted to be really advanced it would be possible to attach the launcher to Rubble's IO handles to make it easy for realtime log display, this is probably not needed, as it is fairly easy to protect from failure (via correct construction of addons) so there is no need for the user to see the log.
The leading causes of generation failures are:
Induced aborts (for example incompatible addons detected, not a problem here)
Script errors
Template errors
As you can see proper testing can prevent all such problems.
Once launcher support is a thing then I can start to handle more settings with Rubble (which will make everything much more flexible).
TODO: Now would be the time to extend the way Rubble handles config variables to allow reading them from a file.
It would also be a good idea to dump the config variables to a file in the raw folder, just like the addon list is handled now.
TODO: Change some of the default Rubble addons to use sort:maps in their scripts, this would sacrifice some performance (how much?) for the ability to regenerate a world, allowing you to do things like change tilesets on a world in progress
This would effect only library addons that generate inorganics or the like, "Libs/DFHack/Command" would be problem #1
This is really not worth doing unless it is implemented in the launcher alongside prep support.
=================================================================
To use this port: (assuming "." is the root of the Masterwork package)
The launcher should do it's stuff to the "./Dwarf Fortress/rubble/addons/Masterwork/Base" directory (as Rubble doesn't handle any of the non-tileset settings yet, support for other settings is coming).
Then run:
`"./Dwarf Fortress/rubble/rubble.exe" -dfdir="./Dwarf Fortress" -outputdir="./Dwarf Fortress/raw/objects" -addons="Masterwork/Base;Masterwork/Tilesets/<name of tileset>"`
To prep an existing world (provided the raws for it were generated by Rubble) run:
`"./Dwarf Fortress/rubble/rubble.exe" -dfdir="./Dwarf Fortress" -outputdir="./Dwarf Fortress/raw/objects" -prep="<world name>"`