Subotai 0.9

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.
User avatar
jdstankosky
Guru
Posts: 908
Joined: Thu Nov 25, 2010 12:30 pm
Location: Florida, USA
Contact:

Re: Subotai 0.1

Post by jdstankosky »

This sounds like a good idea to pursue. :D

There are no stupid scripts. Ever hear of the AI called Chicken? :rofl

There are many simple scripts, and many complex scripts. They all perform very well under their preferred conditions. From scripts as simple as less than 50 rules, to scripts who push the boundaries of rule limits. With UP, there are even scripts who have 500 goals! :blink: Platea and Hell-Raven being amongst the most ambitious scripting projects that I know about.

I think that if you have a clear vision and understanding of the system you intend to develop, please do so! Perhaps you will stumble upon something that will make even the most seasoned scripters go :blink:
Do not try to script a counter for everything. That is reactionary, and always slower than taking the initiative in battle. Decide from the start what you are going to do, and do not waiver from it. Own it.

User avatar
Mandulis
Forumer
Posts: 28
Joined: Sat Mar 31, 2012 9:41 am
Location: at home

Re: Subotai 0.1

Post by Mandulis »

I'll give my best. :)
I'm currently thinking to even shorten the research rules. I could divide the all research into two priorities. Important stuff are wheelbarrow and hand cart, unit upgrades and stuff from the blacksmith. Everything else is secondary.
Wheelbarrow and handcart are researched as soon as possible. All the unit upgrades and blacksmith stuff gets three conditions, just like the unit training rules:
- the related unit is our main unit (research fletching or heavy cavalry archers if we are mainly using them)
- a threat is imminent (upgrade pikemen if need to repel cavalry)
- special condition (maybe our strategy needs a specific research at a certain point)

Secondary research is done under other conditions or just whenever possible. Via a defconst for resource control I can toggle the spending behaviour so I can forbid all research or just secondary stuff.

I am not sure yet if this works, but I will test it. If it works I can pull the research out of the individual strategy scripts into the main script and keep them simple. The decision making doesn't even have to be much more extensive to get it working, I think.

Building on the other side, I think, can not be streamlined that way.

User avatar
Mandulis
Forumer
Posts: 28
Joined: Sat Mar 31, 2012 9:41 am
Location: at home

Re: Subotai 0.1

Post by Mandulis »

Alright, version 0.3 is up. The script is far from done, but the basic structure is working. I managed to have a clear separation of basic stuff and strategy related stuff. If you are interested in what I did, just take a look at the training and research section in the Subotai.per and look for ri-loom in the strategy-Defaut.per. That should make the principle clear.

I still have to add some more research stuff and finally implement a real strategy. I documented a lot of the script and tried to keep it simple but if you have any questions (or criticism), point it right at me. B)

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Subotai 0.3

Post by Campeador »

This AI is really interesting and with potential. A clear strategy and with the capacity to change it if needed. It's only a thing to complete (a short work) and optimize it (an unfinishable work).

Things to improve:
- Too few idle farms in feudal and later ages. Humans can build two or more buildings of the same type at once, AIs only can do it with the UP. It's the reason because AIs have got a limited practical number of farms, they exhaust them too soon the build the Xth farm. So they often try to build a few moer than needed to compensate it.
- Militias are an obsolete unit in the castle age. Even pikes defeat them. Don't use them without the m@a upgrade, and even then they should be limited without the LSM upgrade.

User avatar
Mandulis
Forumer
Posts: 28
Joined: Sat Mar 31, 2012 9:41 am
Location: at home

Re: Subotai 0.3

Post by Mandulis »

Thanks for the advice. I'll change the famr stuff. The militia stuff will come alter as the main strategy stills needs to be done. I basically only finished the tools, so to say. I kind of underestimated some requirements to use such a rule system but I am slowly getting. I'll comment the code as I enhance it.

User avatar
Mandulis
Forumer
Posts: 28
Joined: Sat Mar 31, 2012 9:41 am
Location: at home

Re: Subotai 0.4

Post by Mandulis »

Subotai 0.4 has been released.

