Loading...
  OR  Zero-K Name:    Password:   

some questions about the AI

8 posts, 890 views
Post comment
Filter:    Player:  
sort
4 years ago
hello guys
complete newbie here ... and ofcourse enjoying this little gem of a game

although i even don't have 10 complete games under my belt but i couldn't resist the temptation to alter AI files to make it more enjoyable for my own experience. right now i play on easy and maaaaaan its kicking my butt so damn hard i cry from joy.
this is one of the best, if not the best, AIs i have encountered.

i just have some questions that i would love to know the answers.

1- i faced something weird in the AI code that i think is there by mistake. in economy AI file of every AI, there is a line called "build_delay" .... its 70 for beginner, 15 for novice, 30 for easy, 10 for normal and its disabled for hard and brutal.
i think novice and easy values are mistakenly misplaced. and it would be lovely if someone can shed some light about the meaning of it ... is it the delay for every building construction order faction-wide (which i dont think it is) or if this delay is calculated for every construction unit individually?

2- when i airlifted some striders behind the enemy lines for the second time ... i saw a lovely thing ... enemy faction responded with a big defensive army ... it was like it has learned a lesson and put some units there ... but meanwhile it was a little disturbing that such a powerful army that engaged and killed 3 striders, was gathering dust at base ... why not attack and wipe us out ... i have seen the easy AI attack me and my ally base with 2 grizzly units ... but there was 4 of them sitting in their base ... why not attack with them and wipe us out?

i am definitely not a strategic player ... i don't want to plan my every attack and i wont punish the enemy for their every mistake ... i just want to have some fun ... admittedly i had a good defensive turret ring in front of my base ... but as soon as i finished this defensive line ... there was no more attacks to me ... both enemy AIs turned their attention to my AI ally ... i know its smart ... they don't want to waste their units on my turrets ... but i want to seen my fancy turrets in action :'( ... where is the code line for this AI behavior ... i would like them to be more brave (and stupid) and attack my defensive lines.

i have found this line in the behavior AI file
"thr_mod": {
"attack"

is this it ? if i lower the values a little ... would it make them a little bit more brave ?

3 - my final question is where can i find the definition of these AI code lines ? for example in behavior AI file there is a line called ------ "raid": [6.0, 20.0], // [<min>, <avg>] power of raider squad ------ where can i find what that 6 represents ... is it 6 units or what ? i mean we cant have 6.5 units right :D ? where can i find that how the game engine reads these values?

well ... if anyone has the time and patience to go through this wall of text ... any information would be lovely ... and keep in mind that you are talking to someone with 0 experience in coding or anything related to coding

and sorry if my english is broken ... not my first language

+0 / -0
Heya

when opening the add Ai menu;
there is CAI, this is the genesis of circuit.

then came circuit ai; in its original form it is known as CircuitBrutal, anything circuit below brutal (hard,normal...) is the same ai but with handicaps hardcoded into it.
which is why u see it sit in base and other lobbery (inefficencies).

the ultimate and latest ai is zkgbai https://github.com/Anarchid/zkgbai/releases , its stronger than the brutal (non-gimped) circuit ai.

there is a newest version of circuit, which is being called economist, it is in my experience at the level of old CAI, but it does a better job in the long run (apparently, i havent seen it live more than 10 min).


im sorry this answers to very little of your questions, i am not very knowledgable on ai code
im also sorry my english is broken, hopefully u can make sense of my derp

GL HF

+0 / -0
4 years ago
hello friend and thanks for the comment

about all the AIs being a handicapped version of brutal AI, it was something that i was getting a feeling that it might be the case as i was looking at the AI code .... so thanks for clearing that up as i'm very new here and don't know the history of AIs for this game

i didn't download the ZKGBAI for two simple reasons:
first, as the latest version is 7 month old ... i didn't know if it work properly and as the creator intended in the current version of the game ... cause when i see the change log of game version updates ... i can see the developers are paying attention to unit balance and AI improvements ... so i don't know if a 7 month old AI is working as intended

second and the more important one ... i'm not a serious player ... i want to chill and play ... dont get me wrong i love to play with a smart AI (and i'm very happy with what i see) ... but i don't want my gaming experience to include wrestling with my keyboard and sweating and cursing ... i don't think i even would want to play with anything more than normal ... as the constant raiding and attention to every pixel of the map is just too much for my taste ... i just want to chill and enjoy the smart (yet handicapped :D) AI.

i only need to tweak some AI behaviors so i can enjoy this game much more .... for example this is a code from easy AI behavior file:

