Can some modder please mod this idea?

gunnergoz

Cat Herder
Joined
Jul 16, 2002
Messages
2,323
Location
Southern California
I am not a programmer, so I have to go begging...:blush:

I am wondering if it might not be interesting to alter the mod to include having each military unit cost one unit of population. After all, armies take people as well as money to constitute and maintain. This would make for an interesting tradeoff, especially in the early game.

It might also be possible to allow for some form of a draft, where units are called up from the population in times of war and the survivors returned to the civilian workforce at the end of the war...perhaps even retaining some portion of their experience if they were called up again later.

Losing a series of battles would be even more devastating to future development of the nation, then, because part of the population would have been decimated.

This alteration to the mod would, I suggest, make for a more challenging and interesting game. "Do we want guns or butter? - Because if we're manning the guns, we're not back home, churning out butter."

Finally, one last request - this mod would have to be compatible with Thalassicus' Universal Patch/Vanilla Enhanced Mod, because I don't play Civ V without it! :goodjob:
 
Even though I mostly play the game, I do mod a little, what are proposing is a good/realistic idea that would make players think more before war then before. I would like to stay in touch, mostly because I find that I usually turn the Idea into a whole giant mod of epic proportion! Even though I am a war monger I do like the idea, consider it made...
 
I'm going to list the Five Rules of Civ5 Modding again, for reference.

1> If some variable isn't in an existing XML table, you can't just add it and expect it to work just because it's also in some other table. Just because Buildings can add production doesn't mean Projects or Units can. Sometimes you can work around this with creative design, but most of the time it's an absolute limit within XML/SQL.

2a> Most ideas can be accomplished in Lua, which can often be used to correct for #1...
2b> ...but if you do that, then the AI often won't know how to use any of your changes properly until we have access to the DLL...
2c> ...and no, we don't know when the DLL will be released, although the common guess is at the same time as the expansion, and even then it'll be a while before people can really make use of it.

3> Ideas are plentiful. Competent modders are not. Most of the active modders on these forums have their own pet projects they're working on, so you're unlikely to find volunteers who know enough about how the code works who'll set their own work aside to meet your requests. If you find one who's already doing something similar, and structure your suggestions as modifications to what he's already working on, then you can often get what you want, as long as you accept that he has final say in his own mod and might not agree with parts of your design.

4> You're almost always better off learning how to mod for yourself. Besides just getting stuff done faster, modding is a great way to learn what is and isn't possible with the current tools, which'll greatly improve your future suggestions. Knowing whether an idea is even remotely workable is a big help; keep a document around with all of your original ideas, to revisit whenever someone figures out a new way to do things, but you have to be willing to change each part of your design to match the reality of what works and what doesn't.

5> The bigger the mod, the more likely it conflicts with every other major mod out there. GameData XML or new Lua only rarely conflict in any direct sense, although the balance of the game might be completely broken if you mix these too much. UI-related XML/Lua almost always conflict, no matter how small the changes are.

--------------------------------------------

In your particular case, item #2b is the main problem. Adding some additional cost to military units through Lua will work, in theory, except that the AI will never recognize the additional cost. It'll build the same number of units as before, and then wonder why its cities are starving every turn. Until we get the DLL, there's just no way to teach the AI the finer points of your design, and even then there might be major issues since the existing unit costs aren't handled well. The AI doesn't actually think about resource requirements, for instance; as long as you have extra resources it puts the resource-consuming units on the "can construct" list, and once you run out it just removes them from the list. There's no planning involved; this is most apparent with Uranium, where the decision between Nuclear Plants and atomic bombs is based purely on chance and can often cripple a player who chooses poorly.
 
I like this idea very much, I have even had this thought myself, but Spatzimaus is right in the way that the AI would not recognize, let alone know how to use, such a system. It would add more in-depth strategy for any human player, but it make it so the AI was effectively crippled at game start. They would build the same size military, starve their cities, lose units to maintenance, and go through the horrible cycle again.
 
They would build the same size military, starve their cities, lose units to maintenance, and go through the horrible cycle again.

Basically. You MIGHT be able to avoid this by also adjusting the unit gold cost equations, etc. to keep the AIs from building as many units as they did before, but it'd still be a flawed system that the AI just wouldn't be able to handle nearly as well as a human could.

