Better Ai? If you're 14...

Sure, but the product of (units) times (military technologies) can be much higher.

Spoiler :
GUILDS: 8
WHEEL: 4
SAILING: 2
MATHEMATICS: 6
ALPHABET: 4
ASTRONOMY: 4
CHEMISTRY: 6
COMBUSTION: 6
FISSION: 8
FLIGHT: 8
ADV FLIGHT: 10
COMPOSITES: 5
STEALTH: 5
HUNTING: 2
MINING: 2
ARCHERY: 6
HUSBANDRY: 2
BRONZE: 8
HORSES: 10
IRON: 10
METAL CASTING: 4
COMPASS: 4
CONSTRUCTION: 4
MACHINERY: 8
GUNPOWDER: 12
MILITARY SCIENCE: 12
RIFLING: 12
STEEL: 4
ASSEMBLY LINE: 8
ARTILLERY: 10
INDUSTRIALISM: 10
RADIO: 4
LASER: 10
ROCKETRY: 10
SATALLITES: 4


Now, for a quick approximation, we group by era:
ANCIENT: 26 = 4+2+2+2+6+2+8
CLASS: 42 = 6+4+10+10+4+4+4
MEDE: 16 = 8+8
REN: 46 = 4+6+12+12+12
INDUS: 46 = 6+8+4+8+10+10
MOD: 51 = 8+10+5+4+10+10+4
FUTURE: 5 = 5

MEDE is missing engineering, optics, feudalism, civil service, and maybe divine right as possible sources of iPower.

In any case, we take the above, and we map the starting "iPower to Real Power" ratio at each era, and the best at the end, and we might be able to come up with an algorithm to make your technological iPower matter!
 
I think you're on to something ... military techs aren't power in and of themselves, they're modifiers of unit power and production power. When considering its war plans, the AI has two flavors of power to consider:

1) How do our current troop strengths compare?

2) In a long war, can I out produce them?

In the first case, the availability of unit upgrades can mean that the enemy troops may be stronger when they get to the battlefield than they appear now. What the AI has right now (effectively) is what is the sum of their unit combat strengths, but what it needs is a fast approximation for how strong their troops could be in a couple of turns of upgrading. It's simply not a good idea to loop over all enemy units and sum what their eventual strengths would be if upgraded ... but even an approximation within 20% or so would be a big benefit.

What about something crude like:

iLandUnitPower = (# of military land units)*(best land unit power)

or, we could average this with the existing method ... so a human player sitting on a stack of warriors doesn't look too strong. Hmmm ... it's not perfect, but it might be good enough.

In the second case, Roland had already suggested scaling a city's production power by (best combat unit value / best combat unit hammer cost), so this fits in there already I think.
 
I think you should bring gold into the equation with technology because you can't upgrade your units from warrior to axeman if you don't have enough money. I agree on the technology part mainly. You also have to bring in ones that allow better production and the ability to increase stores of gold.
 
I think you should bring gold into the equation with technology because you can't upgrade your units from warrior to axeman if you don't have enough money. I agree on the technology part mainly. You also have to bring in ones that allow better production and the ability to increase stores of gold.

Yes, finances should play some role ... large current gold reserves, or a good economy that could be quickly switched to producing tons of excess gold.

How come?

It'd be very slow. A player's power is accessed many times per turn, right now that's just a read of a stored value (incredibly fast). When a unit is created, it's iPower value is added to the stored value; when a unit is destroyed, it's iPower value is subtracted (to the DLL, when a unit is upgraded it's the same as the old one dying and the new one being created). A player's power is never recomputed from 0, always just incrementally changed so the values added and subtracted for unit death and birth need to add up.

If instead we switched to a system where every time a player's power value was needed it had to be recomputed from scratch it would slow down turn times, especially if we had to loop over each unit and then find its possible upgrade types.

There's one way to adjust the current stored value system I just thought of which would also work ... right now, the iPower value for a unit is read from XML when the unit dies. Instead, we could add an iPower variable to each unit, it would be initialized to the value from XML for the unit type and then later could be adjusted based on available upgrades. Whenever this iPower variable is changed, the player's power would be adjusted accordingly. When the unit is destroyed, it's last iPower value would be subtracted from the player's power.

