Chemistry Mod/Alcohol Container Spawning process

I’m a Chemistry major at my local state college. I’ve played a few games on and off, and I keep coming back to DDA - I love it. But as is commonly recognized, it seems, cataclysm has terrible chemistry. Now I understand, it wasn’t meant to be perfect. But I personally can’t enjoy the game when certain chemistry-related recipes make no sense. It pains me…

Joking aside, I’d like to give the chemistry crafting portion of this game an overhaul. I’ll do this in the form of a mod, I think. I’m not very good with github, and I don’t think that my changes will necessarily be for everyone (i.e. biodiesel will likely be even harder to make…), so I think a mod is the best way to go.

I can’t imagine this being a very quick process, but I’ve already begun looking into the structure of the JSON data for the game, and have a plan for changing some of the senseless recipes into more sensible ones. I might also add a few more food items and boozes - I’ll try to keep them all rare and not unbalanced, but I always find it fun when a game has an absurd amount of variety.

Along those lines, I have a quick question (since I haven’t ever gotten super-far in the game): Does booze ever spawn in kegs? I know kegs are a thing from looking in the containers data file, but from what I see in the comestibles file, things like wine_noir, beer, mead, etc. all spawn in really specific containers, and usually really small ones. If it doesn’t already happen, I’d like to make kegs of beer spawn (rarely) and made the entry below:

    {
    "type" : "COMESTIBLE",
    "id" : "beer_keg",
    "name" : "keg beer",
    "name_plural": "keg beer",
    "weight" : 240,
    "color" : "brown",
    "addiction_type" : "alcohol",
    "use_action" : "ALCOHOL_WEAK",
    "stim" : -4,
    "container" : "keg",
    "comestible_type" : "DRINK",
    "symbol" : "~",
    "quench" : 18,
    "addiction_potential" : 3,
    "nutrition" : 3,
    "description" : "Bulk, cheap beer makes any party better. Too bad this isnt a party.",
    "price" : 90,
    "material" : ["alcohol", "water"],
    "volume" : 1,
    "phase" : "liquid",
    "flags" : ["EATEN_COLD"],
    "fun" : 11
},

I’m not sure if this already happens via some other mechanism besides the entries in the item json files or not, though, or if the above is even the best way to go about it.

I think that about covers it. I’m looking forward to fixing things like the explosives preps, biodiesel, etc. and adding some fun new items (and more uses for that chemistry kit…). And one small note, I see plenty of debate over the inclusion of chemistry into the cooking skill. I intend to keep it as part of cooking. In my personal opinion, a good cook can follow a recipe and know what changes he/she can/cannot make, and a good synthetic chemist (the kind of chemist in this game) is very similar. As long as preparations are learned from only books, I think the conjoined chemistry-cooking skill is reasonable. A good chemist is a good cook (and the opposite), but a knowledgeable cook isn’t a knowledgeable chemist.

Sorry, that’s a lot. Thanks for any help or guidance you have. I know I’m jumping into this without a lot of knowledge in the matter, but I really like the game and want to put in some work in something I know a bit about. Since this is my first post, if I need a little credibility, feel free to check my forum account at Sciencemadness.org - I’m “The Volatile Chemist”.

Thanks, NJ

3 Likes

I’d be very interested in more reality-based recipes being the default, and if people want fantasy recipes, they can maintain a mod for that.
To spread the love around a bit though, I’m hoping you might be able to think of some additional substances the player could synthesize that would increase the usefulness of chemistry, and hopefully keep it useful at all skill levels.

Concerning the keg spawning thing, you can also specify the container for a substance in mapgen, like is done here: https://github.com/CleverRaven/Cataclysm-DDA/blob/fca2e04452ba9968f20dd892a4887c8b3d6c5fe8/data/json/itemgroups/mansion.json#L254

1 Like

While beer doesn’t spawn in kegs, there are a couple of locations where you can find barrels of wine or whiskey. Adding full beer kegs to the bars and liquor stores could be fun.

