2016-10-16

FUBS Modding Part 1: NPC Gender modding

It's about time I write up something about modding Fucked Up Burger Shack. If you read through and follow this nonsense you will have a mod file that will alter the game to produce Randos of different genders at a fuzzy rate of your choosing.

First we need to find the source files that FUBS exports. By default these are at a path like ~/My Games\Fucked Up Burger Shack



Inside the 'Fucked Up Burger Shack' folder there should be a 'source' folder.



That is where we can mess with the game. In version 2.8 you will see two folders inside of 'source', 'FUBS' which has most of the source of the game, and 'RandoEngine' which has the source files for NPC generation and descriptions. In later versions the descriptions are in a third folder named 'Partners'.



Our task is to change the probabilities of genders appearing for the Randos that you run into in FUBS. There are different ways to approach this, so we will start with the easiest, deletion.

Deletion

Navigate to /Fucked Up Burger Shack/source/RandoEngine/Generation/Bio/
and open up the 'Tier 01 Bio Gender.fate' file.



This is a .fate file which is really just a text file. I'll be using SublimeText to edit the file, but any text editing app will work.



So the gibberish at the top of the file between /* and */ on lines 1 to 14 are comments that can be ignored. They are entirely optional.

Line 16 '@contributor p4p @end' is a command to the system that credits the person who worked on the file. This is related to the credits for the game, but for now it can be ignored. It is also optional.

Line 22 marks the start of the first rule in the file. You can think of a rule as a container that defines text to display to the player and commands to run in the system. Rules also have a set of criteria attached that help determine when they will be displayed or run.

Breaking down this line it starts with '::', marking it as the start of a new rule. This is followed by a space (' ') and 'Gender'. Gender is the title of the rule. In this case we won't ever see the title because this rule is only used to set variables rather than display text.

Next there is another space and then a bunch of gibberish between two square brackets, '[rule($R == ^REGenGender && $prefMen == ^yes)]'. The meaning of this stuff is to say that this rule applies when the variable '$R' is equal to the value '^REGenGender', and the variable '$prefMen' is equal to '^yes'. Notice that '==' means is equal to and each of these statements is separated by '&&'.

So elsewhere in the game when we are looking for rules that can set gender, we use a command that sets the variable '$R' to '^REGenGender' and the system will return one matching rule. When playing, the preference for if you will fuck/be fucked by men also sets the variable '$prefMen' to true or false (yes or no) behind the scenes. Boolean values have different representations for whatever reason, so true can be written as '^yes', '^true', '1', and false may be written as '^no', '^false', '0'.

Line 23 is where the body of this rule starts. The '>' character marks the start of a command. This gives an instruction to the system to do something. In this case we are using 'set' which assigns a value to a variable. This set command will give the variable '$REGenderBiological' the value '^biologicalMale'. Notice that a single '=' is used for assignment.

Line 24 is another set command that assigns the value ^male to a different variable '$REGender'. FUBS uses these two variables along with many others during generation to build random NPCs. Looking forward in the file we see two other rules for women that follow the same format, but assign different values for the '$REGenderBiological' and '$REGender' variables.

Back to the major point here, we want to modify the game by deletion. So if we were to delete this file, when the game does a search for a rule where '$R' is equal to the value '^REGenGender', it will never find anything. This would lead to an error and generally be bad. Instead we can just delete at most two of the three rules if we wanted. For example, we could eliminate men and trans women by deleting their rules (lines 22 to 32).



Keep in mind that in the case that we have deleted the men and trans women rules, and the player does not set the preference for fucking women or being fucked by women, the game will have an error because the criteria of the women rule are not met. In other words '$prefWomen == ^yes' must be true for the rule to be selected. To fix this we can just remove that criterion (by deleting '&& $prefWomen == ^yes' in line 23) and ignore the players preferences completely.



Rules at minimum require a single criterion for the '$R' variable, which determines when the rule will be used. Looking at the original version of this file, each of the three rules have an equal chance of being selected at random since they all have two criteria. During a game the system does a search of all defined rules and will select the best possible match, or if multiple rules match the system will randomly pick one. By default this means you have an equal likelihood of encounter men, women, and trans women.

