8.7 Supply limit exceeded

Maniac

Apolyton Sage
Joined
Nov 27, 2004
Messages
5,603
Location
Gent, Belgium
I have never encountered this before. There apparently is a unit supply limit of 10+(2*#ofCities). Above that you get a hammer penalty for building further units.

This is not noted in the UI however. The city screen help doesn't mention this modifier, yet my total hammer output is based on a +35% instead of +45% boost.
 
This is something Firaxis presumably designed to keep the map from clogging with a sea of units. There was a big fuss a year ago about how we can "break 1upt" with "carpets of doom." I did increase the cap so we seldom run into it:

Vanilla

  • 5 + 2*numcities
  • Counts all units
  • Affects all production (units, buildings, wonders)
  • Can reduce production to 0%
TBM

  • 10+2*numcities
  • Counts only land military units
  • Affects only production of land military units
  • Can reduce production to 20%
With the vanilla settings Bismark usually ran into the supply cap from early game barbs.

I'll investigate the cityview tooltip to add some info there about it, thanks for bringing that up. :thumbsup:
 
Does Civ5 currently offer the option (API?) to only give the 10% per unit penalty to AIs?

Code:
int iHammerModifier = 0;
if (!pPlayer.isHuman())
{
	iHammerModifier = -10;
}

But translated into Lua or sql or whatever?

This seems like a big restraint on small tall empires. :eek:
 
How do you think of tall games? :)

This is how I categorize the three playstyles in Civ:
  • Tall: 5 cities of 20:c5citizen:+, peaceful Culture victories
  • Wide: 6-10 cities of lower pop, peaceful Science victories
  • Conquest: 10+ cities of lower pop, Domination victories (or sometimes Science)
All three can go Diplomacy.

  • In a tall empire we can support 20 units. I've never needed more than 5 in my tall games (one garrison per city).
  • In wide games we have more cities but don't need a much larger army, since we're not conquering anyone.
  • With a somewhat small conquest empire of 10 cities and 5 puppets, supply is at 1 garrison in every city plus 25 land military units in our army. I don't think I could fit a size 25 land army on the battlefield...
I haven't ever hit the supply cap myself. The only rare times people encountered it in the past was with 1 capital + barbarians as Bismark, so I altered it for that situation, to make it higher than vanilla.

I'm not sure I recognize what strategy you're using in those screenshots. Is it a conquest game while razing all captured cities? With or without the cap, I'd suggest an occupy+puppet strategy. The only real disadvantage to keeping cities in a conquest game is unhappiness, and we can counter it with:

+2:c5happy: Colosseums
+3:c5happy: Theaters
+1:c5happy: Garrison (Military Caste)
+1:c5happy: Walls and Castles (Professional Army)
+1:c5happy: per resource, including surplus copies (Commerce finisher)

A 6 :c5citizen: city is happiness-neutral with one of each. Other things like a circus or stoneworks allow us to get higher neutral-cities in the early game, and Police State gives us a big +3:c5happy: per conquered city in late game.
 
It's the first time I've run into this as well, but what can I say: I could definitely use some extra firepower. See screenshot. ;)

Anyway, I'm okay with just making the change with me personally. But I've never written a line of Lua before, so I don't know the syntax and grammar.

I assume the relevant function is:

Code:
function GetSupplyModifier_Player(player, yieldType, doUpdate)
	if yieldType and yieldType ~= YieldTypes.YIELD_PRODUCTION then
		return 0
	end
	local yieldMod = 0
	local netSupply = GetMaxUnitSupply(player) - GetCurrentUnitSupply(player, doUpdate)
	if netSupply < 0 then
		yieldMod = math.max(GameInfo.UnofficialPatch.SUPPLY_PENALTY_MAX.Value, netSupply * GameInfo.UnofficialPatch.SUPPLY_PENALTY_PER_UNIT_PERCENT.Value)
	end
	return yieldMod
end

I guess everything should work out if I return that function 0 for human players. Now I'm wondering, is "player" a pointer or a... err I don't how people call that. An index? What iPlayer is called in this Civ4 python example:

Code:
	def onBeginPlayerTurn(self, argsList):
		'Called at the beginning of a players turn'
		self.parent.onBeginPlayerTurn(self, argsList)
		iGameTurn, iPlayer = argsList

		pPlayer = gc.getPlayer(iPlayer)

What's the Lua equivalent?
local pPlayer = Players[player](;?)
?

Depending on whether it's a pointer or not, would this code work?:

(local pPlayer = Players[player](;?))
if player/pPlayer:IsHuman() then
return 0(;??)
end

Is use of ; unnecessary but not error-causing in Lua? I see it used in DiploCorner.lua but not in YieldLibrary.lua. Sorry for the n00b questions.
 
PHP:
function GetSupplyModifier_Player(player, yieldType, doUpdate)
	if player:IsHuman() then
		return 0
	end
	if yieldType and yieldType ~= YieldTypes.YIELD_PRODUCTION then
		return 0
	end
	local yieldMod = 0
	local netSupply = GetMaxUnitSupply(player) - GetCurrentUnitSupply(player, doUpdate)
	if netSupply < 0 then
		yieldMod = math.max(UnofficialPatch.SUPPLY_PENALTY_MAX, netSupply * UnofficialPatch.SUPPLY_PENALTY_PER_UNIT_PERCENT)
	end
	return yieldMod
end

Player is handled like an object passed by reference.

It's an array internally, where each index is the name of a data member or method, and the value at that index is the member/method value. Everything in lua is arrays/tables. These are basically equivalent:

player:IsHuman()
player.IsHuman()
player["IsHuman"]()

There's some rare situations where the difference matters but it's not usually important. This is helpful when making function jump tables that run one of various function names stored in a table.
 
How do you think of tall games? :)

I don't know if I have ever played a tall game or had a city size 20. At what turn do you usually reach size 20?? When I won one game with the Persians as a cultural victory, I had four self-founded cities, but also 15 puppets or so.

In a tall empire we can support 20 units. I've never needed more than 5 in my tall games (one garrison per city).

What do you do when someone attacks you? :scared:

I'm not sure I recognize what strategy you're using in those screenshots.

That game is kinda screwed up by the high per city increase of national wonders and me not realizing my puppets would also increase the national wonder cost in my capital. :( Basically I just captured a couple puppets, accepted peace when given 3000 gold, and in the meantime and after the war started building national wonders. In the meantime I had built up a serious science gap however, and made the mistake of not occupying my puppets.
 
I don't watch turn numbers closely. I only go for tall games if I'm coastal, since there's half or less directions for AIs to attack from. A citadel or two and ranged defenders in cities has been enough to hold them off on emperor difficulty. Ranged unit damage got buffed a lot in the latest vanilla patch, including city damage, which can be rather high with Oligarchy. I also usually have at least one mounted unit to chase down AI siege units.
 
Back
Top Bottom