A fairly quick check could then be added whenever a civ acquires a new tech to see whether any of their existing units can upgrade to one of the newly enabled unit types. This could give us a very accurate count of each player's unit upgrade power, in addition to their current unit power. We could then take a weighted average of the two to find their unit power, with the weighting determined by their financial situation.

Yeah, this seems like a better idea.
 
Instead, we could add an iPower variable to each unit, it would be initialized to the value from XML for the unit type and then later could be adjusted based on available upgrades. Whenever this iPower variable is changed, the player's power would be adjusted accordingly. When the unit is destroyed, it's last iPower value would be subtracted from the player's power.

A fairly quick check could then be added whenever a civ acquires a new tech to see whether any of their existing units can upgrade to one of the newly enabled unit types. This could give us a very accurate count of each player's unit upgrade power, in addition to their current unit power. We could then take a weighted average of the two to find their unit power, with the weighting determined by their financial situation.

Yeah, this seems like a better idea.

Good idea.

Suggestion: The scaling is based on the percentage of units a civ can upgrade when they use 100% tax rate for 2 turns (not modified for gamespeed). The maximum iPower value is halfway between the old and new unit. Note that the upgraded units can't move and lose defensive bonuses so the iPower value should not reach the full value of the upgraded unit no matter how much gold is available.

In formula:

iPower = iPower_old + min (1/2, 2 * Gold at 100% tax/Gold to upgrade all) * (iPower_new - iPower_old)

where iPower_old is the power of the old unit and iPower_new is the power of the upgraded unit.

The 2 turns is based on the notion that it takes about 2 turns from the moment of a declaration of war and the moment when cities start to be taken by the enemy. That's the time a civ has to upgrade its troops. That's thus the iPower value of the ability to upgrade.

Maybe 'Gold to upgrade all' should be summed over multiple unit classes when multiple unit classes can be upgraded. That would complicate things but would be more fair. Otherwise it would seem as if the full 2 turns of gold would be available to upgrade every unit class. It would entail recalculation of the iPower values of all units (of various unit classes) that can be upgraded when a new unit is invented.
 
I was actually thinking of something simpler.

In a given era, or with a given set of technologies, the total iPower of units that are fully upgraded is off by some factor. Call it Alpha.

We use the technology 'iPower' to calculate an approximation to Alpha. (Because it already exists)

When technology iPower goes up, we take the current iPower of the civilisation, and scale it by (Alpha_1 / Alpha_0), where Alpha_0 is the old technology iPower, and Alpha_1 is the new technology iPower.

When you add or remove a unit, you add or subtract the iPower of the unit times the current Alpha.

Some plusses:
1> This doesn't require any changes to the data that is saved.
2> When you get a power-boosting technology, your power goes up in a percentage way, to reflect your new power potential. (If we wanted to be crazy, we could even have the iPower increase 'scale in' as you gain percent research in an iPower technology...)
3> When you upgrade units, your power also goes up.
4> Someone has already worked out what technologies 'generate power'.

Now, if you look above, you'll see that the technology iPower goes up by about 40 per era (with the exception of Ancient and Mede.). Classical honestly looks like an anomaly -- as if they forgot to assign iPower to technologies that should have it.

Mapping this to an Alpha value isn't that hard.

Just work out what the Alpha should be at the end of an era, and find a reasonable map from sum of technology iPower to an approximation of the ideal Alpha.

Using ^0.4 of the unit power as our Alpha, we get 1.32x for zero technology (Warriors), and x4.37 for Modern Armor (top end multiplier).

As we want to keep things close to 1x as possible, we set the 'Zero point' to x0.5 and the 'Omega Point' to x1.66.

This happens over a total of 232 technology iPower. Using a lazy-ass linear multiplier, we get an increase in alpha by 0.005 for every unit of technology iPower.

So:
Alpha = 0.5 + tech iPower /200
Power = Alpha * (Sum of unit iPower + Sum of building iPower)
Delta Power (tech) = Power / Old Alpha * New Alpha - Power
Delta Power (unit or building) = Power + Unit or Building iPower * Alpha

Some work would have to be done to prevent rounding problems. But I think this would be pretty viable.