The best possible match is determined in part by number of criteria, so more criteria will always beat less. The system uses priority, but more on that later. When multiple rules match, weighting comes into play.

Weighting


In previous versions of FUBS I used weighting to determine how frequently players could encounter men/women/trans women in the game. 'weight' is another command that we can include in the body of a rule to help the system pick from several possible rules. A greater weight means greater likelihood that a rule will be selected. By default rules are defined with a weight of 1.

So now lets add this command to weight the three gender rules.

> weight 1000




I don't think of weighting as an exact science, it's more about what seems right where many rules potentially exist. In other words, I couldn't give you an exact probability of a rule being selected using weights, but a rule with weight 1000 will be selected nearly always compared to rules with the default weight 1. Over time I've moved towards the AFCOR concept from biology for weighting (https://en.wikipedia.org/wiki/ACFOR).

A – The species observed is "Abundant" within the given area.

> weight 1000
C – The species observed is "Common" within the given area.
> weight 750
F – The species observed is "Frequent" within the given area.
> weight 300
O – The species observed is "Occasional" within the given area
> weight 100
R – The species observed is "Rare" within the given area.
> weight 1
It's tempting to give super big numbers for weights, or negative values, but they either won't work or will fuck things up.

I am guessing that most players have a particular ratio they'd like for how frequent different genders appear, even if it is just to emulate population statistics, so weighting effectively allows this. But having changed the file, it is a problem to have to redefine these rules across game updates, so this is where priority can help.

Prioritizing


When FUBS is updated you have to delete the previous source folder so that the new source can be saved in it's place. Yeah that's kind of tedious (it's on my list), but more importantly if you do make changes to the source you would probably not want to redo them each time. One solution to this is to make your own .fate files and use prioritized rules where needed.

Taking the weighted gender rules from before, lets copy the entire file into a new .fate file. I created a new folder under 'source' and named it 'My Stuff', then created a file .fate named 'Gender stuff.fate'



Now when I update the game I can just move 'My Stuff' to a safe location, delete the old source, and add 'My Stuff' back after the new source has been copied in.

At this point the game would have six gender rules to choose from. Depending on the weights used it is probably more likely that the weighted rules will be selected, but we can use the 'priority' command to enforce it.

Just as it sounds, the priority command will prioritize a rule above others during selection. It looks a lot like the weight command and by default all rules start with a priority of 1. Add the following command to your custom rules.

> priority 2



Again you shouldn't add negative priorities or add super big numbers for priority.

So here is a summary of what the system will now do:
  1. First it will search for rules where '$R' is equal to the value '^REGenGender'.
  2. It finds six rules (three from the original file and three from our mod file).
  3. It keeps the priority 2 rules, but discards the original rules with the implied priority of 1.
  4. Each of our rules has the same criteria count so they will all be evaluated.
  5. If the player has enabled all of the genders ($prefMen == ^yes, $prefTransWomen == ^yes, $prefWomen == ^yes) then all three rules are available for selection.
  6. The odds of each rule being selected are in the favor of trans women, women, and then men, since the weights are set as 1000, 750, and 300 respectively.

And there you have it. You now have a mod file that will alter the game to produce Randos of different genders at a rate of your choosing. This is the first post I've made like this so hopefully it isn't a complete mess.

Here is a copy of the final file https://mega.nz/#!lR8WAAaS!7XO6LEyWhBZLKNRDY663mO9MX7bAwZD_F5qZDNSbbSU

2 comments:

  1. The FUBS source is interesting in an objectivist sort of way:

    http://imgur.com/a/iwVHf

    I also enjoy the jokes:

    http://imgur.com/a/Tmg89

    ReplyDelete
    Replies
    1. >http://imgur.com/a/iwVHf

      Well now I want to generate political affiliation... ahh, so many ideas, so little time.

      >http://imgur.com/a/Tmg89

      The accuracy of things I copy from the internet are not guaranteed.

      Delete