More aggression -1 reply

Please wait...

Guest

I didn't make it!

0 XP

 
#1 9 years ago

I'm trying to find a way to make the enemies more aggressive in play. If anyone who knows how i'd appreciate it if they'd let me know.




SciFiFan

There's not enough SciFi.

50 XP

19th February 2009

0 Uploads

171 Posts

0 Threads

#2 9 years ago
darkchylde2004;4892198I'm trying to find a way to make the enemies more aggressive in play. If anyone who knows how i'd appreciate it if they'd let me know.

One way that I know of is to go into the odf files and increase the intrinsic value of the ships. This is what makes your ships appealing to your enemies. I am sure there is an easier way that doesn't require so much tinkering. I am still fairly new at modding so, just giving my input. :)




São Magnífico

Modern-day warrior

50 XP

2nd April 2009

0 Uploads

294 Posts

0 Threads

#3 9 years ago

Freyr is the resident AI wizard here. I keep thinking he should make an AI tutorial so we can all have badass computer players.




Freyr VIP Member

A2Files Staff

46,875 XP

5th February 2005

11 Uploads

4,275 Posts

0 Threads

#4 9 years ago

You can do this a number of ways.

The most obvious ones are making the AI cheat, so it builds faster and gets ships cheaper, but personally I don't like doing this. In my opinion, the best way is to rewritie the AI through the AIP files so it builds a greater number of shipyards etc which in turn lets it build more ships without cheating.

Try the Campaign on Vanilla Ultimate on Merciless to see what I mean. I still get killed off by that AI, and I programmed it!

Freyr is the resident AI wizard here. I keep thinking he should make an AI tutorial so we can all have badass computer players.

Like this? (yeah, I know its not finished. I'll finish it off when I get a spare minute.* )

Spoiler: Show

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 inteligence.

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 soley at making the AI build stuff. I used to play online in A2, and I probably appreciate more than most people that having powerful units is good, however 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.

When this happens, the player will just build a large line of defences and hide behind it and watch as the AI attempts to play lemmings with starships while building up a force big enough to blow up whatever defences 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 WHAT to build 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. Basicially put, setting attack base to 1 means the AI deliberately attacks the largest human base even if it can see a seperate defenseless base filled with mining operations and superweapons that it could kill without a loss.

Remember though, you don't want your AI to be unbeatable. Its stupidly easy to create an undefeatable AI, however 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 its easier to do elseware.

-- // 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. 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 acheivement.

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 becuase 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.

*That's a somewhat more fluid target than "Done when it's done!", and probably means its going to be a long time, especially when I keep single handedly taking up tasks like converting the BBOM to a wiki because while everybody else wants the end result nobody else is willing to actually help converting it.




São Magnífico

Modern-day warrior

50 XP

2nd April 2009

0 Uploads

294 Posts

0 Threads

#5 9 years ago

Hey Freyr, if you have a wiki set up and you need the BBOM converted into wiki pages, I'd be happy to help out. I don't know much about setting up websites (even wikis) but I have some experience editing and expanding wikis.

Oh, and thanks :)




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#6 9 years ago

Freyr, about the int_min/max_******_force, you say this is the min and max # of ships the AI will do something with? In my modded A2 for instance, the int_min_attack_force is set to 24 for a race. So they should have 24 ships before they attack? I've had plenty of times where they attack me with less than 8 or whatever # less than 24 so I wonder if these codes are really set in stone and followed to the letter?




Freyr VIP Member

A2Files Staff

46,875 XP

5th February 2005

11 Uploads

4,275 Posts

0 Threads

#7 9 years ago

To be honest, I don't know. From my experience the AI has stuck to exactly the numbers I have set, but i've only been using comparatively small numbers. (the minimum I have used is usually 4 or 8 to a maximum of 16 to 24, which they have followed)

It could well be that the AI is doing using the perimeter force to attack with if its using a somewhat flexible definition of where its base is. Try removing the perimeter force and see if it still does it. After that, i'd look at changing the force matching ratio's to see if the AI can ignore the minimum fleet sizes if its got enough firepower.




Warborg

Revenge was here.

50 XP

2nd August 2002

0 Uploads

1,833 Posts

0 Threads

#8 9 years ago

I don't know what I did years ago on a Borg Mod but I made the AI so hard it wiped me out in under 20minutes... I only had built 1 Akira ship at that time and the AI was already sending about a dozen cubes




FallenGraces

To Each His Own

50 XP

18th October 2008

0 Uploads

422 Posts

0 Threads

#9 9 years ago
Freyr;4892394 *That's a somewhat more fluid target than "Done when it's done!", and probably means its going to be a long time, especially when I keep single handedly taking up tasks like converting the BBOM to a wiki because while everybody else wants the end result nobody else is willing to actually help converting it.

hey i tried earlier but the comp i was using is insanly slow and the "new one" :uhm: im using right now needs an overhaul and i ain't got the cash to do it currently...running 98 so i cant us FO :bawl::bawl:. and the BBOM is just to massive for this thing. though id be willing to help if its really needed




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#10 9 years ago

This is what I have for the cardassian build list in my AIP file:

int attack_troops_priority = 1800; int defend_priority = 1500; int attack_enemy_base_priority = 2700; int intrinsic_value_bonus = 5700; int exploration_priority = 380; int escort_priority = 950; int resource_priority = 3700;

double distance_from_goal_match_modifier = -0.01; double max_matching_force_ratio = 0.6; int min_escort_force = 2; int min_defense_force = 14; int min_exploration_force = 2; int min_attack_force = 26; int min_resource_force = 3;

It's the way MAP set it up, I've changed nothing. As you can see there is no perimeter force line so maybe I should try adding it? It's just strange that all races attack with any number of ships but never the minium listed.