(I'd be tempted to store/use iPower times 1000).
 
Are you guys going to bring resources into the equation because without the correct resources you can't get the better units so you could try to add that into the can I build this formula.
 
I think you should bring gold into the equation with technology because you can't upgrade your units from warrior to axeman if you don't have enough money. I agree on the technology part mainly. You also have to bring in ones that allow better production and the ability to increase stores of gold.

I was just about to suggest this, including gold as power since it can quickly become power. Also some things could be multiplicative instead of additive. I don't remember if your hammer output is part of your power rating, I know population is but things like barracks and factories instead of giving a flat increase could multiply other non-unit power sources, which is more like their actual effect.
 
I was actually thinking of something simpler.

In your setup, a military invention increases the power of the entire army even if none of the units can actually be upgraded due to the new technology. And even if the technology doesn't allow the construction of new units (because the needed resource isn't available), it still increases the building power. It doesn't take the makeup of the army and the availability of resources into account.

Next to that, I find the iPower valuations of technologies in present BTS quite horrible. So they would need to be improved.

While it's an original thought, it's in my opinion a bit too inaccurate.


If I understood jdog's approach, the revaluation of the iPower of units would only have to be done at the moment that new units become available and thus isn't too (computer) resource intensive.
 
Sometimes, the AI's have a tendency to ignore Rifling for too much.
 
In your setup, a military invention increases the power of the entire army even if none of the units can actually be upgraded due to the new technology.
*nod*

You don't get a full breakdown of your opponents forces. Instead, you have an idea of the degree their society is militarised (the unit and building iPower values), and their military technology edge.
And even if the technology doesn't allow the construction of new units (because the needed resource isn't available)
True. However, getting access to a resource (via trading) then mass upgrading isn't that hard to do (especially for the AI with its discount).

Note that I don't use the direct value of the units involved -- instead, I use a proxy (your technological iPower) that grows roughly with your empires military technology level.

This ends up with some nice properties -- you can stick some iPower into the prerequisites for a key military technology, and have an empires power grow as it approaches being able to build a particular unit.

You can have indirect power increases -- a technology that opens up a national wonder or a kick ass promotion -- grant power.

The swing of a single technology is not that huge: Bronzeworking, for example, bumps the Alpha from 0.51 to 0.55, an 8% boost. Players do get that bump even if they lack access to copper -- but at the same time, they won't get the higher boost from actually building axemen (or upgrading warriors to axemen). The real edge is when someone is in the medieval era (with a ~0.8 alpha) and someone else is approaching modern (with a ~1.2+ alpha).
Next to that, I find the iPower valuations of technologies in present BTS quite horrible. So they would need to be improved.
Agreed -- the iPower of technologies can be improved.
If I understood jdog's approach, the revaluation of the iPower of units would only have to be done at the moment that new units become available and thus isn't too (computer) resource intensive.
Sure. I'd consider it a bit too intrusive, and more complex to implement.

I also like that my plan makes the iPower in the technology tree matter. Which allows for indirect impact (like slavery being around after you get bronze working) to be factored in.
 
I don't think technology should directly affect power rating. If an AI wants to know what technologies a player has, it can use the trade screen. Similarly, I don't think production or food production should affect power rating - those things are available on the food and production graphs. Power rating should be an accurate measurement of the civ's current military units, and possibly the military units it can make in the next turn.

Suppose that we hate the Indians, and they have a tiny military, but they have a bigger empire, better technology, and more production. In this situation, we should invade them now. We should invade them now because if we wait a few hundred years, we may not get the opportunity. We should invade them now because then we can raze some cities, pillage some improvements, and cut them back down to size. We should invade them now because we hate them and want them to suffer. If power rating is purely military, that decision becomes clearer.
 
Well, the fact is that even today's power count does not reflect only the standing army . Pop, wonders, regular buildings and technology also count for it. If we go that line, we will need to strip those out of the count as well, because the AI as it is will avoid attack me because I've built GW or have 20 cities with 20 pop guarded by warriors ;) The game developers clearly made the power count to reflect not only the standing army, but also the possibilities that a empire have of raising a army and the defensive possibilities it has . It might not be that faithful in reflecting that reality ( I would love to see a power count that would also consider geographical issues, like bottlenecks.... but that would be probably too much ), but the idea is clearly seeable. and we have also to consider that what you are proposing may even hurt the AI ( imagine: I have a army of mostly low grade units and i want to attack a AI without being me firing the first shot. Then I piss that AI to the extreme until that AI DOWs me. In the next turns I whip, $rush and/or draft as much as I can and sudently I become more powerful than them and take the ofensive.... this already happens with the current settings, but it would be far worse if the power count only reflected the standing army ).

