View Full Version : limited guns and ammo


davidlallen
Sep 09, 2008, 10:56 AM
Several threads have discussed adding limits on the number of guns and amount of ammunition in Fury Road. This thread is to centralize the discussion.

We have established some facts. Even automatic weapons like AK47 can be built by a blacksmith with hand tools. There are several different calibers of weapons whose ammo cannot be interchanged. Making ammo is probably harder than making weapons. Gunpowder is not that hard to make, but smokeless powder and proper cartridges are harder. Automatic weapon cartridges are even harder. Primitive rifles like flintlocks only require gunpowder and lead balls, which can be cast in the field.

I think those were the main facts established in the previous threads around this link (http://forums.civfanatics.com/showpost.php?p=7207652&postcount=67).

The next couple of posts will give more information about limited guns, and then limited ammo. They are closely linked.

davidlallen
Sep 09, 2008, 10:59 AM
Several people have suggested that it should be possible to scavenge weapons from units destroyed in combat. This is a main focus of the Fallout games.

Because of different caliber, it is highly likely that different civs will create incompatible weapons. So, if we have limited guns, where a gun can be scavenged from an opponent, we also have to track ammo caliber. We can choose to ignore that and say only one caliber will be used.

One way to handle this which I mentioned before is to remove all the different infantry types from the game, and just have one unit called "guy". Then buildings produce "weapon counters" like promotions which can be added to any unit. People who have played FFH (and now I do include myself in this category!) point out the idea of bronze / iron / mithril weapons. But a better example is Orthus' Axe, which can be transferred from unit to unit and gives +1 Fire damage.

This is possible, and it is even possible to swap different art types as the unit gets different weapons. (This is the way the utility truck works as of version 9 thanks to linked unit art by refar.) The most significant problem with this is having the AI understand it; picking up and swapping these weapon kits would require a change to the AI for all units.

Another possible way to handle this is by limiting the number of such units that could be built at any time. For example, making weapon armed units a national unit. The drawback to this is that both small civs and large civs would have the same limit, and scavenging weapons from opponents would not raise the limit. We could also make the rate at which the units are produced, limited by the number of a certain building built, or the number of improvements of a certain type. There is a whole modcomp under development for "quantifiable resources" which covers this. Again, the AI development seems to be the limiting factor.

I'm sure there are other ways this could be handled, but I think this summarizes the discussion so far.

davidlallen
Sep 09, 2008, 11:00 AM
As a separate topic from limited guns, limited ammo involves tracking when a unit runs out of ammo, and adding some way for units to be resupplied. This was a factor in the Fallout games, and a major factor in The Road Warrior. In the current version of the game, I have assumed that if you find a pre-war munitions dump, you have unlimited ammo for advanced weapons. As of version 9, the ammo factory represents the ability to create unlimited ammo for rifle type weapons.

One way to handle ammunition is to literally duplicate the fuel handling system. Ammo factories would produce ammo trucks, and each unit would use up some of its ammo when it attacks. Also when it defends, even without moving -- that is a small change from the fuel code.

However, it's not clear this would be any more "fun". Two different supply streams to manage just makes things painful.

Are there different methods we could use to represent limited ammo? There was one suggestion to merge both supply types together and have supply trucks. This makes it kind of generic, more like a WW II strategic level simulation rather than a Road Warrior feel.

phungus420
Sep 09, 2008, 11:51 AM
Again, the AI development seems to be the limiting factor.
While interesting in concept, I just don't think it will be worth all the work to teach the AI how to handle limited ammo and rearming. Though you have had success with the Gas truck and refueling, you could probably port this over pretty easy as a way to deal with ammo. Scavanging though, I think it would be too much work getting the AI to really use it properly.

Rasma
Sep 09, 2008, 10:51 PM
I like the idea but as Phungus said it will probably make the AI wish to kill itself.
But what if you did not put calibers it may work better

Refar
Sep 10, 2008, 02:46 AM
Well, the AI can handle fuel - not perfect but well enought to live with.

In my eyes ammo would be the [and only] reason to make people [and players] use primitive weapons like XBows again.

I would not bother with different types of ammo tho. Some level of abstrction is needed in a game like civ compared to fallout.

Another possibility would be creating ammo "tiers", while keeping single supply unit for everything - if a civ has access to say "machinegun ammo" then a supply truck can resupply MG units (even if the truck was technically created before we gained that tier)

A simplier - and maybe sufficient - possibility to show the limitation would be simply limiting the number of units of certaint type a civ can field.

jefmart1
Sep 10, 2008, 04:46 AM
I think the item idea, but more like the healing salve from FFH, might be the most workable.

Various weapons are an item that is either carried or used. When used it grants a promo and the unit graphic would change , like for the Utes. That I think is easy, because they are one time uses, its making the item redrop when the unit dies.

You could have a carried item like Orthus' Axe, but the unit graphic wouldn't change, and the graphics for this mod are a lot of the fun...

Jabie
Sep 10, 2008, 06:54 AM
At the end of the day, this boils down to a trade-off between realism and gameplay. Limiting Guns and/or Ammo is more realistic but it also increases the micromanagement and the need for the AI to understand the concept. Unlimitted guns is easier to understand and easier for the new player, but is less flavoursome.

Personally I wouldn't bother splitting down to both Guns *and* Ammo. After all, you not going to bother making guns if you don't have the ammo for it, and vice versa. I also wouldn't get too hung up on all the guns out there, I'd just subdivide between pistols, rifles, machine guns and heavy weapons.

Let's propose the the pistol is the basic weapon. Rifles could give First Strike, Machine Guns a bonus to Attack Strength and Heavy Weapons grant a bombard capacity or a bonus vs tanks and artillery.

A unit can switch weapons in any friendly town - think crews in FfH - provided a) you have at least one source of Munitions and b) you have discovered the necessary technology associated with that type of weapon.