Sometimes you can get around things like this through leveraging a new mechanism that DOES work. For instance, create a new strategic resource; let's call it "Men". Using the "Building Resources" mod component, you can make buildings that generate new units of a strategic, including ones that aren't available on the map. Since the game already knows how to limit units based on strategics (albeit in the very stupid way I mentioned before), you could use this new Men resource as a way to put a hard maximum on the number of units each civ can build, and depending on how you implement it, the limit could scale with all sorts of factors. But it'd still be an absolute hard limit, with the AI continuing to build units right up to the point where it runs out of the resource. And depending on how the resource was allocated, you could easily end up punishing the AIs that have certain Flavor preferences.

In the case of this Strategic idea, you'd also run into the possibility of a hard crash. That is, if I have 5 cities producing 10 units of the "Men" resource, and I use all 10 for units, what happens if one of my cities gets conquered? Suddenly I have only 8 units of Men, meaning my combat units are at -50% until I lose enough of them to be below my new cap, and a smart player might know to ignore the units (since they'd be harmless on offense) and just keep taking cities.
 
Even though I mostly play the game, I do mod a little, what are proposing is a good/realistic idea that would make players think more before war then before. I would like to stay in touch, mostly because I find that I usually turn the Idea into a whole giant mod of epic proportion! Even though I am a war monger I do like the idea, consider it made...

Thanks for your support of the idea, jacobwt226 (or can I just call you "Jacob?" :) )

I hope to see it implemented, though others seem to have their doubts about the AI's ability to cope with it. A creative thinker/modder should be able to overcome the challenge, though, don't you think?

I welcome dialog and support your effort, please PM me if you like. I think the idea has the potential to make Civ V a far more interesting and challenging game.
 
@Spatzimaus, @HardRocker - Thank you guys for your input, I appreciate it. I do hope a way is found to make this part of the game, one way or the other. As for modding it myself...the last programming I did was in Hypercard. Does that tell you anything? :hammer2: :badcomp: :crazyeye:
 
A creative thinker/modder should be able to overcome the challenge, though, don't you think?
Suggestion: Why don't you become that creative thinker/modder? It's not that hard to learn to mod CivV. Just stop being lazy & do it. There's even multiple guides on how to mod on this forum.
 
Also as to the AI issues: could the AI not be "taught" to take only a portion of population not necessary to other uses? An aggressive AI personality might be given a different set of priorities than a non-warlike one, for instance. The warlike AI might be told to take every third new pop and reserve it for a military unit, or a peaceful AI might be told to take only every 10th new pop...etc.

Like I said, that's just off the top of my head - you programmers are probably ROFL by now...
 
A creative thinker/modder should be able to overcome the challenge, though, don't you think?

No amount of creativity can overcome the complete absence of certain access points. We CANNOT DO a lot of things that people want, because we simply don't have access to the internal mechanisms through which those are decided. We have a very, very limited set of XML/SQL abilities, and a moderate array of Lua functions and triggers, and that's it. And as I said before, even if you CAN do something in Lua, making the AI actually use it correctly is often impossible. At best, you can hard-code the AI to perform certain actions at certain times, which is not even close to the same thing, especially if you want your mod to work well with various other mods already out there.

For instance, we can't make two AI-controlled civs friendly with each other. We can adjust each civ's relationships with each city-state, and we can make two civs go to war with each other (or declare peace), but we can't modify the relationships any finer than that, because we have no access to the code that handles those behaviors. When the DLL is released this will likely change, but in the current environment, any idea that involves adjusting those sorts of relationships is doomed to failure, no matter how awesome you think the idea is.

This is why I suggest learning how to mod; even if you know you'll never be good enough to make the mod do exactly what you want, you'll at least get a better idea of what is and isn't possible with our current tools.

Also as to the AI issues: could the AI not be "taught" to take only a portion of population not necessary to other uses?

No. We cannot "teach" the AI anything, because the AI behavior is almost entirely internal to the game engine. We can use Lua to force it to do certain things at certain times, in fairly limited ways, but those don't generally mesh well with existing systems and work far better for entirely new ones. We can encourage it to build certain things by adjusting Flavor values, but those are not only very random, but have no room for moderation. And some things (Specialists, Resources, etc.) have no Flavors at all.

