Jump to content


Photo

[BfME II] AI tutorial, part 1


  • Please log in to reply
12 replies to this topic

#1 Chachalon

Chachalon
  • Members
  • 28 posts
  • Projects:Burning Sky for C&C Tiberian Wars (just some storywriting & concept drawings...)

Posted 01 May 2006 - 01:32 PM

So, as Solinx already linked to them (thx man!) I decided to repost my AI tutorials here, maybe somebody will find them helpful:

I'll try to explain the stuff of skirmishaidata.ini which I understood so far...


BrutalDifficultyCheats TheBrutalDifficultyCheats
BuildCostReduction = 15%
BuildTimeReduction = 15%
End

Those are the "cheats" of the brutal AI. Pretty much self explaining...



ArmyDefinition MenOfTheWestArmy

The next block is the one which holds the information for the skirmish AI of the MotW faction. As the other ones are quite similar, I will use this one as an example.

MustUseCommandPointPercentage_Phase1 = 80%;// The AI UnitBuilder tries to keep the army at at least this size
MustUseCommandPointPercentage_Phase2 = 90%
MustUseCommandPointPercentage_Phase3 = 100%

Note that this is already the modded version. The AI divides the game into three phases (rush, mid game, late game, see below). These values tell it how many command points its army shall use.

EconomyBuilderMinFarmsOwned = 6

This tells the AI to build a total of 6 farms at a time. One might want to increase this number...

PercentToSave_Rush = 0.5%
PercentToSave_MidGame = 0.01%; Why should the AI save anything?
PercentToSave_EndGame = 0.01%

This, too, is the modded version. The original AI is told to save much more of its money, one of the reasons for doing so I can imagine is to be able to quickly build lots of units when under attack... as soon as the AI has to defend its own base, it's most likely already lost. The other reason might be to be able to build heroes, but I had some games with this set to something like 5% and it just saved insane amounts of money and not build heroes earlier than normal... and then I played with the above settings once and each of the five AI opponents had his first hero before the 5-minutes mark...


PhaseDuration_Rush = 240.0;//amount of time in seconds from the beginning of a match, 4 minutes is too long
PhaseDuration_MidGame = 300.0;//amount of time in seconds from end of Rush Phase

Here you got the length of the rush- and midgame-phase defined.


ChanceForUnitsToUpgrade=
One might put that up to increase the chance for units being upgraded by the AI (more about the AI and upgrades in part 2 of this tutorial)

;//
;// ARMY UNIT DEFINITIONS
;//

The following part of the ini gives the AI instruction on what units it shall build in which phase of the game. For example

ArmyMemberDefinition GondorFighterHorde_Member
Unit = GondorFighterHorde;infantry
PercentageOfArmyPhase1 = 80.0
PercentageOfArmyPhase2 = 20.0
PercentageOfArmyPhase3 = 20.0
End

This would tell it that in the rush-phase, the army should be made up of 80% normal soldiers, while in mid- and late-game only 20% of the army would be soldiers.
You can easily add new units here by just making a new block just like the one above and give it a different name ("ArmyMemberDefinition XY_member") and replace the unit with your new one.

Edited by ched, 01 May 2006 - 02:24 PM.


#2 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 01 May 2006 - 01:38 PM

Would it be possible to allow the AI to build new heroes by using some of this code?
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#3 ched

ched

    .

  • Undead
  • 4,431 posts
  • Location:Angers (France)
  • Projects:Rhovanion Alliance
  •  T3A Team Chamber Member
  • Division:BFME
  • Job:Previous Division Leader

Posted 01 May 2006 - 02:25 PM

ah, very nice of you to post some things on that neglected side of the modding. I did some editions to make it easier on the eye, and edited the title to warn BfME I users.

looking forward to more tutorials by you ;)
Software is like sex; it's better when it's free ~Linus Torvald

#4 Chachalon

Chachalon
  • Members
  • 28 posts
  • Projects:Burning Sky for C&C Tiberian Wars (just some storywriting & concept drawings...)

Posted 01 May 2006 - 08:09 PM

Thanks ched for the edit. I tried to copy the quotes but it somehow did not work... stupid me

@zimoo: At the end of the "Army units definition" block you'll find a line like
HeroBuildOrder = MordorSauron_RingHero Drogoth WildGoblinKing WildShelob

I'm not really sure because I haven't tried to add new heroes yet, but I'd say you just have to add your new hero to them.

Edited by Chachalon, 01 May 2006 - 08:11 PM.


#5 Cobra

Cobra

    The Renegade

  • Banned
  • 1,048 posts
  • Location:Cobra's Lair
  • Projects:Quite a Few
  •  Resident Kiwi

Posted 02 May 2006 - 04:03 AM

