Knightmaster

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.
Post Reply
Bergui
Forumer
Posts: 4
Joined: Tue Jan 04, 2022 3:06 am

Knightmaster

Post by Bergui »

Hi, here is a my AI.
It does knights and rams to back them up.

It is not good, but I try to improve it, correcting the DUC etc...

Here is an updated version. Still some major issues, I will fix it soon. I think it is good for me to make an update because I have already added a lot of new things.

Changelog v1 to v2 :

added DUC commands to send rallied knights to the closest villager/building of the ennemy
added DUC command to make the knights retreat from a Tc, to attack another entity
added DUC command to make them attack things when they are at in the ennemy town
added DUC boar hunting to prevent 2 boars being hunted at once
now build 1 house with 2 villagers at the beginning
now delays loom to get more production
now builds the first mill later to efficiently use the first villaghers on sheep, if there are sheeps
added DUC command to mill the closest group of deers, instead of possibly the ennemy one
send rams to fight
use escrow to buy imp upgrade
attempted to fix the broken BO(21 min castle time ??? should be 18:xx)
make the scout bring back sheeps when spotted
gold > 900 in castle : stop escrow
send IDLE knights to the fight


Fixes for later version :
-The villager-found token could be deleted, making the DUC commands at the beginning much lighter
-The rules to escape TCs and castles are not well working
-Still some second mill problems
-Ensure that the knight production is good
Attachments
Knightmasterv_2.rar
(11.6 KiB) Downloaded 196 times
Last edited by Bergui on Sun Jan 30, 2022 3:16 am, edited 1 time in total.

User avatar
halcyon88
Swami
Posts: 194
Joined: Mon Mar 16, 2015 2:43 pm
Location: UK

Re: Knightmaster

Post by halcyon88 »

I haven't tried it yet. But I look forward to it. Are you new to scripting, my friend?

I am! I am new to scripting.

My own AIs are also very simple.
A.K.A. TOAO_Philosopher (formely TOAO_ReLeNtLeSsS, TOAO_Leo, TOAO_Ayubu_, TOAO_FSpirit, _TOAO_HussY_ and TOAO__HussaR_ (even before that, Deadly_Hussar— and DEADLY POISON on AOKH back when I was REALLY young)).

Bergui
Forumer
Posts: 4
Joined: Tue Jan 04, 2022 3:06 am

Re: Knightmaster

Post by Bergui »

Hi ! I have been watching some tournaments since 2 years (davis cup). I have strated writing an AI then, stopped, started over some months after etc... So I know the scene a bit but I have not done much myself =)

User avatar
Promiskuitiv
Waheguru
Posts: 1364
Joined: Thu Nov 10, 2011 1:07 pm

Re: Knightmaster

Post by Promiskuitiv »

Welcome Bergui, glad to see your AI! :)

Feel free to join our community on discord as well if you'd like: AIscripters discord.

GamesGod
Swami
Posts: 114
Joined: Fri May 20, 2016 4:01 am
Location: Russia

Re: Knightmaster

Post by GamesGod »

Hi Bergui, good luck in your work :) I will definitely test your AI with my AI. Any AI that loses to my ai is a weakling :lol: and should be improved! :) And if someone wins, then you don't need to do anything, just wait for my AI to update and it will become stronger! :rofl
Developer of GamesGod AI

User avatar
offwo
Guru
Posts: 541
Joined: Mon Feb 21, 2011 9:31 am

Re: Knightmaster

Post by offwo »

I tested a few games with this AI. It's not the strongest AI but it does the basics well, has very few bugs and keeps a balanced economy. It's a lot better than my first AI was.

Some improvements you could consider:
-For a fast castle, you could research feudal a bit later. This means that you build up more resources while researching feudal (for every vill you delay you get an additional 40 resources). I'd suggest for a first AI you should research feudal if you have at least 30 villagers OR 650 food already stockpiled. Of course you have to balance this with how early you need your watch tower. Most flushing AIs will attack around 15-16 minutes.
-You can use up-assign-builders c: house c: 2 to assign 2 villagers to your first house (make sure to set it back to 1 later!). This way you don't have to research loom immediately. Your AI has around 30 seconds of idle time in dark age so by delaying loom until you lack the food for villagers you should be able to eliminate the majority of it.
-You could also tackle your idle time by using up-drop-resources after you have hunted your boar. Here's a simple example:

Code: Select all

(defrule
(food-amount < 50)
(unit-type-count-total villager > 9)
(current-age == dark-age)
(up-pending-objects c: villager < 1);A more sophisticated approach could use a 23 second timer from your villager production rule
=>
(up-drop-resources food c: 8)
)
-It would be better for your AI's strategy to fast castle with a stable and blacksmith, instead of a blacksmith and market, once you are confident in your economy, even if it results in a slightly later castle age time.
-Bow saw and wheelbarrow are generally more important researches than heavy plow, so get them first.
-Rather than just attack when you have 7 knights, you should compare your military numbers to your enemy's using (players-military-population my-player-number/any-enemy etc. Since your AI makes strong but very expensive units, you can attack if you have around the same numbers or greater.
-Against archer heavy armies it is worth stopping to train knights in order to research chain barding.
those hackers are just idiots, i spit on them :lol: - Mabuse

Bergui
Forumer
Posts: 4
Joined: Tue Jan 04, 2022 3:06 am

Re: Knightmaster

Post by Bergui »

Hi, thank you all for you messages and advices =)

Promi, I am already on the discord with the same username. I have lost the AI scripter title like 1 week ago tho, because of inactivity I guess.

Offwoo, thank you a lot for the advices. I will try to include this in the script :) . You are right about the feudal age research, it should solve a lot of things (more wood available at the feudal age to build barracks+stable instead of a market...).
Considering loom, yes i guess i can delay it until I lack food or 1 villager before hunting the boar, it will increase my ressource income.

See you later for some update :D

Rorrik
Forumer
Posts: 36
Joined: Fri Jul 24, 2020 10:11 am

Re: Knightmaster

Post by Rorrik »

offwo200 wrote:
Tue Jan 18, 2022 5:11 pm
-Rather than just attack when you have 7 knights, you should compare your military numbers to your enemy's using (players-military-population my-player-number/any-enemy etc. Since your AI makes strong but very expensive units, you can attack if you have around the same numbers or greater.
I like your current attack method. Your AI attacks when it knows it has its best chance, early castle when it has its power spike. Otherwise you'd just be trying to beat other AIs at their own game: booming up and getting all the upgrades and the biggest army and finally engaging with a slow push late in the game. This is something different from the current meta and its refreshing, and I think it can work if done well.

User avatar
FireBall37
Swami
Posts: 176
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

Re: Knightmaster

Post by FireBall37 »

I like your approach of getting chain barding early. KnightMaster is impressively resilient for being so new! Look forward to seeing him play in the future :devil
author of the Shadow AI and Snippets

Post Reply