For instance, take my own Age of Mythology mod. I introduce a new Priest specialist that adds Happiness, which is very important as I add severe Happiness penalties relative to the vanilla game. I WANT people using Priests, because those Priests are also a key generator in the "Favor" system I use to unlock new divine abilities. However, I give you far more Priest slots than you'll want to actually use at any given time, because using that many specialists would cripple your production and growth. So a smart player knows to fill some fraction of his Priest slots (say, half) in the core cities, and not use them at all in the small border towns that still need all the food and production they can get. You'll very quickly learn how many are appropriate in each situation.

An AI cannot handle this, in MANY ways.
1> The AI doesn't understand that this specialist adds Happiness, because the game's internal decision-making uses only the yields produced, and Happiness isn't a yield. So it won't want to use any Priests, because it sees them as worthless and can't be convinced otherwise.
2> If you give the Priest enough other bonuses that the AI would want to use it, then it'll want to fill every possible slot, because it doesn't understand diminishing returns. It'll still be basing its decisions on the yields other than Happiness, which means that the Priest specialist is now even more powerful than other types.
3> Because their primary benefit is empire-wide, the AI has no ability to judge how many Priests it should really want to use in each city at any one time, even if it did somehow understand moderation, because too many other variables are involved.
No matter how simple they seem, you cannot "teach" the AI how to handle any of the above in a way that's even remotely comparable to what a human would do. So in the end, I have to hard-code the behavior with a few small randomizations added, basing the exact amounts on my personal experience playing the mod. As in, count up the Priest slots in cities of sizes greater than 3, capping the per-city use based on population, pick a number within a range based on your pantheon of gods, and then force-set some of the Priest slots to "on" in certain cities as a result.

If you're careful enough you can get a playable behavior from the AI, but it's not done through any sort of intelligence. The AI has no clue WHY it's now using those slots. This might not seem so bad, but if you were to pair my mod with someone else's balance mod, then the AI would continue to use the exact same number of Priests, even if that balance mod changed the Happiness in a way that made Priests now worthless, because it would continue to use my distribution logic. While I could add enough variety in the override logic to make the AI seem to be reactive to changing situations, it won't even come close to matching a human.

And again, this is for an entirely new entity (the Priest), while you're asking for a modification to an existing AI logic (which we can't access). At best, you could use the CityCanConstruct Lua function to tell the AI it can't build any more units once it reaches a certain threshold, but again, it won't really understand why, so you'll be limited only to "hard" caps on the number. That's why I suggested finding some other limiting mechanism (like strategic resources) that the AI already knows how to use; it's much easier to weight the existing logic than it would be to try to override it.
 
I have been talking with my "sources (basically a bunch of gaming buddies who like mods)" and the liked it too, BUT, my main informant mentioned using food, instead of citizens...and reinstating war weariness. That sounds good to me, but I will mess with the system and see's what comes up, it will take about a couple day (after Passover of course) for me to fiddle with some stuff and make a minor mod to build off of. I am also busy, I am at the moment also working on a starcraft mod, and a board game mod...so it would take me about a 6 days (including Passover) to give you a true status. Also, spatzimanus, I agree with most of what you are saying, but then again, some of it I think you are just trying to make sure war mongering continues.
 
I thank you Spatzimaus and jacobwt226 for the comments. Also rocklikeafool for the vote of confidence that I can still learn anything at age 64... :D

With all that is on my plate now, I revel when I find time to play a game of Civ, let alone trying to learn to program it! But the point is well taken.
 
Also rocklikeafool for the vote of confidence that I can still learn anything at age 64... :D
Well, hey...no matter one's age, we all can benefit from learning new things. Exercising the old brain & all. ;)

