Private Defense: 3D-printed firearms and accessories

Private Defense is a small mod that adds 3D-printed firearms to the game. Polymer firearms are meant to be somewhat less-powerful and significantly less-reliable than their metal counterparts, but also more accessible: all they require resource-wise is a 3D printer and a bunch of plastic chunks.

Private Defense depends on Homestead for 3D-printing functionality. Feel free to grab v0.2.

The latest version of the mod is Release Candidate 3, revision 1. 12-gauge subcompact pistol was added. CAD file distribution was also altered so that you’re likely to find related files in the same spawn: e.g. Private 9 CAD file along with Glock extended mag CAD file. The final version in essence, though testing might still be required.

Feel free to create issues on GitHub or leave comments here if you’d like to suggest an improvement or report a bug.

5 Likes

Awesome mod, dude!

https://www.mediafire.com/file/rujrp3z9achshll/Duros_Doings.zip/file

This mod from quite a while ago (that I’m pretty sure is broken) also added 3d printers and some recipes, you should check it out too and maybe merge some of it into your mod since it’s not maintained and updated. I uploaded it since it’s not in Goat’s collection (he mentioned he removed one mod entirely because of issues but couldn’t remember which it was lol it very well could be this one).

The only thing I can recommend regarding plastic 3d-printed guns if you don’t want them to be long-term weapon substitutions, and I’m not exactly sure if or how this could be coded, but the guns should wear down extremely quickly with use and have overall crappy durability.

This is something I’ve been considering. I thought decreasing reliability should help, but firing hundreds of rounds in the test games yielded not a single fault. Perhaps I should decrease it further and see where it leads.

I’m also going to experiment with the undocumented functions of the Cataclysm engine to see if this could lead anywhere. One could, for example, add “wear chance” (consume_chance property) to gunmods, as is the case with the native “solvent trap” suppressor and with this mod’s polymer suppressor. I wonder if one could also apply the same quality to firearms, to produce something flimsier.

It’s kinda pointless in the current version of the game though, where M4s are thrown at you.

The gun mechanics of the game is one of those things that’s still almost broken and needs an overhaul since the older versions of cdda. You can find people mentioning this in threads over the time and even Vormithrax in some his not-too-old streams lol. Most variations of guns don’t matter much other than the straight damage and ammo factor because they almost all function/behave exactly the same regardless the difference in values. From what I recall from Vorm’s streams in the past months when people ask this is the exact reason he doesn’t play with any gunmods, because it doesn’t matter, they don’t have their intended effect anymore.

The real issue here though is the main devs of the game are way more open to working around and manipulating and maintaining code than straight up removing code and completely recoding. They are mainly trying to transition things over to jsons right now. Not trying to throw shade on anyone, but they’ve made this clear about other game mechanics. I guess a lot of this stuff is still in the cpp’s and pulling code straight out or trying to replace it can still potentially mess up a lot of things.

You should totally make a blog or continual reddit post though about exploring/experimenting with “the undocumented functions of the Cataclysm engine” because some of these things are still a mystery to long-time/regular devs lol.

You shouldn’t even have to go that kind of route with the mod. As I said, I haven’t investigated all the code etc, but I would assume there prob is a way to code it and make it similar to smashing objects against something by firing the weapon. Like, code that seems like you’re bashing it against an object every time you fire/when you fire it performs an action against an invisible object ‘bashing’ the weapon. Off the top of my head I think this is codeable with some trickery but sorry if I’m wrong and put you on a wild goose chase lol.

I don’t blame them: rewriting the codebase for something as massive as Cataclysm is a hell of a lot of work. Not only will halt any further progress, it will eat a lot into resources: mental energy, money, time, hosting… As a dev, you take this up when other options are exhausted or incremental changes are no longer productive.

So far, incremental changes are productive enough to ensure continued support of the current engine. Much as I dislike that as a player, as a dev, I’m with them on this one.

(Also, it would help tremendously if you, or anyone else, would assist the JSONization project. If you want to see the current hardcoding gone, this is the path to take: liberate the current constraints of the game so that it could be properly rewritten, should CleverRaven guys choose to.)

This sounds impossible to do with JSON alone. I haven’t seen any gun – or indeed anything other than the autofilter suppressor – to become damaged over time with use. If you find anything that does, let me know.

The real issue here though is the main devs of the game are way more open to working around and manipulating and maintaining code than straight up removing code and completely recoding.

What precisely are you talking about? We remove code all the time, as appropriate. The original code for how faction camps upgraded their maps has been completely removed and replaced by a superior implementation.

We don’t throw stuff out and start over from scratch very often, because that’s a good way to reintroduce bugs that had been fixed. Replace in place is the better way to update code, and whenever possible, that’s what we do. But replacing in place involves removing code.

Stuff gets migrated to JSON as developers have time and interest to do so. If the particular feature that you want isn’t in JSON, you should either contribute code or explain to some developer with time and ability as to why that feature should be in JSON. But there’s no conspiracy to prevent gun degradation from being exposed in JSON. It’s just that no one has wanted that feature enough to make it happen.