The script now basically works. The AI has its own (yet crappy) strategy which it pursues. It will also counter threats to a certain degree. I learned quite a lot about the scripting with the last structural changes. Especially the order in which the rules are read was not really important to me before. An error in the default strategy which caused the AI to research stuff at the wrong time taught me otherwise. I was also able to get a better grasp of my decision making. All strategy changing will be in two steps (changing your strategy more than twice seems not good). First will be the analysis of the enemy in the dark and feudal age. This will set my basic strategy and load the apropriate script. In this strategy script I will add a few rules to detect the counter-strategy to my own. My thoughts were, that a knight rush does not really care about loads of archers. So this can be handled by the standard archer-threat (which builds skirmishers). But if the knight rush faces a strong aztec mush it is basically screwed, even if it is done well. Switching the strategy once at this point could be crucial.

Hopefully this works out as intended. B)

Now it is time to clean up the code, fill in some missing things and them comes the great optimisation. Hurrah!

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

Re: Subotai 0.4

Post by Promiskuitiv »

I tested (my AI (Promi)) versus your AI on 1.0c, but i mainly watched my AI as i was just making sure that i fixed every bug in my AI. :P

At 30 minutes your AI was still in the feudal age and attacked me with a huge feudal army. The thing is that Promi was in the castle-age for a long time already and trained almost as many soldiers as yours while taking important castle-age upgrades.
So you should either attack earlier or delay your attack until you've got some important castle-age researches done.

But else (before that) it wasn't too bad. :)
Creator of Promi.
Feedback is greatly appreciated.

User avatar
Mandulis
Forumer
Posts: 28
Joined: Sat Mar 31, 2012 9:41 am
Location: at home

Re: Subotai 0.4

Post by Mandulis »

Yep, I am aware of that problem. The whole strategy is not really done or optimized yet. But I now know how get the behaviour I want from the structure I have the decision making sorted out. Did you recognize if Subotai was actually building the right units to counter yours (even if unupgraded) ?

User avatar
Mandulis
Forumer
Posts: 28
Joined: Sat Mar 31, 2012 9:41 am
Location: at home

Re: Subotai 0.4

Post by Mandulis »

I just had an idea today during lecture how to increase the potential of my ai to analyze its success. The strategy script can evaluate the enemies goal and its current situation. If the enemy is doing stuff I can handle or which require just minor changes then I can keep the current strategy. If I discover the enemy is using something that makes my strategy completely obsolete (I wanted to use knights and see a fast mush coming, then I should change as more knights won't help me winning) I can change the whole strategy and use another one better suited to the task. So far so good. But these two mechanism require something I cannot guarantee(at least at the moment): executing my strategies extremely well.

I am just beginning to write the strategies and I am not the most experienced player, so even if the right strategy was chosen it can be executed not good enough. This can require a strategy change. Even if the strategy is executed it can fail. To register that I was thinking of a attack-evaluation system. Most strategies seem to work like this:
Get to a specific age and build a specific unit and hit the opponent in such a way that he is weakened or destroyed. So maybe one can launch an evaluation attack; for example your plan was to rush very early with knights, then your first wave would be the evaluation attack. This attack triggers an evaluation timer. When the timer is up you evaluate your situation. Are you still military superior? Do you have more villagers than your enemy now? Did he produce a lot of new units despite the attack? With these questions we can probably evaluate if the attack was a success. If it was a success we can keep going. If it was a failure we maybe need to make some small adjustments to our strategy. If it fails big time we need to use another strategy (we attack with 10 knights and after 2 minutes attack-evaluation time we have only 3 knights left, no superiority and our enemy suddenly has 7 knights and many monks, probably that went wrong).

The definition of failure needs to be set for each strategy. Probably sending an evaluation attack at every age-up, beginning with the first real attack, might get some clear results.

What do you guys think?

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Subotai 0.4

Post by Campeador »

Goose have got something similar. A code to determine if its military superiority has been increased or decreased since a x time ago. Perhaps you could combine it with your detection threats. For example, if you see too many monks for your knights you could forget your krush even before it's failing, you needn't to wait to send these future traitors to enemy's base to know that light cavalry becomes better in this case.

A thing that you could do is prepare first an strategy but designing the code to be easy to add more strategies with no effort. For example, my first versions always made the same flush but I only needed to add a new goal to prepare different flushes for every civ, and even randomly chosen flushes in my last versions.

Post Reply