I think that the best way to deal with this would be really apply techs as sort of multiplier, as already sugested by others. Not directly power as it is now, though: knowing how to make maces will not serve you much without the said maces ;)
 
Yes, I also think that power should reflect a civ's capacity for making war. I mean, if a civ has the techs to build advanced weapons, the production ability to mass produce them, and enough cities to absorb an attack, that should count for something... On the other hand, countries completely miscalculate another country's capacity to go to war.
 
Right now the AI has one power value with a lot of different aspects thrown into it. It's hard to know how well unit, production, and tech power are balanced in this composite rating as they're never broken out separately.

One of my plans is to have the AI able to examine the different components of power, so that in MartinHarper's Indian scenario above the AI could see a small standing army but a huge production and tech potential for power. When the AI can see this, it can plan for it ... like building a larger than normal invasion force and hitting with everything its got in an effort to win fast, and then sue for peace if the going is too slow and the Indian military power grows too fast.

On the flip side, an AI which knows it has a production advantage can afford to take more risks with units, sending extras to pillage and harass.
 
Right now the AI has one power value with a lot of different aspects thrown into it. It's hard to know how well unit, production, and tech power are balanced in this composite rating as they're never broken out separately.

One of my plans is to have the AI able to examine the different components of power, so that in MartinHarper's Indian scenario above the AI could see a small standing army but a huge production and tech potential for power. When the AI can see this, it can plan for it ... like building a larger than normal invasion force and hitting with everything its got in an effort to win fast, and then sue for peace if the going is too slow and the Indian military power grows too fast.

On the flip side, an AI which knows it has a production advantage can afford to take more risks with units, sending extras to pillage and harass.

That's an interesting point. If the AI knows that the player has the potential for a large army but no such army in existence, it will know that it has to go for a knock-out blow as quickly as possible. I mean, really the AI should try to do this under any circumstance. If it were a large army and limited ability replace its losses, the AI would still want a large force to counter the large defending army.
 
In my mind, where military power is an estimate of military power now plus military power that can be produced or upgraded next turn, the components of military power would be as below. Plainly this could be modified if we are trying to estimate military power over the next five turns.

Current military units

We have a good idea of the principles behind this. I suggest something like:
Unit Power = Strength^1.5 * (5+Move) * (10+First Strikes), further modified by bonuses, type, immunities, etc. We would also modify this by the potential for upgrades.

Draftable Military Units

We assume that we draft up to the cap in the next turn.

Drafting Power = Power of Draft Unit * ( Nationalism ? 3 : 0 )

Civs that can switch to Nationalism without anarchy are assumed to be running Nationalism.

Indirect boost from civics and technology.

Power from regular production

We assume that every city is immediately set to work producing the military unit with the best power/hammer ratio. We can estimate it as:

Production Power = Total Production * Best (Power/Hammers)

Indirect boost from production (and hence from tech/buildings/population) and technology.

Power from Whip/Gold Rushing

Whip Power = Unit with highest Power * Cities with sufficient population to rush it
Gold Power = ((Total Gold + Max Gold Production) / Rush Modifier) * Best (Power/Hammers)

You only get these benefits with the relevant civics, or if you can switch civics without anarchy.

Indirect boost from population, gold reserves, GDP, and technology

Defensive buildings/culture

These I find tricky. If a civ has many defensive buildings and lots of culture, then it is a trickier target for invasion, but that doesn't automatically translate into it being more threatening. On the other hand, those defences make war safer for that civ, so going to war is less risky, and this does make it indirectly more threatening. This is clearest with anti-nuke defences.
 
I was thinking of having what you could buy/whip/draft count for half (or some fraction) of it's usual contribution to your potential power if you had access to those civics but weren't running them (or had spirituality).
I think it's interesting to be able to switch to something with buy/whip/draft and have it increase your power rating before you actually activate it.
 
Back
Top Bottom