As far as gun reliability guns, as I recall, a gun with reliability 1 fails in 1 in 64 shots. Maybe Firebrand is setting the reliability to high?

Also:

You should totally make a blog or continual reddit post though about exploring/experimenting with “the undocumented functions of the Cataclysm engine” because some of these things are still a mystery to long-time/regular devs lol.

The codebase is 300K lines of code and there are thousands of lines of code changing every month. Nobody knows the entire codebase any more. If someone wants to write posts about the undocumented functions, that would be great - though submitting PRs to document those functions would be even better.

1 Like

Don’t you think that’s a problem? It’s problematic to mod a game that doesn’t tell you all it can do.

I don’t think it’s a problem that no one person knows the entire codebase. People specialize: I know a lot about vehicles, NPC AI and dialogue, missions, and basecamps; ralreegorganon knows map generation; Kevin Granade knows a bit of everything but especially vision and explosions; KorGgenT knows inventory, digestion, sidebar UI, and Magiclysm. No one knows everything, but just about everything is known by someone.

The other solution to not knowing the codebase would be to cut features and reduce the change rate, and I think that’s a bad solution.

Do I think it’s a problem for modders that the game doesn’t tell you all it can do? Sure. When I add new moddable features, I document them. I wrote the Guide for 1st time contributors. I encourage people to submit PRs to document the bits that aren’t documented or submit articles to the Guide, like Hymore246’s extensive guide to martial arts modding.

What else do you think should be done here? I can’t make people contribute documentation.

I’ve never worked on massive projects, so I concede to your outlook on this. If you’re saying this is normal, you’re probably right.

That said: the fact that you don’t see this as a solvable problem is concerning. You’re saying you’re doing your part and can’t force others to do the same. Isn’t there a way to establish a certain kind of order of operations so you don’t have to? Perhaps adopt a tool that makes taking notes about new features easier? This would probably aid the rate of documentation growth by making said documentation easier to write in the first place.

I’m sure nobody on the team is anti-docs. I’m sure nobody sits there giggling maniacally as they knowingly forgo documenting their latest changes. I’m also pretty sure the issues they have are not conscious: barriers of entry can be high for the smallest things, like writing down a line or two about how this thing works 'cause you’ve already spent hours coding it, and doing it tomorrow is just not up to the plan.

None of this has to do with the mod, but I wouldn’t sleep well I haven’t brought up some basis for a solution for the problem that affects me even more than it does the devs. Some sort of a text inbox where devs could leave notes about the new pieces of code or sort out older ones. Maybe a tool in the build chain that scours the codebase and brings up all the methods that have no registered definition…

Something like that. I haven’t given this much thought.

And yes, I do think it has to come from the developers first and foremost. Not any one person in particular: anyone with the knowledge of this or that part should be able to give the explanation. The team would by default know better than a random contributor.

I’ve been professionally employed as a programmer for over 2 decades and studied programming for a decade before that. I know of no large projects that are fully documented to the extent you seem to want.

That said, we could require more documentation with each new submission. That’s another bar to entry, and there are already a fair number of bars to entry like linting that discourage people from contributing, and other restrictions that we don’t require (like consistently formatted commit subjects lines) because we judge that would turn away too many contributions.

Nevertheless, the project documentation has gotten better. NPC dialogue, mapgen, vehicles, and magic spells are all well-documented within the project’s doc directory, and there’s the Guide for 1st time contributors that provides a fair bit of meta-knowledge about the project. So we are doing what we can in parts.

As an aside, my email address and Discord, reddit, and discourse username are in the Guide, along with invitations to contact me if you need help. And I don’t think I have any DMs, emails, or other contact messages from you. How much are the devs to blame if you don’t avail yourself to the help that is offered but instead choose to try to figure things out from the JSON alone?

2 Likes

hi firebrand, the first thing the game posts but with errors, I could look into it and fix them but it is your mod and I don’t really have time to do this atm.
I’m interested in this mod and it’s potential. :slight_smile:

you probebly know about these though

in item in pd_cad_files

DEBUG : item id pd_cad_group_9mm is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_mp5 is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_45 is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_12 is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_357 is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_223 is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_mac10 is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_uzi is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~
DEBUG : item id pd_cad_group_3006 is unknown (in item in pd_cad_files)

FUNCTION : virtual void Single_item_creator::check_consistency(const string&) const
FILE : src/item_group.cpp
LINE : 121
~~

edit- issue is nonexistant in 2.3 ill add this into the mod compilation untill you fix 3.0

Blaming the user for not reaching out is part of the fucking problem. You may wanna check with the rest of the team: we had a conversation earlier today on this very subject. They know what I think of it.

I’m free to elaborate on any of the points listed, should this conversation ever turn back into the respectful exchange that it was one response ago.

Help is always appreciated, but I don’t expect you to fix things for me, so no worries. If you could leave an issue on GitHub next time to let me know, it would be great: that way all of the bugs to fix are consolidated in one place, makes it easier for me to track.

