Jump to content


Photo

Offering help fo WA...


11 replies to this topic

#1 ArkhanTheBlack

ArkhanTheBlack

    title available

  • Members
  • 814 posts

Posted 19 September 2005 - 03:13 PM

Hello guys,

since Larkin mentioned that you might need some coding help for WA I got interested and started to dig further into the AI code. Thuds Wiki helped me a lot with that. I'm now playing around a bit to know what's possible, and how it's possible.
At the moment I mainly focused on the building startegy of chaos, since I know this race best.
First I modified the squad limits a bit to get variety. Normally, there are two default settings. I replaced them with one setting with random numbers:

SquadLimits =
{
standard =
{
chaos_squad_slave = 0,
chaos_squad_cultist = 1,
chaos_marine_squad = math.random( 3,5 ),
chaos_squad_raptor = math.random( 2,4 ),
chaos_squad_possessed_marine = math.random( 3,6 ),
chaos_squad_horror = math.random( 1,4 ),
chaos_squad_sorcerer = 1,
chaos_squad_lord = 1,
chaos_squad_obliterator = math.random( 1,5 ),
chaos_squad_rhino = 0,
chaos_squad_defiler = math.random( 4,10 ),
chaos_squad_predator = math.random( 4,6 ),
chaos_squad_bloodthirster = 1,
}
}

So far, it seemed to work fine in my test games.
Something that particular annoyed me was the demand code overriding the build orders in the race specific buildbasestrategy ai file. Before, the file was treated more like a guide line, now it's the definite building bible. This had some nasty consequences at first. I recognized that the chaosbuildbasestrategy.ai file had some progress 'holes' that were normally compensated by the demanding code. Therfore it didn't advance to Tier 2 for example. So I added the missing code pieces. Another stupid behaviour I got, was the AI buidling 6 generators in Tier1, which is pretty much suicide against rushers. I restricted this to 3 in Tier1.

I also modified the build order, so that it now builds vehicles earlier and more of them. IMHO the AI in general sucks with squad handling. It's best with a dumb badass vehicle where you can't make too much wrong, because it's extremly tough and deals a lot of damage very reliable. Since he normally builds a lot of generators, he should also use them to the max. This gets especially important in late Tier3 games. I had skirmish AI's with 10000(!!!) power not spent. Therefore, they'll build 2 machine cults in Tier2 and 3 in Tier3. I do that myself, because it's the only way to get rid of all the power.

I've also seen some code from guy named 'Corsix', who ordered the AI to build the second LP addon in Tier2, and wasting ressources en masse. I particular hated this behaviour and delayed it to final Tier3 actions :sad: .

The early game was more different. The AI has pretty much no chance against a dark reaper rush, because it normally tries to counter it with tactical chaos marines. The only way I could reach a decent counter to that was raptors. They'll make a jump attack and therefore force them to melee combat. I had to modify the jumpattack code for that, because they were too often too cowardly to make a jump attack and tried to move to the enemy instead, being normally shot away with not even reaching the enemy. Now, they might die as well, but not as fast and senseless. I had several situations, where they managed to keep my squads long enough in melee combat to get enough reinforcements. A very nice side effect is that the AI is able to react much faster to attacks and can also support it's allies better. It also can retreat much faster if the air gets too hot. I also removed the strange behaviour of jump troops to make redicilous short jumps.

Since the AI tries to gather a much bigger force before it attacks, it's more likely to be attacked itself. Therefore it will now upgrade basic LP's to fortified positions faster. It will provide better defense and an increased income. I was very pleased with the result, because a fortified LP + raptors seemed to work wonders against rushes.

I also changed some unit ratings to get more raptors, reinvent the defiler spam, and made some other slighter changes.
Compared to a human, the biggest weakness of the AI is pretty much the attack and squad behaviour. Except the jumpattack, I didn't mess with the code that much because it looks VERY difficult. I fear I will need some time to understand it enough to make some usefull changes. (BTW, very impressive dancing code!!!)

I'll now try to rework the other races, too, because their build order was messed up too, because of the now missing building orders in the demand code. I'm satisfied so far with the chaos AI, because I wasn't able to win any more on St.Matthias bridge. Not even with a rush. In the end result the AI's had a total of ca. 500 ressources left which means that they spent nearly all their ressources. That's exactly what I wanted.

I'd also thankfull for every additional documentation and/or hints besides the Wiki. Most things are pretty much try and error. There are a lot of methods I don't know what they are for because they are documented nowhere, and the class structure isn't that clear to me as I feal it should be.


Sorry for the long post :lol: . It's pretty much the result of two 18 hour days. I might also post some other questions in future. Since I'm new to the AI code some of these questions might be a bit annoying. So please have patience with me. Hopefully I can be of some help when WA is released...

#2 oozish

oozish
  • Members
  • 231 posts

Posted 19 September 2005 - 03:28 PM

wow, that's cool man...I'm sure you know Thud and Co. will greatly appreciate your input

#3 Malkor

Malkor

    Eternity

  • Members
  • 375 posts
  • Projects:Loladins of Legend.
  •  Inanely inane inanities!

Posted 19 September 2005 - 07:32 PM