While realistic recipes would be really cool, it’s worth being careful you don’t make it too technical/overly complicated. As long as your descriptions give a good idea of what chemicals are made from and for, that should stop players from getting overwhelmed.

1 Like

When I have messed around the game (when I found the game and wanted to see everything) I set the item spawn to max and if you go to the liquor store whit max item spawn there’s 2-3 eggs of full booze ready for drinkin’

I found my first keg in those man cave basement with the bar.

I believe all items are spawned in their default container if mapgen/item group doesn’t declare other container.

Thanks for everyone’s suggestions. I will most certainly add some more ‘substances’ to synthesize. In the cataclysm, someone’s got to be the mad scientist…

I think for my own ease of testing, I will begin with making a mod with the additions I’d like to make. If people like it, I can incorporate it into the necessary dda json files and put up a potential push on github (or however you do that) so that it could be incorporated into the game.

Regarding darktoes comment on complexity, I will try to keep things simple and obvious. Your character will learn chemistry so you don’t have to :slight_smile: For all new items, I will add to their description what you can make from them, and what they can be made from. I will also keep a list of the recipes I make/change and post it as I go along. And since I think most recipes I add will be learned from textbooks, they should all be fairly straightforward to use. I don’t think anything will be too complex, but I can always run some of the changes by people as things proceed.

Regarding the kegs, that is good to know. Perhaps part of the mod will include special keg-beers, or perhaps I will just add entries to some of the item-groups for each type of beer in the kegs. I like the beer/wine/booze types already present, and like I said I love a game with a ton of variety. I don’t think I’ll add too much to them, but (some more?) beer kegs (perhaps some other barreled wines, or a rare canteen filled with someone’s booze) will be a good addition, and since, surprisingly, there was no entry for hard cider, I made one (along with one for cyser - and soon a few more not-often-come-by drinks).

Again, thanks for the suggestions. I’ve been reading through the json files and seeing how everything interacts. I should have an initial mod up in a few days that just has the additional boozes, as a sort of practice-mod. I will then fix one or two of the chemistry-ignorant recipes, post that, and go from there.

NJ

(Edit): Side note, I forgot, I also added my favorite energy drink, NOS (under the name nitrous). I’m up for suggestions, is having more than the two already present energy drinks reasonable? I just figure the more the merrier.

Ok, so I said I would post up an initial mod in a few days, here it is:

http://ptp.x10.mx/chemestible_mod.zip

It’s just to show I’m actually working on it - it has no chemistry, just a few new items and a profession to test them. The aluminum Beer Keg is awesome…

Next steps will be to rewrite the chemistry recipes already present in the game and add any extra chems to make them realistic recipes. After that, I’ll add more explosive preps, useful chems, pharmaceuticals, and foods.

NJ

Will you make mobile meth labs sometimes spawn kegs of methylamine?

(Breaking Bad reference)

That’s a great idea, I’ll definitely add it!

I’ve been thinking recently along the same lines. I feel chemicals, especially drugs considering how big a part of the game they are, are handled unrealistically. I shouldn’t be able to shoot up heroin while driving a tank and I really feel like a pressurized gas fuel source other than hydrogen could add some interesting chemical recipes as well as an alternative fuel source something like propane and butane seem oddly lacking in the game. I’ve looked through a lot of the code and jsons and what needs to be done would probably require lua but im unsure of the state of the lua Api. It sounded like it was going to be removed but since that thread it looks like there’s been a bunch of work done on it. I’d rather not have to work in c++ and build the whole project if I dont have to. A lot.of chemical recipes and such seem like they could be added and made more realistic through json and lua alone.

Could you add calcium carbide+water reactions?

Aenye added some chemical items a while back, but they left before their work was done. Here’s some of their stuff:

I can look into using lua, though my goal was to try to avoid using it, at least for now. Eventually I will look into gasses and making/collecting them, though honestly it’d probably have to be either rather unrealistic or super complicated.

