I'm looking for a more agressive AI for armada 1 the ai in the mod i've got SUCKS i need an AI where the enemies and my allies will build a little more and come at me more agressively the last two mods i've had the fedaration and klingons just sit there building constructions ships and do nothing after that i'm after something with a little more teeth
I'm pretty sure the AI would have to be written around a specific mod, like if you add a ship you would add to the AI so I don't think there could be a universal one. I could be wrong though.
You're right, Intrepid --and writing AI is some of the hardest stuff to do. Not in terms of coding, but in terms of how you get the computer to do what you want as an opponent. It's really challenging to master. I know I'm still having trouble doing it as well as Freyr does it. But then, nobody does it better.
you are right Intrepid, that would be true for mods with extra ships but in this mod the standard ships have just been revamped the only race with new ships are the federation and i play as them myself i'm gonna try copying in the ai from the original version of Armada that i still have on file, i'll see if that changes anything and if not i'll just up the difficulty level of the computer characters in the instant action matches
You know that Starbase 34 has a really good section on AI ? http://www.starbase34.net/ I think its called AI and you...Its written by Freyr, if memory serves me correctly - and it does clear up some of the mess created by the AI section in the BBOM...
The Kid wrote that, not me. He's done far better at the nuts and bolts of writing a functional AIP than I could do. You can tell who's the professional tutor!
My contribution to the communities knowledge simply documents a few things I thought worthy of mention and passes along a few of my random thoughts about programming AI's to be a bit more dangerous.
Freyr's random thoughts on AI's.
Artificial Intelligence is a somewhat misleading name. There is really no such thing, all we are trying to do is apply very artificial rules to create the appearance of intelligence. Its pretty much impossible to prevent the AI from doing something stupid, but you don't need to worry about it to much. Humans do stupid things all the time. Trust me on that, I work in IT for a living. :)
Anyway, our aim is to create something that plays in a way that at least looks skillful and at the moment most of the other AI guides are aimed solely at making the AI build stuff. I used to play online in A2, and I probably appreciate more than most people that while having powerful units is good, they are only as good as your use of them.
The AI cannot do tactical combat to save its life. If a human rushes you with anything in the early part of the game he's going to avoid entering the starbases line of fire because the starbase can kill a cruiser or destroyer with a single hit. Therefore, he's going to prey on mining stations and anything that is not defended to a large enough degree to stop his ships.
In the same situation the AI will just make a beeline for the starbase and get all of its ships blown up. This is because it's ships are just on maximum movement and weapons autonomy for it's tactical AI and the AI strategic AI just sends the ships to where it's lost the most ships. (seriously!)
When this happens, the player will just build a large line of defenses and hide behind it and watch as the AI attempts to play lemmings with its starships. Meanwhile, the player is building up a single fleet big enough to blow up whatever defenses you told the AI to build. Afterwards that player will toast his own ingenuity for beating your AI with his masterful plan.
This is bad. No AI should be so stupid as so keep walking ships into a death trap unless its going to at least kill most of the death trap doing it, therefore while the other tutorials tell you how to build things they aren't giving you the full picture on AI's. Fortunately there are a few things that you can do to make the AI a little less moronic which I will attempt to pass along to you below.
This is my AI from Mission 6 of The Upgrade Projects Vanilla Ultimate release. Grab yourself a copy of Vanilla Ultimate and give it a play, and feel free to pick apart and copy any of my AI's as long as you let other people do the same with yours. Fair's fair.
Right, picking apart an AI in a million easy steps. I have removed some of the text the devs left in documenting some of this stuff but its still in the files I released.
-- // // a2_fed06.aip // Version II // Last edited by Freyr, 20th July 2008 // --
First things first, versioning. Professional IT 101, BACKUPS!!! Take a copy of a file when you make changes to it so you can replace it if it stops working and make sure you keep either a file version or a last edited date. If yous using dates then don't list it as DD/MM/YY or MM/DD/YY because if you don't then your going to confuse a significant portion of the planet.
This is because the inhabitants of a certain country on the North American continent write the date MM/DD/YY, unlike nearly every other country on the planet who uses DD/MM/YY. This causes incredible confusion, even if your team is all in the same continent and you have agreed which date standard your using because nobody else knows after you have finished, making the versioning information virtually useless. The best and easiest way around this mess is to just write day month year in full because its completely unambigious.
-- // Load up the basic structures... #include "aipdef.h"
int MAX_EXEC_ATTACK_BASE = 1; int MAX_EXEC_ATTACK = 1; int MAX_EXEC_DEFEND = 20; int MAX_EXEC_ESCORT = 1; int MAX_EXEC_EXPLORE = 1; int MAX_EXEC_RESOURCE = 4; --
After the include you can see the AI's goals. Basically put, setting attack base to "1" means the AI deliberately attacks the largest human base *THAT IT CAN SEE* even if it can see a separate defenseless base filled with mining operations and superweapons that it could kill without a loss. Setting it as "2" means it attacks the two biggest bases it can see.
Remember though, you don't want your AI to be unbeatable. When doing the Single Player Campaign I had a struggle to make the AI strong enough to be a challenge, but weak enough that it wouldn't prevent the player from being able to complete the mission. As a guide; people want a long struggle before winning against an AI. Losing every time really sucks and nobody would want to play with your AI. Make sure you sabotage your AI somehow to make it has at least an even chance of losing if it plays reasonably well. (Mine do!)
-- // NOTE: DO NOT change MAX_EVAL_ values. int MAX_EVAL_ATTACK_BASE = 10; int MAX_EVAL_ATTACK = 10; int MAX_EVAL_DEFEND = 30; int MAX_EVAL_ESCORT = 10; int MAX_EVAL_EXPLORE = 10; int MAX_EVAL_RESOURCE = 10; --
Well, it says DO NOT change them. I never did. If you decide to play around with them and figure it out please let us know!
-- // PRIORITIES OF DIFFERENT GOALS & FACTORS int attack_troops_priority = 1000; int attack_region_priority = 1000; int defend_priority = 100000; int attack_enemy_base_priority = 1000; int exploration_priority = 120000; int explorationFailurePenalty = 50000; int scripted_priority = 1; int perimeter_priority = 1000; int resource_priority = 100000; int escort_priority = 3000; --
The priority of doing different things, you can move the numbers around to get the AI to attack at the expense of defending etc. I don't tend to alter these that much as you can force matters with the fleet system.
-- // TROOP COMMITMENT PARAMETERS double min_matching_force_ratio = 1.0;
// Use the fleet AI system double fleetAIRatio = 0.8; --
I like these two settings. The force matching ratio is fairly self explanatory. The AI adds up the strengths of its ships conventional weapons and shields and yours and decides if it should attack. As I mentioned before the AI is horrible at combat. You can compensate for this with more ships or by accurately setting the worth of ships in the ODF files.
Points worth noting. It might seem like a good idea to set this to 2.0 to make the AI turn up with a fleet twice the size of the oppositions. However, it has to build it first before it can use it (an obvious point, but worth mentioning), and the pesky humans might build faster than the AI. If it did then it wouldn't be able to attack at all, ever.
That would be a bad thing. However, just as bad is the AI attacking with that fleet if it could built it. It would just finish the mission with a huge tidal wave of firepower and the human wouldn't enjoy it. Your not trying to make the AI impossible to beat, your trying to make it very difficult to beat.
My method of doing this has been to get the AI to keep attacking with waves that are costly to repel as opposed to the stock behavior of sending ships one at a time in a line. This way the human is put under a lot of pressure and either gets worn under as the AI progresses up its build list or it manages to kill the AI off after a reasonable struggle, after which the player gets a real sense of achievement.
Precisely what the fleet AI system does I don't know, but it seems to make the AI slightly more intelligent about not splitting its fleets up in the middle of a battle.
-- // NOTE: Positive to avoid places where we have lost more units than we have // killed (not currently computed) int avoid_danger_priority_modifier = 100; --
Well, this claims to be not used and judging by the lemming like behaviour of the AI i'd agree. However, if its not doing anything its not doing any harm staying in the code. :)
-- int min_escort_force = 1; int max_escort_force = 1; int min_perimeter_force = 8; int max_perimeter_force = 8; int max_defense_force = 32; int min_defense_force = 16; int min_exploration_force = 1; int max_exploration_force = 1; int min_attack_force = 8; int max_attack_force = 16; --
The second best part of an AI! The minimum and maximum number of ships that can be used for a certain task, like attacking for example.
Left to its own devices the AI will more or less wander in with a long line of ships towards its opponent. If you force the AI to use fleets of a certain size it has a far easier time overcoming obstacles, like opposing fleets and bases because instead of wandering in one by one they will come in as a single group.
Remember that setting a minimum fleet of 8 ships can be a minimum of 8 scouts or 8 tactical fusion cubes! The AI will mix whatever it has available, however YOU control what it builds with the build list. If you want the AI to attack with a fleet of assimilators early in the game and then attack with a smaller fleet of cubes later on you can work around the engine limitations by adding in a few scouts to be built at the same time as the cubes.
However, this said that becomes a lot more difficult if you set it to a high (minimum) number, like 32. Most humans are going to notice 31 scouts accompanying a fusion cube, so you need to be reasonably intelligent with how you do this.
Also remember that you can cause the AI to get stuck by setting a high force matching level and a low fleet level. The AI is able to put the fleet together, but unable to attack becase the force matching code tells it not to attack because its not got a chance of beating the enemy.
On Build lists:-
There is already quite a lot of information available for build lists including at least three tutorials giving the technical information required to create a functional AIP, however I thought i'd add my couple of words to what everybody else has written.
I'm assuming you already know how to write an AI. I suspect what your trying to do is write an AI that can stand at least some chance of winning a battle against a human AI without cheating. AI's usually cheat, simple as. Most Armada II AI's including the stock AI, and most of the modded ones are cheating like mad, my ones are more or less the only ones that don't cheat at the time i'm writing this.
In my opinion, the only thing the AI is really good at strategically is making a beeline for where its losing the most ships. Tactically, I think that its only capable of doing anything useful by smashing through defenses with a capital ship phalanx.
Now, if you agree with those two points then you'll probably see where i'm coming from when I say that I think its pointless building the AI anything other than battleships. (unless its a ship with a decent special weapon, like the assimilator that the AI simply can't get wrong) I might be wrong and someone might eventually manage to build on this with a AI that can trounce me with destroyers, however I doubt its ever going to happen. Therefore, you should support the AI by giving it ships it can actually use. Therefore, progress to Battleships as quickly as is humanly possible.
On build list Tech Levels:-
In theory, you could write a killer AI using tech levels (the forth column in most AI's) Tech levels allow you to have fantastic complexity but I don't think its of any practical use. This is simply because I can't think of anything worse than deliberately writing an AI with the intention of getting it stuck in a loop where it will have trouble progressing up it's build list. Every AIP I have written has been written precisely to AVOID getting the AI stuck in a loop. My advice? Keep It Simple, Stupid. Don't do something complicated unless there is a actual requirement to do it that way, could it be done more simply in a way less likely to go wrong?
What you want is a list that the AI can run up as quickly as possible, escalating your AI to the most powerful warships as quickly as is humanly possible. If you've got a copy of my Fed06 AI take a look at how it works.
The AI will not rebuild a line once its destroyed unless its a technological requirement for a ship, or a shipyard. When the human kills a standard cube then its not being replaced, the AI is slowly working up its tech tree and building diamonds, upgrades for its ships and Tactical Cubes. Losing ships is not making my AI get stuck in a loop thanks, its progressing up until the poor little human gets worn down under a relentless swarm of fleets demonstrating that resistance really is futile. THAT is how you do it.
On the rebuild option (the 3rd column in the way better build list)
You should *NOT* build a line that is to be repeated an infinite number of times, otherwise the AI will keep rebuilding that line. Ok, obvious point. What that means to you, is that the AI is stuck rebuilding that destroyer that you kill in the first couple of minutes. You've just created another loop in your AI created by a semi competent player. Against that semi good player your AI is going to be stuck building and rebuilding that destroyer, which is going to get swatted away by the player which is going to force the AI to rebuilt it again instead of building it's advanced yard and then building battleships. That's bad. Worse is seeing a cocky player declaring that he's the best strategist ever because he took a badly designed AI. Good is when you mention it and your beta testers feel fear. Fear of certain death. When my beta testers got scared at the mention of my AI, I knew it was ready. You see, decent AI's don't get released, they escape after killing the beta testers. :)
Well, I have no idea if any of the above was actually any help in getting you to write a decent Artificial Intelligence Personality. Hopefully my ramblings passed along a couple of useful bits of information and meant that you started off programming AIP's at a higher starting level than I did.