@David, congrats on getting round to FfH. Did you enjoy it?

Temrek
Sep 10, 2008, 08:58 AM
I would abstract it even further and limited the amount of firearm units you can have at any one time depending only on the amount of ammunition sources you have access too, wheter they are salvaged or produced in factories.

davidlallen
Sep 10, 2008, 10:28 AM
The possibility that gets mentioned the most is limiting the number of a unit type, based on how many resources you have. For example, the limit on rifle units might be the sum of how many ammo factories you have plus how many munitions resources you control. Let's explore that in a little more detail.

If we give unlimited ammo, then a unit could go off into a barbarian wasteland for forever, and keep firing. If a gas powered unit does that today, they would have to bring fuel trucks, but an infantry or ute unit would need no supply. Is it OK to lose this detail in the abstraction?

There is a python callback, cannotTrain, which can be used to prevent construction of a unit. So I could use this, to count up the number of rifle units and prevent construction of units if the limit is reached. This is exactly what is done by the "quantitative resources" modcomp at this link (http://forums.civfanatics.com/showthread.php?t=222884). I see I was the last one to post on that, about a month ago, so I am not sure if it is still active.

One complication with this, is that the allowable number of units may decrease while the unit is on your build queue. For example, suppose you have three rifle units building, and you lose one of your munitions resources. There is no way to allow the user to choose which rifle unit to remove from the queue. In vanilla, either you have the resource or you don't, so you may get a message that you can no longer train *any* of those units on the queue.

Maybe there is a solution which works for this mod. Suppose you start training an infantry with rifles, but during the build you run out of rifle ammo resources. When the build finishes, instead of getting nothing, you get an unarmed infantry unit (survivor). So you would wind up with three survivors built in your three cities, plus a hammer bonus for the difference. Then if a rifle upgrade cost a certain number of hammers, you could pick the one or two units to upgrade. If you had two rifle resources available, then you would wind up upgrading two survivors to rifles, one plain survivor, and a small hammer bonus.

That is complicated, but might work. Here the difference is that a unit built above the quota can gracefully "degrade" to something else.

davidlallen
Sep 10, 2008, 10:32 AM
A unit can switch weapons in any friendly town - think crews in FfH - provided a) you have at least one source of Munitions and b) you have discovered the necessary technology associated with that type of weapon.

