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.

4 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