You know I haven't seen a bloodthirster built by the AI in 1.4 yet. I've seen an avatar, but no squiggoth or bloodthirster (though orks rarely live to endgame in my FFA's so I assume they never get the chance...)

#4 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 20 September 2005 - 12:35 AM

Arkhan! Welcome!

We're ready and able to move forth with WA badly! I am dying to add it to our existing project and carry the AI to the next level.

Can you document in point form what new changes you've made to our code to make early and mid-game more exciting?!

I'm sure Larkin, Flenser, and Corsix would definitely welcome another super-euthusiastic coder to the fold. There is soo much cool stuff still to do BUT so much is done that its just icing on the cake now. Larkin is the brains behind much of the drive and gusto going around these parts.

If you need any explination on anything let us know. We've endeavoured to put out a superior product and plan to evolve it to the next level starting with the expansion. Exciting times lay ahead! Welcome aboard!
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#5 Excedrin

Excedrin
  • Project Team
  • 154 posts

Posted 20 September 2005 - 02:08 AM

What happens if math.random always returns the lower number? (I realize that this is unlikely).

It seems like you dislike cultists but like psm very much. In tier 1, psm are horrible and should not be built. Building them early will severely delay tier 2, plasma, vehicles, etc.

#6 ArkhanTheBlack

ArkhanTheBlack

    title available

  • Members
  • 814 posts

Posted 20 September 2005 - 01:59 PM

You know I haven't seen a bloodthirster built by the AI in 1.4 yet. I've seen an avatar, but no squiggoth or bloodthirster (though orks rarely live to endgame in my FFA's so I assume they never get the chance...)

The code for the Avatar delays turrets and LP3's, the BT has to wait. Therefore the Avatar is more likely to be built. I'll try to do the same for the BT. Let's see what happens...

What happens if math.random always returns the lower number? (I realize that this is unlikely).

No problem! The min of all squad limits is more than 20 pop.

It seems like you dislike cultists but like psm very much. In tier 1, psm are horrible and should not be built. Building them early will severely delay tier 2, plasma, vehicles, etc.

You're right! Therefore the circle is built in Tier2 in my build order.

@Thud
Thanks for the welcome. The key points of my current changes are:

- Gain full control about the build order for all buildings and Tier addons, with the race specific buildbasestrategy files as definite control files

- Use this to optimize the build order of a specific race for efficient Tier1 - Tier3 teching, early vehicles and full usage of the available ressources

- It also allows more flexibility since it makes the modification of the build order much easier and more reliable

- Better counter for ranged troops rushes for SM and CSM with raptors and assault marines

- Build titans faster if possible


The problem is, I've to rework every race file. I'm pretty much finished with SM/CSM and now reworking the Eldar. After I got rid of the *censored* crash to desktop, I now have some problems with the aspect stone addons. Orcs will be especially funny, because I never played them and therefore don't feel very competent about the perfect build order for them.

Maybe one of you can answer me some questions:

1.) How can I force the AI to research the aspect stones of an eldar support portal first instead of spamming falcon grav tanks?

2.) If I want to build a titan, but don't have enough ressources, how can I block the usage of ressources for other units and researches?

3.) Can I add functions freely to the AI files, or are their only fixed template functions? Can I use global variables?

#7 Excedrin

Excedrin
  • Project Team
  • 154 posts

Posted 20 September 2005 - 04:01 PM

1) You can use
build_manager:SetSquadLimit( "eldar_squad_falcon_grav_tank", 0 )
to dynamically disable falcon production. The other way is the way the aspect stones are built for the aspect portal.

2) You can set buildbasestrategy's spend_money to false to avoid spending req

3) Yes you can add functions and you can use global variables.

#8 Malkor

Malkor

    Eternity

  • Members
  • 375 posts
  • Projects:Loladins of Legend.
  •  Inanely inane inanities!

Posted 21 September 2005 - 12:51 AM

I still want to see some random build orders... like a rush to land speeders for SM which I myself often do a fair bit in FFA's. It can be quite devastating if you don't get rushed.

#9 Excedrin

Excedrin
  • Project Team
  • 154 posts

Posted 21 September 2005 - 08:10 AM

It would be easier to code large set of "specific" strats, like:
mass ranged infantry
teched infantry (teched guardians, 4 marines per squad with 4 plasma, mass plasma scouts)
mass raptors/asm/stormboyz
rush to vehicles

I dislike the idea of a purely random build order since it seems like the AI might make 5 generators, research infantry health, build a turret and then decide to make 3 land speeders followed by 7 marine squads. A human would make speeders in the context of a team game. For example, in a 3v3, two people are massing infantry while one is purely teching to vehicles with almost no infantry and deleting buildings in order to get req while his teammates donate power. It seems difficult to encode that level of knowledge about the game in a general way, but it would be really cool to have.

#10 Malkor

Malkor

    Eternity

  • Members
  • 375 posts
  • Projects:Loladins of Legend.
  •  Inanely inane inanities!

Posted 21 September 2005 - 08:15 PM

That was the idea... a set of specific strategies... I didn't think you could have purely randomized build orders... DoW is quite different than Starcraft, I see.

Maybe someone will teach me LUA so I can make a script that detects an FFA or team game and try to rush to vehicles sometimes ^^

#11 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 27 September 2005 - 11:09 AM

I also removed the strange behaviour of jump troops to make redicilous short jumps.


I looked up your code and couldn't see a big difference to the original. Can you explain why you think yours should work better ?

Original code limited jumps to distances > 20. Yours to 22 if I get it right.

#12 ArkhanTheBlack

ArkhanTheBlack

    title available

  • Members
  • 814 posts

Posted 27 September 2005 - 12:33 PM

This is one of my changes that didn't behave like expected. I removed the thread check first and added it later after I saw the results. I found my code a bit clearer, therefore I left it.

Actually, after looking at the old code part again, I recognized that the short jumps were pretty much my own fault. I was a bit too fast with changes and removed the range check, wondered why they behaved so strange and reinvented my own range check.
To be honest, the old ranged check is even better, because it checks for any enemy that might be too near, mine only checks the jump distance.

So, my mistake, sorry. :p

The only thing that should be better with my code is that it first checks for a ranged victim and then for a melee victim.
Replacing my range check with the previous one is probably the best thing.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users