I'm not sure about that. For the fuel system, people have also suggested that you should automatically refuel when you are in friendly territory. That assumes there is infinite transport to ferry the equipment around, basically instantly. You could downgrade four units on one side of your territory, then upgrade four units on the other side of your territory. Maybe that is OK to lose in the abstraction, but I'd have to think about it some more.

@David, congrats on getting round to FfH. Did you enjoy it?

Yes, it's fun, and as I feared it is a big timesink. But I've played 4-5 of the civs, and 4-5 I don't have much interest in (too defensive).

Refar
Sep 10, 2008, 02:33 PM
I dont know, i would be seriously [pissed] if at some point midgame i suddenly get 3 survivors, which i did not order...
Tho the example is rather extreme - loosung 3 units from the cap at once...

Would it be possible to just push the "forbidden" unit back in the queue ? Putting the survivor on top of it, but not diveting hammers ?
This way the player would have the chance to change the top build in the queue, while keeping the half done unit mothballed, unitll it can be completed (or decayes).

Another possibility would be unit-dependant replacement - say if you was going to train Guardina you get a Crossbowman instead - wich is the same... kind of...
This involves more coding of course, as each unit would have to be handled in a diffrent way...

davidlallen
Sep 10, 2008, 02:57 PM
To define my example more clearly, suppose you have resources to support 5 rifle units, you have 2 in the field, and at each of city A,B,C you put a Guardian into the queue. Then the next turn you lose one resource.

Ideally a popup would come listing the three cities and asking you to change *one* of the queued units. But that isn't going to be possible. If that was possible, then the user would also expect a dialog to change the unit back, after recapturing the resource, and that seems like too much paperwork.

A guardian costs 60 hammers, a survivor costs 15. I was thinking that after the build time of the guardian, you would instead get three survivors and each city would have a 45 hammer bonus. Then (this part I am not so sure about) you could somehow use the 45 hammers to upgrade two of them back to the guardians you ordered, and use the 45 hammers at the third city for something else. But I am not sure how to use hammers to upgrade. Maybe convert into some gold equivalent, and then the standard upgrade mechanism would work.

It is possible that this mechanism is subject to abuse, transforming hammers into gold somehow. If you pillage your own improvement to reduce the resources, you would effectively convert production into gold at 1:1.

Is there a better way to accomplish this?

Refar
Sep 10, 2008, 03:13 PM
Oh... it cancels all 3 of them. That's odd.
So basicly what happens there is, they use a empire wide "cannotTrain" even if we actually can train, just not as many as we would like to...

But why does cannotTrain return "no", while in fact training is possible....

This shouldn't happen... the game, as we all know, is turn based, the cities are handled in sequence, meaning, that it should be possible to cut in exactly at the right moment - supposing all 3 units would finish on the same turn, the expected behavior would be to finish the 2 that come first, and then to cancel/override the 3rd...

I will have to look up in the code to see where and when exactly "cannotTrain" is called...

davidlallen
Sep 10, 2008, 03:40 PM
I'm not sure which "they" you mean. The only working example we have is vanilla BTS, where you are prompted to change all the queued builds when the resource is lost. If I understand correctly from the quantitative resource thread, cannotTrain is called to determine if you are allowed to put something into the queue, only. I have not experimented with it.

I do not think there is any way to register a callback to trigger when a build queue item has a required resource lost. I guess I could write code at the end of each turn, which examined all the build queues and compared against available resources, and reject things out of the queue. But I am nervous about adjusting the build queue in the middle of the end-of-turn bookkeeping, and doing it properly seems like quite a project. Plus of course if the player can make choices about which to abandon, then the AI has to also make this sort of choice.

It is no better to have end-of-turn code simply reject the ones over quota effectively at random. This will treat the player just as badly as it treats the AI. People will complain that the one canceled is the one closest to their war front, while the one kept is produced out in the middle of nowhere. Predicting where the user would "want" the advanced resource build preserved also sounds like too much work.

Refar
Sep 10, 2008, 03:50 PM
They refers to the Quantitative Ressources Mod / Comp / Idea you described.

