• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Small modmod - No infinite units

Fermongu

Warlord
Joined
Oct 27, 2017
Messages
199
I was annoyed of seeing AI build massive stacks of 30-50 Atlatist plus 30-50 log rams. I was also annoyed of infinite scouts roaming around everywhere. So I have tweaked some numbers and put limits to buildable units.

I hoped to gain some performance gain this way, but sadly I have failed to see any :(

This is experimental, but I hope to see more balanced armies and less massive doom stacks.

Some general rules I followed are like this:
- city defense & law units: 40-50 unit limit
- land scouts: 3 unit limit (2 for aerial and sea scouts)
- hunters: 3
- canines: 10
- felines: 5
- early infantry: 8 unit limit each different unit type (spearman, crossbowman, swordsman, etc)
- mid game infantry: 80 (musketman--->infantry)
- late infantry: 16-32 (marines, tesla, clones, robots, etc)
- cavalry & tanks: 10
- grenadiers, flamethrowers: 5
- anti-air, machine gun: 10
- siege: 15
- merchants: 3
- sea transport, pirates, subs, carriers: 5
- navy: 8
- fighters, helicopters: 8
- bombers: 5
- healers: 10-40
- entertainers: 10-25
- workers & space stuff: untouched, no limit
- "bad boys": untouched, limited to 2-5 units in base mod
- cultural units: 10 (unless being scout, hunter, merchant, pirate, etc)

I don't think this will have much effect on early game, probably more when there are a big number of cities to defend. As I said, this is experimental, numbers can be changed if i get feedback, because I have never been able to make a game past classical era :(

You may be compelled to make more strategic decissions when building your army, in mid-late game. Having cultural units available is more noticeable, as you can surpass normal unit limits with them if you want a bigger army.

Effects on AI long term are unpredictable. I think the AI is more willing to declare war early on, but I may be wrong, I have only started 1 test campaign so far.

Edit: I played in GEM map until classical era and no problems. I saw more varied units on AI cities, less stacking of units.

Edit: I made version 2, adding +10% upscaling costs to combat units (cultural units had upscaling costs of 2%, I made them 10% too). Again, experimental. I'm starting new campaign on standard map so maybe i can reach further than classical era.

Edit: increased a bit city defense and infantry limits. Reduced upscaling costs to +5%. Simplified criminals upgrading paths.

Edit: healers and entertainers now have limits too. Tweaked and increased mid and late units limits. Streamlined late game upgrading paths. Added animal spawn file with max density of animals reduced a bit.

To install, unrar on main C2C folder.
 

Attachments

Last edited:
Honestly, the problem is far better fixed in the AI that decides to create tons of units instead of buildings and such. Fixing the code in the dll will probably be more worth your time.
 
Honestly, the problem is far better fixed in the AI that decides to create tons of units instead of buildings and such. Fixing the code in the dll will probably be more worth your time.
Or just don't see it as a problem... when you have a lot of unit types, you will need the AI to train a lot of units. If the AI were to build any less of a force than it currently does, many players would easily stomp them on the basis of being simply choosing to train far more units for their attacks and defenses. 'too many' is a subjective term that I've always found is best reserved for the point at which we start seeing crashes that can't be corrected without turning down the unit populations in the game.

Limiting in this manner is disastrous for the AI btw. If it cannot build what it thinks it needs for an attack force it will never be able to invade. Establishing limits does nothing to change its mind about what it thinks it needs but it CAN keep it from ever being able to reach what it believes it should be building up to.
 
I let my game run with AI taking over for about 20 turns. Within that time, it created like 30+ story tellers, a bunch of out-of-date units, etc, while in peace-time. I think it should at least react to its' environment a bit instead of just pumping out units.
 
I let my game run with AI taking over for about 20 turns. Within that time, it created like 30+ story tellers, a bunch of out-of-date units, etc, while in peace-time. I think it should at least react to its' environment a bit instead of just pumping out units.
It would be important to understand why this happens so as to be able to try to theorize how to address the cause without allowing it to overreact. It's been very difficult to tool properly.
 
can we upscale the unit cost like it is currently for national units (2% increase in cost for every unit build). more units slow down the game. the limit should be same for AI and human players to let the games move to later ages
 
The unit limit should already apply to both AI and human player.

The upscale in cost I think can be done adding a specific tag in the XML's that national units already have have.

<UnitClassInfo>
<Type>UNITCLASS_BARUD_WARRIOR</Type>
<Description>TXT_KEY_UNIT_BARUD_WARRIOR</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>10</iMaxPlayerInstances>---------- This is max. number of units
<iInstanceCostModifier>2</iInstanceCostModifier>---------- I think this is upscaling cost
<DefaultUnit>UNIT_BARUD_WARRIOR</DefaultUnit>
</UnitClassInfo>

I can probably add that tag to all units, maybe increase it a bit too, I think +2% has no real impact on recruiting costs. In the next version, but I have to study a lot in the next month :(
 
Honestly, the problem is far better fixed in the AI that decides to create tons of units instead of buildings and such. Fixing the code in the dll will probably be more worth your time.

You're right. This is just a bandaid to not let the game run out of control with units. Or that is my intention at least.
 
can we upscale the unit cost like it is currently for national units (2% increase in cost for every unit build). more units slow down the game. the limit should be same for AI and human players to let the games move to later ages
That may be the better way to approach things to create limitations that the AI would respect but not be destroyed by. I'd be intrigued to see this planned out and implemented and tested.
 
What % increase do you suggest? I was thinking of giving it a notable boost (10-15%)

I still think a hard cap must be put to avoid AI building insane number of units, if some bug affect AI to spam them.
 
What % increase do you suggest? I was thinking of giving it a notable boost (10-15%)

I still think a hard cap must be put to avoid AI building insane number of units, if some bug affect AI to spam them.
Hard caps are really not very good for the AI. As for the %increase, it's cumulative so I wouldn't go overboard. 5% might be effective plenty.
 
Version 3: Increased a bit city defense and some infantry limits. Reduced upscaling costs to +5%. Simplified criminals upgrading paths.
 
Version 4:

- now healers and story-tellers line of units have limits too (but no upscaling costs).
- tweaked and increased some limits from mid and late game units, so you can upgrade your units even if you build all available.
- streamlined upgrading paths, particularly in late game units. I think they make more sense now.
- added animal spawn file with max density of animals reduced a bit.
 
How can I make not possible to build "old" units? For example, when you build all permited rogues (2), then you can build the previous unit, thiefs. Same with clubmans, I want them obsoleted when spiked clubmans are available, same with hunter line of units and so on.
 
How can I make not possible to build "old" units? For example, when you build all permited rogues (2), then you can build the previous unit, thiefs. Same with clubmans, I want them obsoleted when spiked clubmans are available, same with hunter line of units and so on.
There is ForceObsolete tag for that.
Some units already have it.
 
On a quick search i see 2 such tags:

<ForceObsoleteTech>TECH_TRACKING</ForceObsoleteTech>
<ForceObsoleteUnitClasses>
<ForceObsoleteUnitClass>
<ForceObsoleteUnitClassType>UNITCLASS_NEANDERTHAL_WANDERER</ForceObsoleteUnitClassType>
<bForceObsoleteUnitClass>1</bForceObsoleteUnitClass>
</ForceObsoleteUnitClass>
</ForceObsoleteUnitClasses>

Should I add the tech one or the UnitClass one? both?
 
On a quick search i see 2 such tags:

<ForceObsoleteTech>TECH_TRACKING</ForceObsoleteTech>
<ForceObsoleteUnitClasses>
<ForceObsoleteUnitClass>
<ForceObsoleteUnitClassType>UNITCLASS_NEANDERTHAL_WANDERER</ForceObsoleteUnitClassType>
<bForceObsoleteUnitClass>1</bForceObsoleteUnitClass>
</ForceObsoleteUnitClass>
</ForceObsoleteUnitClasses>

Should I add the tech one or the UnitClass one? both?
Use ForceObsoleteTech.
 
How can I make not possible to build "old" units? For example, when you build all permited rogues (2), then you can build the previous unit, thiefs. Same with clubmans, I want them obsoleted when spiked clubmans are available, same with hunter line of units and so on.
This is exactly what Force Obsolete was designed for.

I can't remember if you can link it by unit or not. If you can that would be better than using a tech since units can move between techs and it would be something else to remember to change.
 
Back
Top Bottom