mini_cpu

Upload your latest creations here.
Please note that by posting comments to posts in this forum you forfeit your personal copyright on whatever you post. AI Scripters reserves the right to re-use objective comments in script reviews without requiring the posting author's permission. Credit, where appropriate will be given in such cases.
x1091
Forumer
Posts: 7
Joined: Sat Mar 23, 2024 9:34 am

mini_cpu

Post by x1091 »

* mini-AI, meaning it has few lines of code (compared to what it can do)
* no cheats or cc- commands whatsoever
* resigns on migration-style maps
* strategy is civ-specific & also strength (because it takes a lot of time to test 50 civs!)
* responds to taunts 3,4,5,6,31,38,42,43,44,45,55,61-68,222
* plays diplo: - enemies "submit" when tc/fortifications/military is gone as long as no vills have been killed ; may betray the player (random)
- if you pay the first tribute to ally => you must always pay it or prepare to fight
- high score neutrals turn to enemy

Inspired by other mini-ai's like Arabian Knight, MiniEagle, Mininati etc.

Settings:
; Victory: Standard(Conquest)
; Map Type: Not Migration
; Civilization: Any
; Population: Any (tested on 200)
; Resources: Standard
; Starting Age: Dark Age
; Difficulty: Any (custom difficulty scaling based on pop cap)
; Teams locked: either (has some diplo)

v72 - nomad bug fixed ; shrivamsha ; retreating ; pocket scouts / flank archers ; goths/cumans now wall at perimeter 1 ; locks the gates
v98 - updated for build v.141935 (10 April 2025)
v203 - fixed - no longer crashes ; beginning of diplo scripting ; many changes
v257 - plays diplo
v270 - now plays water maps

; armenians - walls => warrior-priests
; aztec - monks / jags vs teutons
; bengalis - monks + siege-eleph / ratha vs teutons
; berbers - knights + genitours
; bohemians - hussite-wagon rush
; briton - archers/longbows
; bulgarians - drush => scouts => fwd. krepost + konniks
; burgundians - scouts => castle age cavaliers
; burmese - scouts into knights
; byzantine - camels + skirms
; celtic - towers + m@a + skirms + knights + siege
; chinese - chu-ko-nu + fire-lancers
; cumans - cav-archers
; dravidians - m@a ; skirms ; archers ; urumi
; ethiopian - xbows + mangonels
; frankish - scouts => knights
; gothic - swords
; gurjaras - archers + camels/shrivamsha
; georgians - knights => monaspas
; hun - endless scout rush => tarkans
; incan - eagles => kamayuks + slingers
; indian/hindustanis - ghulam + siege-eleph
; italian - scouts/knights/genoese-xbows
; japanese - drush => archers => samurai
; jurchens - steppe-lancers
; khitans - steppe-lancers
; khmer - knights
; korean - spear + skirm => fire-lancers + skirms + rocket-cart
; lithuanians - knights
; magyar - endless scout rush => magyar-hussar
; malay - knights
; malian - swords + scouts ; fwd. tc
; mayan - eagles + archers
; mongol - cav-archers
; persian - knights
; poles - knights
; portuguese - knights + mangonels + cav-archers
; romans - scorpion rush
; saracen - cav-archers + mamelukes
; shu - xbows
; sicilians - serjeant/donjon rush
; slavic - knights/boyars
; spanish - missionaries + forward
; tatars - cav-archers + scouts
; teutonic - fwd.towers + m@a => fwd.castle + teutonic.K.
; turkish - janissaries
; vietnamese - battle-eleph
; viking - archers => berserkers
; wei - forward + tiger cav
; wu - jian swordsman
Attachments
v72, v98, v203, v257.zip
(68.38 KiB) Downloaded 1 time
mini_cpu_v270.zip
(19.64 KiB) Downloaded 1 time
Last edited by x1091 on Mon Jul 14, 2025 9:12 am, edited 7 times in total.
SuperSkurken
Forumer
Posts: 16
Joined: Thu May 02, 2024 11:29 am

Re: mini_cpu

Post by SuperSkurken »

I am looking forward to testing it out. Is it a Fast Castle approach? No Feudal army?
Rorrik
Forumer
Posts: 47
Joined: Fri Jul 24, 2020 10:11 am

Re: mini_cpu

Post by Rorrik »

x1091 wrote: Sun Jan 26, 2025 5:51 am ; Bugs out on Nomad - builds a tc, then hunts and builds farms but all villagers go to wood and nobody cares about the farms. Help please?
Your #load-if-defined NOMAD-MAP would only fire on the built-in nomad map, however, custom maps should get caught in the (defconst foodworkers 80) case anyway, so this seems unlikely.

Try printing out foodworkers somewhere to make sure it is getting set to something. In dark age, you are multiplying the gold and stone by 0, so if the foodworkers is somehow 0 or (more likely) -1, then wood would be 100%.

Another possibility is that your distribution rule somehow bugs out and can't run due to trying to research ballistics and chemistry, but it seems odd that that wouldn't also cause a problem on other maps.

Your distribution rule also includes this fact:
(or (current-age-time == 5)
(building-type-count-total town-center == 0))

This looks to me like on any map this rule will only fire once per age, which makes sense. But on Nomad, it should fire right away (no TC) and fire every pass until the TC foundation is placed. Then it may fire again 5 seconds into the game. I don't see any reason that that would cause a problem, since you always set before modifying (good job).