Removing just the overhead one, instead off all seem far better - even if you can not control which one you loose - which is kind of realistc - on ressurce shortage just a "random" victim got hit.

A very simple way to do that would be using the EventManager hook-in "OnUnitCreated" or "OnUnitBuilt" - and disbaning, or downgrading the unit if it is over the limit (possible refunding some of the invested hammers)...

davidlallen
Sep 10, 2008, 04:06 PM
I can use cannotTrain to prevent over-quota units from going into the build queue, and use onUnitBuilt to catch over-quota units coming out of the build queue. In the case of over-quota units coming out, as a player, I would feel cheated if I did not get 100% of the wasted hammers. So I would put a guardian into the queue; then after 60 hammers of production time, I would get a survivor out, plus 45 hammers. Then I can immediately build three more survivors if I wanted. That might work.

What should the "downgrade" path be? It makes sense to be the opposite of the upgrade path. Today, survivor can upgrade to guardian or machine gunner. Guardian can upgrade to machine gunner, SAM or AT infantry. Since I never put back jeep crossbow, there is no downgrade path for jeep rifle but it's easy to add. Since the ute scavenges fuel, I guess it can scavenge ammo too, so it would not count against the limits. The rebuilt units would never downgrade. Their ammo is rebuilt along with the unit itself.

I guess there would need to be "double downgrades". Suppose I queued a machine gunner, but when it came out, neither machine gun ammo nor rifle ammo was available. Then it would come out as a survivor.

Refar
Sep 10, 2008, 04:25 PM
On downgrading i was thinking along the lines, thet every "limited" unit probably will have some kind of counterpart filling a somewhat similar task, but without the cool gun...
However the only couple i can think of right now is Guardian/XBow, because both are ranged... So maybe the "downgrade" idea is not that good...

Still XBow might be overall a better choice than Guardian - all units in question are ranged.
Also XBow is a somewhat capable city-defender, so it could be less annoying to get them.
Also the difference in hammers is less huge there.

davidlallen
Sep 10, 2008, 05:20 PM
I can add upgrade from xbow to guardian, then the downgrade can be written to pick the one which is more expensive.

Temrek
Sep 10, 2008, 05:57 PM
A little ugly but viable solution would be to provide all players cities with a resource "Spare Ammunition" when you can build firearm units, but when you can no longer build those units remove the "Spare Ammunition" resource from the cities.

davidlallen
Sep 10, 2008, 06:34 PM
Whatever method we use will have some internal flag about whether it is possible to build more units at the moment. I guess we could use adding and removing a resource as an externally visible representation. I think having the "build" button for the unit greyed out with help text about why it is greyed out is also a good representation.

For example, in vanilla, you may have the technology to build a horse archer but no horse resource connected up. In this case your city has a horse archer build button but it's greyed out, and when you hover the mouse you get help text "Requires horse resource". So I'd want the Guardian build button greyed out with help text "Not enough available ammunition".

countjackula
Sep 10, 2008, 07:56 PM
I'm not sure if limited guns/ammo are worth this amount of discussion or thought . I certainly haven't been concerned with it. When I play I assume that if I can build a unit I have the necessary infrastructure to support that type of unit. Those troop support costs go towards something right? Troop maintenance costs include getting supplies to my troops. I don't have to see food being delivered to my troops to stop me from worrying that they'll die of starvation. Likewise I don't have to see ammo being delivered to my troops to stop me from worrying that they'll run out of bullets. Maybe my outlook on this is too simplistic, but unlimited ammo seems to have worked fine for vanilla Civ and the mod variants I've played so far.

Is having unlimited ammo less realistic? Yes. Does it hamper my game enjoyment? Not at all. I often find myself wishing for more detail in games, but in this aspect of game play I'm quite content with how things currently are. There are other things I'd much rather see added before this level of fine tuning is tackled, things like a beefier tech tree.

Perhaps the gun/ammo aspect could be handled with a broader tech tree, much like bronze, iron, and mithril weapons are handled in FfH. Three resources and three techs are required and allow you to fully upgrade units that can be upgraded. Also, some upgrades can be disallowed to certain unit types if desired.