Also, yeah, I know about those. Fix is on the way. Thanks for reporting.

While I’m at it: why do you feel the need to add this mod to the compilation? It’s neither dead nor unsupported.

1 Like

I offered you help, you didn’t take me up on the offer, and I’m at fault for not providing you help in the form you prefer and for pointing out that you didn’t take me up on the help that I did offer? How exactly does that work, and what’s your responsibility in all of this?

You’re not a user, by the way. When you start trying to write a mod, you become a potential contributor. And the main difference in status between you and me is that I persevered with my contribution and become a contributor, and then did it a bunch more times. When I suggest that you reach out and ask questions if you need help, I’m not asking you to do something that I haven’t done numerous times myself. Almost[1] everything I know about C:DDA I learned by reading the documentation, reading the JSON, reading the code, and asking questions of other people who learned it the same way.

[1] Some bits I learned by writing, but like I said, I’ve mostly tried to document those bits.

the compilation is for all mods, if there not mainlined there in it. but if you wish i can remove this from the pack, i dont update mods that are being maintainted (well maybe a quick fix to so they load) the updates for mods such as this come from you and i do the hard work (not so hard) and update the compaltion
(unless its blaze mod thats in my compilation and mainline(deactivated) though)

in future ill post everything on your git :slight_smile:

in future ill be making it clearer to what i maintain and what is maintained

1 Like

Ugh sorry y’all I didn’t mean to poke the CDDA bear. I also wonder if I just said “the problem” instead of “the real problem” as I feel that came off antagonist and aggressive and bothered some of you guys even though I totally didn’t mean to.

What I was referring to was the recent-ish health related changes like the obesity mechanics and food item affects etc and how it will all get overhauled instead of being incrementally adjusted/updated, which I understand as it is much easier to do that as mlangsdorf has mentioned with a game as complex as CDDA. I totally respect and understand all the work involved with coding and the stuff you guys do regularly and we all thank you for that. We wouldn’t have this awesome game to play without you guys.

And I wasn’t harping on or laughing that people don’t know the code etc, I was just trying to say this game is still such an enigma and has changed so much in the past while that it’s worth documenting mechanics as much as possible. We shouldn’t rely on Vormithrax to find major errors lol.

I have to also admit though that I’ve learned what I know about the game from code diving and old docs since other modding communities etc I’ve been in are so rude that I didn’t even think to message a regular contributor.

BTW I think there might be some potential solutions, and ironically might be because of some old lingering code constructs lol.

You can use a custom ammo type with no magazine or a useless coded magazine for the item so that way once it spawns and is used up it’s empty and can be broken into plastic chunks. It kinda works because somebody has to go Boondock Saints and sacrifice carrying capacity to fight but the ammo might load in ammo spots which would be completely useless for the player without using the debug menu to cheat/conjure more appropriate ammo instead. I guess it should work also with a common ammo type, the weapon just has to not be reloadable.

Again, sorry, but I haven’t looked at the code in a while, but the nailgun is a tool and also a gun and there might be a loophole there making the 3d-printed guns tools instead of guns which might have some more degradation options. What I was thinking of in my post was the “transform” mechanic but then I realized that requires activating via menu and not through combat so maybe not a good idea, but something there could still maybe work? Code it as a tool so that the effect when you activate is a ranged attack and could maybe be coded so every time you activate it through the menu it can degrade as well? Again, sorry guys if I’m wrong I’ve been out of the game for a bit.

I think a better solution is writing code to support guns degrading with every firing or whatever you want to do. The kind of complex work-around you seem to be proposing isn’t good and tends to be a maintenance nightmare.

i fixed a few things in your mod and made it able to load. however i dont see why this happens
https://mega.nz/#!GG4UlC5Z!lBEsP0oKKw95NYxPOP9XmMaEDDUL6g8-GHf8UcFKVVM

DEBUG

DEBUG : Error loading data from json: ???: requested non-existing member “type”

FUNCTION : void DynamicDataLoader::load_deferred(DynamicDataLoader::deferred_json&)
FILE : src/init.cpp
LINE : 125

i located it to your materials.json i dont see why it doesnt pick up the type

Man, I’m embarrassed, and thank you for what should’ve been the obvious answer loI. I’m so used to working within code that writing new code is almost a radical foreign idea. It’s like I forgot this is an open-source game lol.

I like the overall item degradation mechanics of the game because tools and weapons etc generally don’t degrade in the span of hours, weeks, or after so many uses (like many other survival games etc) and I feel they shouldn’t be changed for all guns as it would make maintaining a supply of gun repair kits essential which would become an annoying burden for anyone who wants to play the game as a firearm oriented character. Though, the idea that once a gun has been damaged that it can start deteriorating from that point on, or maybe even a small percentage chance of it backfiring on you/exploding is some mechanics that would be interesting and more realistic to the game.

But plastic 3d-printed guns should totally deteriorate regardless.

I will look into this!

And Goat, it seems he removed the materials.json from that mod recently if you check the github link in the OG post.

1 Like