Something odd is happening, but you chatting out foodworkers and the gatherer SNs should shed some light. I can't actually run it right now, but I might be able to tinker some tonight.
User avatar
Gequi
Forumer
Posts: 20
Joined: Wed May 21, 2025 6:53 am
Location: Spain
Contact:

Re: mini_cpu

Post by Gequi »

Hey this is a great AI. I was looking some AI able to play at isle maps because last patches have broken official/default AIs, so they don't use transport boats to move terrain units from original island to enemy islands. Also most of the AI mods from the community are broken. Reported here

https://steamcommunity.com/app/813780/d ... 6592895380


I tested this AI with this settings
x1091 wrote: Sun Jan 26, 2025 5:51 am ; Map Size: Any
; Victory: Standard
; Population: Any
; Difficulty: Any (custom difficulty scaling)
; Teams Locked: Either (minimal diplo)
; Resources: Standard
; Starting Age: Dark Age
; All Techs: No
2 VS 2 on Team Isle Map: Dravidic (blue) & Inca (red) VS Franks (green) & Sicillians (yellow)
https://drive.google.com/file/d/150KQfn ... sp=sharing
(I try to save chapters so you can jump between them inside the recording)

The most important event is around minute 59: Franks (green) put 2 rams on a transport boat. The rest only have a few terrain units without war machines, some of their transport boats are even empty. Sometimes their transport boats can't reach other islands, because they travel far distances receibing attacks instead of crossing the free and short zones.


2 VS 2 on Team Isle Map
https://drive.google.com/file/d/13wbMCZ ... sp=sharing
(I try to save chapters so you can jump between them inside the recording)

Simillar to the previous one, but also they send fisher boats too far from their docks.



1 VS 1 on Isle Map
https://drive.google.com/file/d/1S_rnwi ... sp=sharing
(I try to save chapters so you can jump between them inside the recording)

Simillar to the previous one, but also they send fisher boats too far from their docks.


Teutonic (cyan) VS Turks (red) VS Huns (yellow) on Coast Map
https://drive.google.com/file/d/15JPDSo ... sp=sharing
(I try to save chapters so you can jump between them inside the recording)
  • They build miner and wood camps too far from gold/stone/forest.
  • No one gather relics, they even do not build monasterys nor monks.
  • They build walls in a absurd way, wasting stone in zones where the walls are not useful. I understand this is a hard thing to program with AIs.
  • When Turks (red) are about to eliminate Teutonics (cyan), instead of finishing the task, they retreat and attack Huns (yellow). Later when they are about to defeat them, Turks (red) retreat again to attack Teutonic (cyan) until they finish them. Some of the Turks (red) go to attack the Huns (yellow) but others keep attacking the already dead Teutonic (cyan)
Cheers!
x1091
Forumer
Posts: 7
Joined: Sat Mar 23, 2024 9:34 am

Re: mini_cpu

Post by x1091 »

I know the AI has many problems.
I am in the process of completely rewriting the AI but i am getting crashes and i don't know if it is because of the code(AI) or the game itself.
I am waiting for another update/patch to see if the issue is fixed.
Perhaps i will create another topic since the new AI has most of its code rewritten.
User avatar
Gequi
Forumer
Posts: 20
Joined: Wed May 21, 2025 6:53 am
Location: Spain
Contact:

Re: mini_cpu

Post by Gequi »

x1091 wrote: Sun May 25, 2025 4:44 am I am in the process of completely rewriting the AI but i am getting crashes and i don't know if it is because of the code(AI) or the game itself.
I am waiting for another update/patch to see if the issue is fixed.
What kind of crashes? are they like those we reported on Steam?
Last patches truly changed something because even default AIs are broken.
x1091
Forumer
Posts: 7
Joined: Sat Mar 23, 2024 9:34 am

Re: mini_cpu

Post by x1091 »

When testing the new unreleased AI the game crashes to desktop about the time the AI reaches feudal age.
This happens every single time.
Perhaps there is some line of code that causes this but after working so many hours on the AI i just ... took a break.

miniCPU v119 - updated miniCPU
miniCPU v164 - completely rewritten code
Attachments
mini_cpu_v119.zip
(17.82 KiB) Downloaded 327 times
mini_cpu_v164.zip
(10.15 KiB) Downloaded 281 times
User avatar
Leif Ericson
Waheguru
Posts: 1460
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: mini_cpu

Post by Leif Ericson »

I did a quick check, and you have a few cases where you use unit lines with up-train-site-ready. Unfortunately, this causes a crash. You have to use the base unit instead, such as spearman instead of spearman-line.
x1091
Forumer
Posts: 7
Joined: Sat Mar 23, 2024 9:34 am

Re: mini_cpu

Post by x1091 »

Leif Ericson wrote: Sun May 25, 2025 8:56 am I did a quick check, and you have a few cases where you use unit lines with up-train-site-ready. Unfortunately, this causes a crash. You have to use the base unit instead, such as spearman instead of spearman-line.
I see. Thanks. I will fix and retest.
x1091
Forumer
Posts: 7
Joined: Sat Mar 23, 2024 9:34 am

Re: mini_cpu

Post by x1091 »

up-player-distance seem bugged or is it just me?
Does it actually check distance between buildings or closest building to any unit?
Post Reply