Barbarian : limit of the number of units ?

Sto

Should i code today ...
Joined
Dec 15, 2005
Messages
1,144
Location
Marseille (France)
I like to play with lots of animals and barbarian , but it seems that after a moment , the barbarian civ does not create any more units . If i remember well , i've seen a thread a long time ago that say that the number of barbarian units is limited at 999 . But i can't find it anymore .

So here my questions :

- possible to remove this limit ?

- if not , is this possible to add a civ at the beginning of the game that act like barbarian civ : does not die if no city left for it , does not cause war weariness to other civs , at war with other civs (except barbarians) and you can't make peace with . I can easily spread units and cities for this civ .

Any help would be very much appreciated .

Thanks , tcho !
 
The limit is numUnownedTiles/unownedTilesPerBarbarianUnit. numUnownedTiles is the number of unowned tiles in an area. UnownedTilesPerBarbarianUnit depends on your difficulty level, see CIV4HandicapInfo.xml. Halve unownedTilesPerBarbarianUnit if raging barbarians is on.

The closer to the limit you are the lower the chance of barbarians spawning.
MIN_BARBARIAN_STARTING_DISTANCE in GlobalDefines is also a factor. By default a barbarian can only spawn a mininum of two plots from any unit.

This is all in CvGame::createBarbarianUnits if changing the XML variables isn't enough.
 
Thanks for the reply :) , but this is not what i mean . In fact i force barbarian units to appear every turns with an initUnit , but after a moment the initUnit does create any more unit , there is no more creation of animals , and if the barbarian create a city , no defender can be created anymore . Someone talk about a maximum number of barbarian units created cored in the game ( 999 if i remember well , but i can't find the thread anymore ) , i 've tried to search in the sdk but i don't understand everything in c++ and don't know if this limit can be removed simply with the sdk .

i will try to add the civ but this is something i've never done , that's why i'm looking for help ,especially because i don't know if the restrictions with the civ are doable .

Thanks , Tcho !
 
I tried to find a limit in the SDK, but couldn't. I tried to find a limit ingame using the python console to create lots of barbarian units and I did find a limit. Somewhere between 8900 and 9000 units I got "unknown c++ exception". But you're not trying to get 9000 barbarian units in the game are you :eek:
 
Waouh , thanks for that , it seems that i've got another problem ... That's sure i've not reach 8900 barb units , but after a limit i get no more barb unit also with the initUnits . I will make more tests and tell you what i found .

Thanks , tcho !
 
Ok ,I've made a test with this function at the beginning of the game :

Spoiler :
Code:
                        map = CyMap()
                        iW = map.getGridWidth()
                        iH = map.getGridHeight()
                        unitAI = UnitAITypes.NO_UNITAI
                        bPlayer=gc.getPlayer(gc.getBARBARIAN_PLAYER())
                        iUnit=gc.getInfoTypeForString("UNIT_ARCHER")
                        nbBarb=0
                        bStop=False
                        for iY in range(iH):
                                if bStop:break
                                for iX in range(iW):
                                        if bStop:break
                                        if map.plot(iX,iY).isPeak():
                                                bStop=True
                                                break
                                        for iLoop in range(20):
                                                try:
                                                        bPlayer.initUnit(iUnit, iX, iY, unitAI)
                                                        nbBarb+=1
                                                except:
                                                        print "limit memory reached : "+str(nbBarb)
                                                        bStop=True
                                                        break
                                        print "nb barb unit after plot : "+str(bPlayer.getNumUnits())

And i get 8192 unit created . I will try to make some tests while playing a game and try to find a way to count the number of barbarian units created . another problem i don't understand is why i got a ctd after 8192 unit created , because in my game the initUnit does not cause ctd but just the unit does not appear .

Tcho !
 
Top Bottom