sweet, a very handy tutorial. Its amazing how many mods simply dont bother with this

Dmain | I-Cold | earthWhois
Dmain Now offers .mobi extensions....why? Because we can :D

Posted Image

Posted Image


Update: EAW Galaxy is almost ready for launch. We're currently in need of forum staff and content writers for the main site. Please PM or Email me ASAP.

BFME Fans if you think you have what it takes, bfmeworld.com would love to be built. I have neither the time, nor the motivation any longer...


#6 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 09 May 2006 - 01:35 PM

Chachalon, would it be possible to use this ini file to add AI for a new faction? Would it be a case of copying and pasting the code or would I need to go into WorldBuilder and do something there?
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#7 Chachalon

Chachalon
  • Members
  • 28 posts
  • Projects:Burning Sky for C&C Tiberian Wars (just some storywriting & concept drawings...)

Posted 09 May 2006 - 08:03 PM

The problem I see with adding AI for a new faction without using WorldBuilder is that neither the order in which the AI builds structures nor the placing of structures is controlled by skirmishaidata.ini, I guess it has to do with those bases/worldbuilder, but I know absolutly nothing about that part of modding, sorry. But once you've created those new bases, copy/paste the right parts (army unit definition and the stuff about "AIDozerAssignment", I guess thats all you need in that file) should enable the new faction to use its new units.

#8 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 09 May 2006 - 08:17 PM

Yeah I don't know anything about editing AI in wolrdbuilder, thats why I hoped I'd be able to do it through INIs
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#9 Bart

Bart

  • Network Admins
  • 8,524 posts
  • Location:The Netherlands
  • Division:Revora
  • Job:Network Leader

Posted 11 May 2006 - 09:07 PM

now that the AI is coded instead of scripted, does that mean that it will actually kinda think? so when it wants to build a certain structure, but i've modded the game so that structure requires an upgrade, it will focus on getting that upgrade?

i know you're probably as unable to answer this is any of us, but still...
bartvh | Join me, make your signature small!
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."

#10 Chachalon

Chachalon
  • Members
  • 28 posts
  • Projects:Burning Sky for C&C Tiberian Wars (just some storywriting & concept drawings...)

Posted 11 May 2006 - 09:20 PM

After adding some units and structures that do require upgrades, it looks like the AI actually gets these upgrades if it is told to build those units/structures. For example I made trebs only buildable at lvl 3 workshop (and added ram and ballista for lower levels) and didn't change anything for the workshop-upgrades and it actually did attack with trebs. You could also add
SkirmishAIHeuristic = AI_UPGRADEHEURISTIC_FACTORY_UNITUNLOCK
to the upgrade block, that might increase the chance for the AI to get this upgrade earlier.

#11 Guest_Rocky_*

Guest_Rocky_*
  • Guests

Posted 14 May 2006 - 04:33 AM

how can i adjust the length of each phase? phase 3 just takes too long to happen!

#12 Solinx

Solinx

    .

  • Undead
  • 3,100 posts
  • Location:The Netherlands
  • Projects:Real Life
  • Division:Revora
  • Job:Retired Leader / Manager

Posted 31 May 2006 - 08:55 PM

PhaseDuration_Rush = 240.0;//amount of time in seconds from the beginning of a match, 4 minutes is too long
PhaseDuration_MidGame = 300.0;//amount of time in seconds from end of Rush Phase

Here you got the length of the rush- and midgame-phase defined.

It says it right there, in the tutorial. Lower the midgame phase duration and the 3th phase will start sooner.

Solinx
Posted Image

"An expert is a man who has made all the mistakes which can be made in a very narrow field." - Niels Bohr


#13 gansnudel

gansnudel
  • Members
  • 25 posts

Posted 06 August 2006 - 12:34 AM

PercentToSave_Rush = 0.5%
PercentToSave_MidGame = 0.01%; Why should the AI save anything?
PercentToSave_EndGame = 0.01%

This, too, is the modded version. The original AI is told to save much more of its money, one of the reasons for doing so I can imagine is to be able to quickly build lots of units when under attack... as soon as the AI has to defend its own base, it's most likely already lost. The other reason might be to be able to build heroes, but I had some games with this set to something like 5% and it just saved insane amounts of money and not build heroes earlier than normal... and then I played with the above settings once and each of the five AI opponents had his first hero before the 5-minutes mark...


Don´t use those settings. The save values directly affect the AI´s ability to build heroes. I had the save settings set to 0.01% only for the men faction and they completely stopped building heroes, even on maps where they couldn´t build their standard base. I put the values back to higher percentages and the AI started building heroes again. I guess you saw the early heroes, because 0.5% saving in the rush phase is quite a lot and enables the AI to build a cheap hero early.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users