Making acetylene from calcium carbide would be a good reaction, and I could even throw in the super sensitive copper(II) acetylide explosive. To be honest I haven’t looked into explosives and gunpowder mechanisms in the game yet, and first I want to fix the easier recipes.

Regarding gunpowder/reloading ammo - there’s like three mods at least for this already, right? I’d like to just pick one to make a mod-dependent side mod for, to make the gunpowder recipe compatible with this mod and realistic, since I don’t want to try my hand at yet another reloaded ammo mod.

I will look into the Aenye stuff soon, and more into gasses/explosives/gunpowder(s)&reloading, etc., but first in the time I’ll have tomorrow I want to fix recipes for the general chem-related stuff, and maybe the drug-chem. Sorry for my own delays in the project. I just finished an exam in quantitative chemical analysis and in Spanish, and don’t have my organic chemistry exam till next Monday, so I’ll have the weekend to study for that and do some cata-chemistry :slight_smile:

A side note on gasses like butane/propane - I wanted this mod to bring in realism, not make more unrealistic items…but…I can definitely mod in propane and butane as liquids. Perhaps later with some lua I or someone else can make them behave like gasses when out of the bottle. I’m not sure if the ‘gas’ phase is even a thing in cataclysm, any info there would be great (though I can look into it myself later). Also, perhaps some of the more flammable chems could be added as sort-of analogs of gasoline - not sure how gasoline works either, haven’t seen its item entry yet - but - nitromethane, anyone? :smiley:

NJ

I will look into the Aenye stuff soon, and more into gasses/explosives/gunpowder(s)&reloading, etc., but first in the time I’ll have tomorrow I want to fix recipes for the general chem-related stuff, and maybe the drug-chem. Sorry for my own delays in the project. I just finished an exam in quantitative chemical analysis and in Spanish, and don’t have my organic chemistry exam till next Monday, so I’ll have the weekend to study for that and do some cata-chemistry

Gunpowder/explosives. etc… is nowhere as important as any work making ingame chemistry useful. Thank you for doing this and good luck!

Do avoid LUA, it’s still under the axe, plus I very much doubt it will do what you need it to.

Regarding gunpowder (or rather nitrocellulose derivitaves), I don’t have a problem with it being craftable as a high level recipe, but my understanding is it’s a very exacting process that isn’t something an amateur should be dealing with. I don’t want it added without the requisite level of difficulty and risk, but if those details can be handled, I’m all for it.

Why do you need Lua for recipes, anyway?

Thanks - I think I will avoid gunpowder crafting/implementation/support-for-reloading-gunpowder-mods. As for explosives, I might throw in some of that later - but it would probably just be alongside fixing the current explosives chemistry.

Will do. When it comes to balance/skill level, I’ll keep notes of some of the things I have questions for so that I can make sure things are suitably difficult to do. When I go about chemistry, I always end up thinking ‘oh, this is super easy, I could do it right now and be done in 30 minutes’, but the average person usually has a better gauge of how difficult a reaction would be for a typical survivor to do.

I wasn’t going to use it for recipes, but to make things like explosives and gunpowder and gasses like butane have more in-game functionality. But as I mentioned before, I think for now I’ll stick with making recipes realistic.
NJ

A little update, school has kept me busier than I first thought I would be. Working on the first of the recipe fixes. Here they are:

{
  "type" : "recipe",
  "result": "poppy_sleep",
  "category": "CC_CHEM",
  "subcategory": "CSC_CHEM_DRUGS",
  "skill_used": "cooking",
  "skills_required": [ "survival", 1 ],
  "difficulty": 2,
  "override": true,
  "time": 5000,
  "book_learn": [["textbook_chemistry", 2] , ["adv_chemistry", 2] , 

["pocket_survival", 3] , ["atomic_survival", 2] , ["textbook_survival", 2] , 

["survival_book", 3]],
  "qualities":[
    {"id":"CHEM","level":2}
  ], "tools": [
    [ [ "surface_heat", 2, "LIST" ] ]
  ],
  "components": [
    [
      [ "chem_ethanol", 1 ],
      [ "denat_alcohol", 1 ]
    ],
    [
      [ "poppy_bud", 2 ]
    ]
  ]
}