Tying upgrades to resources and more tech doesn't solve "unlimited ammo" but it does provide an additional level of restriction via resource scarcity and increasing the amount knowledge (infrastructure) required. It also already exists in at least one form code-wise, which should make it easier to tackle if you chose to approach it this way.

Whatever you decide to do, I think the K.I.S.S. rule is a good one to apply here. I don't have to see all of the management acted out in game to believe that it is being done.

jefmart1
Sep 11, 2008, 06:50 AM
One idea I tried to get to work using events, was limited resources in a city. For example, fuel truck goes to a city; there is a "spell" called fuel dump. Using the spell creates an oil resource in the city for 2 turns, then after 2 turns its removed by another event.

This was awhile ago when I was working on my own post apocalypse mod, so I don't remember what I did per se, but it involves using events to create and remove buildings in a city that provided resources.

The same thing could be used for Spare ammo or its equivalent.

Deamon
Oct 04, 2008, 06:41 PM
ammo is easy to manufacture, and so is guns..

Would be cool to have artifacts though.. (sniper rifles with increased range, armours that give strength bonuses.. special machineguns and so on.

High precision equipment that only could be aquired as leftovers from before the appocalyps.

Edit: I'm a bit drunk, so please ignore typos. ;)

Vigilance
Oct 17, 2008, 10:35 PM
However, it's not clear this would be any more "fun". Two different supply streams to manage just makes things painful.


This. I really like needing to find and hoard oil, but needing to follow that same process for ammo too would be too much imo.

lopaz
Oct 21, 2008, 08:30 AM
Okay my idea is that you should check out Total Realism it has a thing where you build buildings that supply a finished product from a raw product in this case it could be some type of resource that is made into ammo or the old ammo stores from a tech are then able to have a factory built that produces ammo like you copy the old stuff. THis idea from total realism stops production of units that require this item if the raw material is low which would make it a limited number of units or you lose the raw resource for a few extra units. I have no clue where this all is in the code but it works. So you should try it out. ;) Oh I also love this mod. :)

Jabie
Oct 22, 2008, 06:42 AM
This. I really like needing to find and hoard oil, but needing to follow that same process for ammo too would be too much imo.

I agree. Let's keep the micromanagement small. There's also the problem of coding the AI to understand the importance of Munitions if you go down this route.

Vigilance
Oct 22, 2008, 06:53 AM
One solution would be to have some of the firearms units be produced randomly from ruins like oil, tanks and aircraft.

It would be less micromanagement, but even that I wouldn't be for, since it already seems like weapons production is out of your hands a lot of times. Like when you are getting tanks at a far greater rate than gas trucks, meaning sure, you have all these tanks but you have to keep them parked.

So basically, I like the basic structure of the mod a lot, I just wish there were more technologies.

Randomness
Oct 23, 2008, 07:24 PM
One posible solution for the changing wepons concept would be to make a circle of free upgadable units. For example, Handgun can upgrade at no cost to Machine Gun, Rifle, and Heavy Weponry(pros and cons would be made for all). At the same time a Rifle would upgrade to a Handgun, Machine Gun, and Heavy Weponry

davidlallen
Oct 24, 2008, 11:42 AM
I don't agree with *free* upgrades from one type to another. Part of the point is that most weapon types are rare, especially the more powerful ones. Earlier in the thread we discussed a suggestion where weapons are treated as promotions on a generic unit, and can be traded around. That keeps the number of weapons more constant -- new promotions get added as weapons are built/found. But I think the opinion so far is that managing limited fuel is fun, while managing both limited fuel and weapon types would be too much.

Slaughter
Feb 24, 2009, 11:29 PM
What about limiting good weapons by using the "National Units" limit?

For example: Its early game and my troops and mainly guys with crossbows and survivors. I can build some guardians, but the limit if two o' them until I get (insert tech name here), then it goes up to four, then after I get (insert tech name here), it goes to five, then to ten with (insert tech here) and then its unlimited.