Ludeon Forums

Ludeon Forums

  • April 26, 2019, 12:48:42 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [Tool] Apparellator (Generate outfits and save them to Rimworld save)  (Read 3944 times)

Profound_Darkness

  • Muffalo
  • *
  • Posts: 6
  • Refugee
    • View Profile

Hello all, I'm stepping out of long time lurk mode to seek feedback on an idea.  I approached Shinzy first due to their mod (apparello) being the reason I even started fiddling on this but they were busy and suggested I solicit feedback from a wider audience.  NOTE: That shouldn't be construed as an endorsement of the idea or tool by them.

I call my presentation/example app: Apparellator (mediafire link to release 4).
NOTE: I put updates to this app in the folder This Mediafire Folder, usually without updating this post.  Also a changelog if you want to read changes without fetching a half meg archive...  Most resent change at the top then chronological order.
It takes advantage of Rimworld's outfits feature.  The included readme has details on usage and what the different filters are.
(Initial) target audience: Those with at least some minimal computer skills and minimal abilities with Rimworld moding.
I've added in a folder (back) into the release called UseEx which has an example of how I've been using this.

-First off the details and warnings:

It's written in Autohotkey which is what I reach for while in Windows to build simple stuff that probably won't use a GUI.  It should run on Windows versions Vista and higher, 64 bit.  It was written/tested on Windows 7 and if desired I can attempt a 32 bit version.  The app is not only relatively mod agnostic but should function with any version of Rimworld that uses the same save file format for outfits and stockpiles found in Rimworld Alpha 11, this is why I don't include a specific version of Rimworld it's meant to work with.  This means that filter files can be shared for example if you come up with a good alternate definition for gear for soldiers you could spread that around.  Though you will have to import such things into your own filters.xml file by hand or replace yours with someone else's...

If you are feeling cautions due to the relatively untested state of some of the code I'd suggest backing up your mods folder as well as the Rimworld folder in appdata.  I've been using the app for some time now (though not this particular version) and haven't had a catastrophic failure that such data was at risk but those are the files the app looks at.  It reads/writes to other files in the same folder as itself, reads from thingdef files (xml) in mods, reads your Rimworld Mod configuration xml and reads/writes to a single save file (write only on your instruction).  Creates a backup of the save before writing to the save, I now do validation on if an outfit/stockpile name is valid for Rimworld but I think making backup is a good idea so I kept that code in.

Since I don't know how relaxed Rimworld is on xml definitions I left the xml strict meaning that it might miss apparel if the xml is not formatted correctly (this includes capitalization).  I haven't noticed such a problem with Apparello, Norbals, and a collection of other apparel adding mods loaded.

-Now onto the fun stuff:

Apparellator is a funny little app I started putting together after spending about half an hour creating ONE outfit in Rimworld and the help of a spreadsheet and realized I'd spend a minimum of another half hour for the second one I needed.  I decided to toss something together based on my extraction to spreadsheet code that would allow me to borrow concepts from databases to create outfits.

I've put a bit more polish on it relative to the version I asked Shinzy about so that those who try it can get a pretty solid idea of my intention even if the UI remains rather rough.  I don't really care for making GUIs though I still get drawn into it at times when something interesting catches my attention and I don't get bogged down with how whatever language handles things.

What it offers is a way to generate outfits using concepts not unfamiliar to those who know databases (though my implementation is rather crude and kludgy).  Basically you use a few simple filters to flag details about equipment that you want included in your outfit, complex filters using expressions like add(+), remove(-), and 'and' (&) to select gear with a few properties and save it all to an outfit.  The other interesting aspect is exclusives where a filter can mark items it outputs as exclusive so that they can't be removed or new items can't risk conflicting.  I've also added Unary operators such as not(!) and exclusive(~) as well as a keyword/filter called filterEverything that gives the contents of the database for those who like from everything down to a specific set.

The intent is to be able to rather quickly update a save with outfits you've defined.  Once you have outfits it's only about 4 steps to update a save.  Open the app, select Outfits Manager, select all outfits, and hit the write outfits.

Also I've added in the ability to update Stockpiles with output from filters, works much like outfits though it can't create new stockpiles, only use existing ones.

So lets take an easy example, that you want cold weather gear for soldiers.  You create a simple filterContains which looks for the string "soldier" in defaultOutfitTags calling this filter 'soldier', a filterNumeric that looks for values less than 0 (or some lower number) in Insulation_Cold naming it 'cold'.  Now you make a complexFilter which uses the expression 'soldier & cold' which will output gear which fits both those requirements, lets call this one 'coldSoldier'.

Taking it a step further lets say that you want to specify the pawn to wear a variety of gear but don't want any of the new gear to prevent the pawn from wearing the cold weather gear.  First lets mark 'coldsoldier' as exclusive.  Next lets make a filter called 'coldNeutral' which is filterNumeric searching Insulation_Cold for values of 0 (don't want positives).  Now we create a new filterComplex with the expression 'coldsoldier + (coldNeutral & soldier)'.  What this does is take all the elements from coldsoldier and adds to it all the coldNeutral gear with soldier tag but DOESN'T add the item if the layer/bodyPartGroups might conflict (and thus the pawn might opt not to wear the cold weather gear).

Lets say you don't want to bother with multiple nested named filters, with the unary operators you can accomplish the same as the above paragraphs with the following: '~(soldier & cold) + (coldNeutral & soldier)'
It's a lot easier to debug filter output if you use named filters but you... well we, now have the freedom to just slap a unary onto a filter or parentheses and skip making a bunch of other filters.

-The concept of this as a Rimworld mod:

Since Shinzy brought it up (and I thought about lightly it before PMing them) the idea of building this (or something similar) into a mod is something I'm willing to entertain but I'd need to do some type of collaboration with someone from the mod community here, chiefly regarding the GUI component.

Operating on the concept that those with the knowledge/experience are pretty darned busy and not wishing to waste their time I'm going to proceed in a manner like I have in the past, which is to try and offer up something tangible when asking for assistance (via pm).
To that end I've been poking around inside Rimworld and noticed a few things that made me smile.
« Last Edit: January 03, 2016, 10:08:09 PM by Profound_Darkness »
Logged

Shinzy

  • Battering ram
  • Global Moderator
  • Transcendent
  • ****
  • Posts: 3023
  • Ramming speeed!
    • View Profile
    • My mods, all of them!

Yey!

-but I'd need to do some type of collaboration with someone from the mod community here, chiefly regarding the GUI component.

I don't know how busy EdB usually is but you really, really should ask some aid from Edbard!
(Very handy with this sort of things)
Logged

Othobrithol

  • Drifter
  • **
  • Posts: 35
  • Refugee
    • View Profile
Re: [Tool] Apparellator (Generate outfits and save them to Rimworld save)
« Reply #2 on: August 03, 2015, 05:56:37 AM »

This would be a very useful tool. Will follow your development.
Logged