{
  "type" : "recipe",
  "result": "poppy_pain",
  "category": "CC_CHEM",
  "subcategory": "CSC_CHEM_DRUGS",
  "skill_used": "cooking",
  "skills_required": [ "survival", 1 ],
  "difficulty": 2,
  "override": true,
  "time": 5000,
  "book_learn": [["textbook_chemistry", 2] , ["adv_chemistry", 2] , 

["pocket_survival", 3] , ["atomic_survival", 2] , ["textbook_survival", 2] , 

["survival_book", 3]],
  "qualities":[
    {"id":"CHEM","level":2}
  ], "tools": [
    [ [ "surface_heat", 2, "LIST" ] ]
  ],
  "components": [
    [
      [ "chem_acetone", 1]
    ],
    [
      [ "poppy_bud", 3 ]
    ]
  ]
}

{
  "type" : "recipe",
  "result": "fungicide",
  "category": "CC_CHEM",
  "subcategory": "CSC_CHEM_CHEMICALS",
  "skill_used": "cooking",
  "skills_required": [ "survival", 1 ],
  "difficulty": 2,
  "override": true,
  "time": 5000,
  "book_learn": [["textbook_chemistry", 2] , ["adv_chemistry", 2] , 

["pocket_survival", 2] , ["atomic_survival", 2] , ["textbook_survival", 1] , 

["survival_book", 3] , [ "recipe_labchem", 2]],
  "qualities":[
    {"id":"CHEM","level":2}
  ], "tools": [
    [ [ "surface_heat", 2, "LIST" ] ]
  ],
  "components": [
    [
      [ "chem_sulphuric_acid", 1 ]
    ],
    [
      [ "copper", 100 ],
      [ "scrap_copper", 1 ]
    ],
    [
      [ "bleach", 5 ]
    ]
  ]
}

{
  "type" : "recipe",
  "result": "chem_sulphuric_acid",
  "category": "CC_CHEM",
  "subcategory": "CSC_CHEM_CHEMICALS",
  "skill_used": "cooking",
  "difficulty": 3,
  "override": true,
  "time": 10000,
  "autolearn": true,
  "qualities":[{"id":"BOIL","level":2}, {"id":"CHEM","level":2}],
  "tools": [ [ [ "surface_heat", 10, "LIST" ] ] ],
  "components": [ [ [ "acid", 2 ] ] ]
}

Minor changes to the poppy preparations, they are more realistic (use solvents to extract active compounds, the better solvent giving the more potent of the two).

Most major change is one people have brought up a lot on the forum I noticed: ‘acid’ is now considered dilute chem_sulphuric_acid. Whoever decided to use the non-standard way to spell that in the game is gonna drive me nuts as this project goes on, there’s no changing it now… xD I suppose this technically even adds to the game story, as it defines the clouds of gas escaping from other-dimensional cracks as sulfur oxides, and the acid rain as sulfuric acid. If anyone has a better solution for reconciling ‘acid’ with a more specific type of acid, feel free to make suggestions, but since battery acid is sulfuric acid, I thought it made sense.

More on their way. A lot of the problem is that some of the drug recipes require more complex reagents. Meth is easy, some of the drugs are too - but diazepam? Not really going to be an easy recipe for that. If there were a way, I would remove the syntheses of some of the more complex therapeutic drugs from the recipes, and make them only discoverable. In reality, in the apocalypse you wouldn’t be likely to be able to prepare them properly anyways.
As always, Thanks,
NJ

If all else fails, you could make the recipe produce a “makeshift” version. Something less pure but with side effects or perhaps a similar drug with the same effect.