Unit Experience Per Level

DarkonSB

Chieftain
Joined
Jun 19, 2006
Messages
9
HI

Looking for a little help here.

Does anyone who how to change the Experience required per Unit Level, I can't figure it out.

Thanks in advance.
 
Your right, definitly not easily changed. But the base amount of xp you get for defeating units is in the CIV4UnitInfos.xml file:

Code:
            <iXPValueAttack>4</iXPValueAttack>
            <iXPValueDefense>2</iXPValueDefense>

If you increase that you will get more for defeating the unit by attacking or defending from it. So you can accomplish the same effect (changing how easy it is to level) by modifying those values that you could with a sdk change to the level limits.
 
Thanks for the response guys.

Thanks, saltbush, I'll check in the SDK.

Thanks Kael, but I've checked the CIV4UnitInfos.xml, and you can also set the Min/Max Experience per combat in the Globals.


But the reason I'm looking for this is that I don't like the fact that the early level are so fast, and the late are almost impossible to reach due to the exponential increase in experience per level.

I'm trying to create a mod that adds a LOT of new different & specialist promotions, but makes each promotion smaller in effect.
To balance this I wanted to decrease the experience needed per level so that units have alot more, but smaller, promotions.
 
The current formula is the units level squared plus 1 so

level 1 (no promotion) 1^2 +1 = 2
level 2 (1 promotion) 2^2 +1 = 5
level 3 (2 promotion) 3^2 +1 = 10

I have been thinking of adding an experience scaler which would act to multiply the above values by an int value you can put in the global defines, the game would also multiply all exp from combat and buildings by the scalar (and thouse XP caping effects as well) so it wouldn't have any net effect other then making the whole scale more granular and thus allowing some interesting XP trikle effects.

If I was to split it into 2 seperate global defines one for the XP needed for next level and one for the XP gained in Combat and from buildings you would have a handy way of adjusting the relative rate at which units gain promotions, though you would still have the exponential behavior. If the level multiplier is higher then the reward multipler you slow down promostions, if their equal your matching the current system and if level multiplier is lower you incresse the rate of promotion. I think I will put this on my TODO list.
 
Thanks Impaler[WrG], that explains why they arc up so fast, the squared formula increases it way too fast.
I also agree a scaler would be needed, as if you try using any other standard formula you either get the same situation or an experience per level that doesn't increase as levels goes up.

I haven't had time yet to look in SDK for the specific coding, but I'll try take a look soon.


Lord Olleus, I have to agree with you, even putting modding aside, I always though the XP jumped up way too fast.
Though I have gotten a few units to level 7, 50XP, but thta was tough.
 
Thanks but it was actualy TheGreatApple who passed that bit of info to me on another thread.

Well thats way more then I ever managed (ofcorse I am a wuss Builder who gets by with 1 garrision unit in half my Cities).

An alternative might be to have some kind of switch that puts us into an Incremental type advancement.

Exp for next level = current level * Scaling Factor

But that dosn't sound very fun either, I think exponential is the way to go but people want it to be a slower exponential curve, perhaps each level is CurrentLevel to the power of some floting point number that can be put in a Global define. Combining that with the scalar and you could have almost any progression you like from fast to slow, Incremental to exponential.
 
You might be on to something.

I like your idea,
Exp for next level = current level * Scaling Factor
, but we can make it simpler.

Unit Level Calculation XP Level Per Level
Level 1 = ((Current level-1)*1.15) +2 = 2 ~2
Level 2 = ((Current level-1)*1.15) +2 = 4 ~2
Level 3 = ((Current level-1)*1.15) +2 = 7 ~3
Level 4 = ((Current level-1)*1.15) +2 = 10 ~3
Level 5 = ((Current level-1)*1.15) +2 = 13 ~3
Level 6 = ((Current level-1)*1.15) +2 = 18 ~4
Level 7 = ((Current level-1)*1.15) +2 = 22 ~5
Level 8 = ((Current level-1)*1.15) +2 = 27 ~5
Level 9 = ((Current level-1)*1.15) +2 = 34 ~6
Level 10 = ((Current level-1)*1.15) +2 = 41 ~7
Level 11 = ((Current level-1)*1.15) +2 = 49 ~8
Level 12 = ((Current level-1)*1.15) +2 = 58 ~9
Level 13 = ((Current level-1)*1.15) +2 = 69 ~11
Level 14 = ((Current level-1)*1.15) +2 = 81 ~12
Level 15 = ((Current level-1)*1.15) +2 = 95 ~14
Level 16 = ((Current level-1)*1.15) +2 = 111 ~16
Level 17 = ((Current level-1)*1.15) +2 = 130 ~19
Level 18 = ((Current level-1)*1.15) +2 = 152 ~22
Level 19 = ((Current level-1)*1.15) +2 = 176 ~25
Level 20 = ((Current level-1)*1.15) +2 = 205 ~28

As you can see the progression is much slower, yet still becomes very expensive as you go up, though not as quickly.
The later levels are still very expensive, I'll see if I can think of some way to slow them down without slowing down the early levels as well.
But it's a start.

Now if I can just find the source coding, I can start testing it.
 
Well I was intending for a multiplier to be included so I can make the whole scale more granular. So 1 XP would equate to 10 or even a Hundred. Both aproatches are compatable the math would be

( (Level ^ X ) + Y ) * Z = experience for next level

X the ExpereincePowervalue
Y the ExperienceIncrementvalue
Z the ExperienceScalarvalue

The original system would be replicated with X = 2, Y = 1, Z = 1 so thouse would be the default values if the new global defines arn't found at loading.

Too tone it down even slower you might try to incresse the Increment value to 2.5 and further decreese the Powervalue say to 1.12 - 1.10 range. When the powervalue hits 1 you will be at a flat line state or Y additional XP to get each level.

Most of the work in coding this is adding the Global Defines and all the read/write stuff that goes along with it. If your just interested in doing a quick hardcode for personal use then I'll work on the more elaborate version and use it in the CCCP (Civ 4 Core Community Project ;) )
 
Gloabal defines are read automatical.. So no problem there.

You simple query them with GC.getDefineFLOAT("EXPERIENCE_POWER_VALUE")

Only the defaulting might be problematic, but no read/write stuff involved.
 
Why the reason we program anything.... Lazyness :lol:
Realy who will want to sit down and come up with a number progression for 50 levels and enter it into the XML.

Chalid: I was refering to what to do if the person insn't using modified XML files
 
Actualy I though all the data-members just retain what ever they are Initialized at (which is usualy zero but can often be -1 for to indicate NO_UNIT and NO_PLAYER and other such things that will be on arrays). I will check to see if that applies with global defines.

the code is at

int CvUnit::experienceNeeded() const
 
Back
Top Bottom