But basically, a lot of impossible (read as possible, except for the AI's stupidity) tasks will become easier when the expansion comes out, and the .dll is released. Of course, this assumes that 2k games actually will release the .dll with the expansion...
 
I am wondering if it might not be interesting to alter the mod to include having each military unit cost one unit of population.

Your idea can actually be implemented (somewhat), and as a matter of fact I agree with you that population size should determine the size of your army, which is exactly why I'm incorporating the idea in SPQR Rise of Rome http://forums.2kgames.com/showthread.php?115219-SPQR-Rise-of-Rome

The way to do it is to adjust the handicap settings for Military Supply. Here is an example of XML code that allows for 4 free base units + 1 unit for each population of 5. Of course, you can just as easily change that to 0 free base units + 1 unit for each 1 population (but that would be too large).

Spoiler :
<GameData>
<HandicapInfos>
<Update>
<Set ProductionFreeUnits="4" ProductionFreeUnitsPopulationPercent="20" ProductionFreeUnitsPerCity="0" EarliestBarbarianReleaseTurn="1" BarbarianBonus="0"/>
<Where Type="HANDICAP_WARLORD" />
</Update>
<Update>
<Set ProductionFreeUnits="4" ProductionFreeUnitsPopulationPercent="20" ProductionFreeUnitsPerCity="0" EarliestBarbarianReleaseTurn="1" BarbarianBonus="0"/>
<Where Type="HANDICAP_PRINCE" />
</Update>
<Update>
<Set ProductionFreeUnits="4" ProductionFreeUnitsPopulationPercent="20" ProductionFreeUnitsPerCity="0" EarliestBarbarianReleaseTurn="1" BarbarianBonus="0"/>
<Where Type="HANDICAP_KING" />
</Update>
<Update>
<Set ProductionFreeUnits="4" ProductionFreeUnitsPopulationPercent="20" ProductionFreeUnitsPerCity="0" EarliestBarbarianReleaseTurn="1" BarbarianBonus="0"/>
<Where Type="HANDICAP_EMPEROR" />
</Update>
<Update>
<Set ProductionFreeUnits="4" ProductionFreeUnitsPopulationPercent="20" ProductionFreeUnitsPerCity="0" EarliestBarbarianReleaseTurn="1" BarbarianBonus="0"/>
<Where Type="HANDICAP_IMMORTAL" />
</Update>
<Update>
<Set ProductionFreeUnits="4" ProductionFreeUnitsPopulationPercent="20" ProductionFreeUnitsPerCity="0" EarliestBarbarianReleaseTurn="1" BarbarianBonus="0"/>
<Where Type="HANDICAP_DEITY" />
</Update>
</HandicapInfos>
</GameData>
 
Agreed, I have a lot on my plate, if someone wants it, you can have it, but I am working on it, slowly...and by the way, lua is actually easy to learn.
 
Of course, you can just as easily change that to 0 free base units + 1 unit for each 1 population (but that would be too large).
It could be argued that that wouldn't be too large in the beginning game. You're right though; there would need to be a limitation after a certain population cut-off. (Otherwise, a city with population 20 would get 20 free units. Yeesh, is that OP or what?!) In any case, let me see what I can do with the code you linked later on.
 
Is there some talk of 2K actually releasing the code at some point? I would think that would only happen once they more or less give up on making any more money on this particular title and leave it to the modding community and die-hards.
If so, when they do that, Civ VI can't be far behind, one would think.
 
Is there some talk of 2K actually releasing the code at some point?

Not exactly. What they'll give us is the DLL, which effectively unlocks a lot of the internal mechanisms for mods to alter. In Civ4, they gave the DLL to the community about 6 months after release; it's been a year and a half for us, but they've said we'll get it "soon", which we're guessing means June, when the expansion comes out.
 
It could be argued that that wouldn't be too large in the beginning game. You're right though; there would need to be a limitation after a certain population cut-off. (Otherwise, a city with population 20 would get 20 free units. Yeesh, is that OP or what?!) In any case, let me see what I can do with the code you linked later on.

If you allow 1 supply for every 1 population then you're essentially saying every man, woman, and child in your population is fighting in your army. I would estimate that after you take out the women, the children, the elderly, the sick, and the cowardly then you would be left with roughly 20%. That's why I have ProductionFreeUnitsPopulationPercent="20" in my mod.
 
I've been talking with Thalassicus about the food for armies mod and he says it is not vanilla enough for him to add to his mod. He and others have pointed out that this may be hard to implement since we don't yet have the dll's and the AI would not know what to do.

But how about this alternative: we build military units with production, as usual, but treat them as we do population in cities. So a military unit, once built, would have both a gold cost (pay and weapons upkeep) and a one-time food cost (which would of course come from the food supply of the city of origin.)

This could be similar to the existing mechanism that allows for specialists, i.e. pop units that are taken off the map and used to supplement research, culture, etc. But these specialists would each allow one military unit to be built and exist on the map. We could even have a special "warriors" specialist slot on the city screen. Each pop in a slot = one more unit for the city.

Does that sound interesting? Or feasible? Would the AI know (or care) that cranking out unlimited units will eventually starve his cities?

Jacobwt226, what do you think?
 
Back
Top Bottom