"retreat": {
// "builder": 0.75, // default value for all builders
// "fighter": 0.45, // default value for all not-builder units
// "shield": [0.25, 0.4] // [<empty>, <full>] shield power

// units fighting to the death is more fun for noobs
"builder": 0.01, // default value for all builders
"fighter": 0.01, // default value for all not-builder units
"shield": [0.01, 0.01] // [<empty>, <full>] shield power

<<<<<units fighting to the death is more fun for noobs>>>>> this line defines my view of having fun ... i would never want an AI to retreat just so it can heal ... you come to daddy to die not to heal you stupid robot :D
+0 / -0
Hi

behaviour.json config:
1) economy.build_delay - when constructor (mobile or factory) finished building it will wait doing nothing for economy.build_delay seconds before another construction order issued (on per-unit basis, not per-faction).
I don't know in what order difficulties should align, can't say if there's an error about economy.build_delay for novice or easy.

2) Regular attackers has 2 phases:
a) Defence: AI accumulates units at own base until sum_group_power >= quota.thr_mod.defence * nearest_enemy_cluster_threat. Lowering quota.thr_mod.defence should result in more frequent attacks with smaller groups. Also quota.thr_mod.defence: [<min>, <max>] is internally a single value equal to random(<min>, <max>) just to randomize behaviour a bit.
b) Attack: quota.thr_mod.attack: [<min>, <max>] - again random(<min>, <max>) - this value multiplies enemy threat (it actually divides AttackGroup power) during target selection, so the lower this value the more AttackGroup will be eager to suicide.

3) quota.raid: [<min>, <avg>].
Threat (enemy) and power (own) is currently magic values calculated by AI code like
threat = DPS^0.5 * alpha_damage^0.25 * (current_health + current_shield*2)^0.5 * const1

DPS - damage per second (with custom modifiers for status effects like stun or slow);
alphaDamage - single shot damage (with custom modifiers for status effects like stun or slow);
const1 - some precalculated constant to keep values small near 1.0 (instead of 100000.0)


Currently the only way to read threat values for each unit is to recompile AI and manually print it. Few threat examples:
Glaive (cloakraid) = 1.108003;
Duck (amphraid) = 2.12699;
Detriment (striderdetriment) = 257.516357


For quota.raid=[6.0, 20.0] - first value 6.0 controls minimum power of raid group; 6*cloakraid or 3*amphraid is enough to form a group and start raiding:
6*1.108003 >= 6.0 or 3*2.12699 >= 6.0 or any combination of raiders where total power sum >= 6.0. Second value 20.0 controls maximum number of raiders in a single group: if power of a group exceeds 20.0 another raider won't be assigned to this group.

4) retreat.builder, retreat.fighter - default percent of health at which unit will retreat to base (separate for builders and attackers). But per-unit config value overrides it, see behaviour.cloakcon.retreat for example (also see Zero-K units for internal-name to human-readable translation, cloakcon==Conjurer).
retreat.shield: [<empty>, <full>] - at <empty> percent of shield unit will retreat to base, when shield regenerates to <full> percent unit will return to battle (0.85 == 85%)
+1 / -0
4 years ago
WOW ... very detailed and precise answer Lamer ... many thanks ... this was eye-opening for uneducated plebs like me xD
i wish i had your knowledge about the game code cause i cant make heads or tails from almost 50% of the AI code ... although it explains what the code actually do for much of the code ... but the explanations are sometimes vague or maybe its just above my pay grade ... i wish there was a way to know what exactly every AI code line means ... but hey life is not perfect

so as you mentioned the ----- thr_mod.attack: [<min>, <max>] ----- is definitely something i would want to change ... i will lower it by 0.1 or 0.2 just to make the AI a little bit more brave ... in doing so, in order to mitigate the loss of metal for AI i will disable the strategic nuke launcher too cause its just pointlessness that the AI keeps shooting nukes at my protected airspace .... it takes so much precious metal that can be otherwise turned into units so i can have more cannon fodder for my turrets xD

anyways ... thanks for this detailed answer mate
+0 / -0


4 years ago
Just my 2c, but you might find that using Brutal AI and fighting bigger games with favourably uneven teams gives you your fix for lots of units to kill better.

Eg. you + 4x Brutal AI VS 4x Brutal AI

This way there is no pressure on you to perform for your team to cope, but the AI opponents will be fighting at full steam and using big armies aggressively.

Trying to configure the easy AI so it gives a better game seems a bit counter-intuitive (easy AI has intentionally bad configuration)

+2 / -0
4 years ago
hmmmm ... very true 1v0ry_k1ng ... it sure do seems counter-intuitive xD

thanks for the advice ... i will definitely try that out when i have a better grasp of the game units and mechanics.
+0 / -0
4 years ago
That wont work as your team will have a disatvantage
since ecomony is split equally your team's AIs will have 1/5 eco whist your opponent AIs will have 1/4 eco. so in order to win yo need to perform somehwere around the hard AI.

so for it to work it'll have to be:
You
Brutal AI
Brutal AI
Brutal AI
Brutal AI
VS
Easy AI
Hard AI
Brutal AI
Brutal AI
Brutal AI

Then porc away!
+0 / -0