Assistance and advice regarding ammo type overlap

So, I’m think once my current remaining PR is dealt with, I might see if I can take the initiative of implementing ammo type overlap. In theory it should be feasible to do, but I’d want advice and suggestions on how this would work. A summary of which source files need to the be altered for this would also help.

Current plans for using this feature:

  • Making a distinction between semi-auto-compatible cartridges and ones too low-power to cycle an action (standard .22 LR versus .22 CB, for example).
  • Making .38 Super and .45 Super only usable in guns designed to chamber them.
  • Preventing semi-auto or autoloading .30-06 firearms from using .270 Winchester.

Future plans for using this feature:

  • Adding rifles designed for .270 Winchester, and allowing them to chamber .270 but not .30-06.
  • Adding .357 Magnum, and precluding .38-only guns from using it.
  • Adding .45 Long Colt, and .410 shotshells. This would allow adding the Taurus Judge.
  • Adding options to make blackpowder-fueled handloads versions of any cartridges that existed before the advent of smokeless powder. These would be usable in manual firearms but not autoloading.

Additional information, assistance, and suggestions would be handy.

I feel it gonna take more then just changing the ammo type it looks for it uses in to a array…

it also going to screw with gunmods that change what ammo type…

Ah, right. Ammo type versus gun mods might be an issue.

The first step in designing a system like this is to look at the data, figure out what game entity you can add the smallest amount of data to in order to reach your goal.

I think in this case what you mostly want is to add a blacklist/whitelist to specific ammunition.
So an ammo will work in a gun if:
The ammo type matches AND the ammo doesn’t have the gun listed on it’s “incompatible” list.
OR
The ammo lists the gun on it’s “compatible” list.

For example, you’d add the .22 auto guns to the incompatible list for .22 CB, add too-small guns to the incompatible for the super ammo variants (I’m partially guessing what you mean from context), and add auto-loading guns to the incompatible list for .270.

I can’t think of any examples that make sense for a whitelist off the top of my head, there might or might not be any, but it’s nice to have the flexibility.

Ah, I see. There were two other approaches I was thinking. So basically just restrict via an internal blacklist instead of hammering in a way to allow defining multiple ammo types for a weapon or ammo?

I’m not sure how best to convey to the player that s given gun can’t use a given ammo, though.

Yes, my reasoning is that ammo types cover almost everything, but you want to add support for some of the exceptions that crop up occasionally. It’s a lot easier to just treat them as exceptions than to try and extend the system somehow to handle all the weird corner cases.

[quote=“Random_dragon, post:5, topic:10609”]Ah, I see. There were two other approaches I was thinking. So basically just restrict via an internal blacklist instead of hammering in a way to allow defining multiple ammo types for a weapon or ammo?

I’m not sure how best to convey to the player that s given gun can’t use a given ammo, though.[/quote]
Maybe something like:
Ammo type: .22 -.22CB
Perhaps with .22 in green and .22CB in red.

It might be easier to put the compatibility lists on the guns, especially for display.

I see. Yeah, that might be the best way to do it. So far I see…four different ways to approach this idea.

First, the workaround, use of a list to narrow down what ammo a gun can use. This can be done from the gun perspective OR the ammo perspective. Either way this requires the addition of a new property that controls gun-ammo interactions. Both of these would require some way to inform the player of what is or isn’t usable.

If from the ammo perspective, this could be an explicit list of what guns it is or isn’t compatible with. This might be messy. More importantly, any mods adding new weapons might require overwriting the ammo to include their guns on the list of whitlisted or blacklisted guns.

The gun perspective might be easier. It would allow a much shorter list in the weapon’s stat block, description, wherever that tells the player what ammo it can or can’t use. This ALSO has possible complications, if a mod adds new variants of a vanilla ammo type. This could again potentially require overwrites, this time to the guns using that ammo.

Now, the other two methods involve actually codding the ability to handle multiple ammo types. And again, it’s either handled from the gun’s perspective, or the ammo’s. In both cases, it would essentially allow the ammo type entry to accept multiple entries, in the same way multiple materials can be used.

From the gun perspective, this would require adding that option, then you’d need to split off all the various types of ammo to divide them according to what guns can or can’t use them. Mods adding new variants of ammo may or may not require added gun overrides, depending on whether their new ammo can fit into an existing ammo type.

The ammo perspective for this would essentially make it so an ammo belongs to multiple types, while the guns themselves have only one ammo type that determines what they can use. This is potentially the most convoluted and difficult way to add it.

Form heres view
blacklist / whitelist would still have some amount of flaws

if going by a blacklist/whitelist it might be better to go by weapon/ammo traits (as flags) rather then just directly doing, 'cant use 22CB in on the RM360 though im just thinking this due to the conversion kits

May as well edit his now to try explain what i meant

say the 22CB has the trait “Lowpowered”

It would stop it form been used in fully automatics that don’t also have this trait and other guns would just disable burst fire
(expanding on this a round labeled Highpowered (Overpressure ammunition) could possible damage guns with this trait)

And in the case of guns that cant fit a around due to the size. could just go and give the ammo ‘Abnormal’ that would block if if the gun also didn’t have the same trait…

gunmods are just going to be a headache no matter what now i think on it…

goodluck random, you might need it

Ah right, possibly. You’d need to add a way for weapon mods to ALSO change whitelists or blacklists.

Relative to ammo-conversion mods, the “multiple ammo types at the ammo level” might work best. That way, since the gun itself only has one ammo type, it can be altered to a comparable one easily.

Though that would still require some way for it to look at the inputs of ammo types and output the logical equivalent. Once again that fourth method seems to be the most clusterfuck-inducing of the options.

I don’t see having guns or ammo be in multiple types of ammo as a workable solution, the best example is the .22CB thing, you’d have to make a “22_lowpowered” ammo type just for the one type of round, AND you have to go through all the .22 guns that will fire it and add the new ammo type. You’d have to repeat that process any time you don’t want a particular round working with a particular gun, give it its own ammo type and then go through all the guns that CAN still use it and add the ammo type. It just makes for too many pieces to keep updated. Also now you get to explain to the players what all these weird ammo types are.

As for mods, they’ll just have to overwrite some definitions if they want to change how this stuff works, but I think the white/black list-based approach is more likely to keep changes they have to make small.

As for making flags for this, I’m usually all for descriptive flags, but we aren’t really describing properties of ammo here, we’re just saying certain ammunition can or cannot work in different guns, it’s way simpler to just make that explicit.

True, multiple ammo types might be a bit of a hassle. And pretty much any mod will have to add overrides to account for this, no matter how its implemented. That is a worrisome feature though, unsure how multiple mods will interact with the idea.