Company of Heroes: Eastern Front

Author Topic: 'Controlling' the AI  (Read 19297 times)

Offline jojorabbit

  • Developer
  • Commissar
  • *
  • Posts: 481
    • View Profile
Re: 'Controlling' the AI
« Reply #15 on: August 22, 2012, 12:44:29 AM »
Hey,
sorry for late reply am pretty busy with a lot of stuff.

Here is what you need to do for doctrines.

file : command_tree_prefs_lib.ai


You will see a lot of tables they r kinda sorted for all factions, so you just need to comment what you don't need.
-- sign means commented line or you can look it as ignored code :P.
Example PE starts at line 180 for only Tank Destroyer PE it needs to look like this:

Code: [Select]
-------------------------------------------------------
-- AXIS PE

-- LUFTWAFFE SUPPORT
-- pe_luftwaffe_random = {
-- main = CT_PZ.LUFTWAFFE,
choices = {} -- choices as nil means random
-- },

-- pe_luftwaffe_left_first = {
-- main = CT_PZ.LUFTWAFFE,
-- choices = {CT_PZ.LUFTWAFFE_00, CT_PZ.LUFTWAFFE_01, CT_PZ.LUFTWAFFE_02, CT_PZ.LUFTWAFFE_10, CT_PZ.LUFTWAFFE_11, CT_PZ.LUFTWAFFE_12,}
-- },

-- pe_luftwaffe_right_first = {
-- main = CT_PZ.LUFTWAFFE,
-- choices = {CT_PZ.LUFTWAFFE_10, CT_PZ.LUFTWAFFE_11, CT_PZ.LUFTWAFFE_12,CT_PZ.LUFTWAFFE_00, CT_PZ.LUFTWAFFE_01, CT_PZ.LUFTWAFFE_02,}
-- },

-- pe_scorched_random = {
-- main = CT_PZ.SCORCHED_EARTH,
choices = {} -- choices as nil means random
-- },

-- pe_scorched_left_first = {
-- main = CT_PZ.SCORCHED_EARTH,
-- choices = {CT_PZ.SCORCHED_EARTH_00, CT_PZ.SCORCHED_EARTH_01, CT_PZ.SCORCHED_EARTH_02, CT_PZ.SCORCHED_EARTH_10, CT_PZ.SCORCHED_EARTH_11, CT_PZ.SCORCHED_EARTH_12,}
-- },

-- pe_scorched_right_first = {
-- main = CT_PZ.SCORCHED_EARTH,
-- choices = {CT_PZ.SCORCHED_EARTH_10, CT_PZ.SCORCHED_EARTH_11, CT_PZ.SCORCHED_EARTH_12, CT_PZ.SCORCHED_EARTH_00, CT_PZ.SCORCHED_EARTH_01, CT_PZ.SCORCHED_EARTH_02,}
-- },

pe_tankdestroyer_random = {
main = CT_PZ.TANK_DESTROYER,
--choices = {} -- choices as nil means random
},

pe_tankdestroyer_left_first = {
main = CT_PZ.TANK_DESTROYER,
choices = {CT_PZ.TANK_DESTROYER_00, CT_PZ.TANK_DESTROYER_01, CT_PZ.TANK_DESTROYER_02, CT_PZ.TANK_DESTROYER_10, CT_PZ.TANK_DESTROYER_11, CT_PZ.TANK_DESTROYER_12,}
},

pe_tankdestroyer_right_first = {
main = CT_PZ.TANK_DESTROYER,
choices = {CT_PZ.TANK_DESTROYER_10, CT_PZ.TANK_DESTROYER_11, CT_PZ.TANK_DESTROYER_12, CT_PZ.TANK_DESTROYER_00, CT_PZ.TANK_DESTROYER_01, CT_PZ.TANK_DESTROYER_02,}
},

For WH Blitz only is the same stuff just comment other two doctrines, i have not tested yet but it should work ;).
Re-install and re-editing lines should always work :).

Reward units are fixed internally and i guess i can post that fix cuz it is just a one file that fixes it will see with others. But that fix will be out with new patch i guess :P.

Hope it helps.

EDIT:
This was typed in hurry so i know it is kinda not so easy to understand.
The file you need to edit is located in : COH_HOME\Eastern_Front\Data\ai\personality folder, edit it with npp or some other editor.
« Last Edit: August 22, 2012, 02:22:35 AM by jojorabbit »

Offline Otto Halfhand

  • Donor
  • Mr. Spam
  • *
  • Posts: 1166
    • View Profile
Re: 'Controlling' the AI
« Reply #16 on: August 22, 2012, 01:11:12 AM »
Hi guys, just got back from a week on the road.

@viruz777: Welcome to the club. You are quite a HasenJaeger. Please post your wishlist for EF_mod AI behaviour on the Compstompers corner THread. It will be taken under advisement. - PM me.

I too wish to see a mode of player for compstompers which allows the selection of particular AI Personalities pre-game. THis is do-able. It is not at this time politically viable in the EF_mod. I hope to change this but as Sharks suggested: We are not fast. I will add to that we are not slow, we are half fast.  :P I have hopes that perhaps by the time the first or second Ostheer patch is offered we might be able to get this feature. If you can;  Lobby JoJo. He is after all the only Dev here.

Regarding your request to fight only Jagdpanzers in TD mode this is do-able as well. Jojo has a program to select a particular reward unit and THe CT tree used in a game can be selected at start with rudumentary knowledge of lua coding. Download a copy of "notepad ++" text editor and we can get you started. I can show you how to increase the occurance of Jagdpanzers in ai play but that is not so rudimenatary. Don't let the balancers intimidate you. They are good guys but they don't understand why anyone like you and I prefer compstomping.
孫 The
EF_v1.7.10
子 Art
Illegitimi non Carborundum -"Vinegar" Joe Stilwell
兵 of
Sun Tzu says: In warfare one compels and is not compelled by others
法 War

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #17 on: August 22, 2012, 02:03:46 AM »
Hey,
sorry for late reply am pretty busy with a lot of stuff.

Here is what you need to do for doctrines.

file : command_tree_prefs_lib.ai


You will see a lot of tables they r kinda sorted for all factions, so you just need to comment what you don't need.
-- sign means commented line or you can look it as ignored code :P.
Example PE starts at line 180 for only Tank Destroyer PE it needs to look like this:

Code: [Select]
-------------------------------------------------------
-- AXIS PE

-- LUFTWAFFE SUPPORT
-- pe_luftwaffe_random = {
-- main = CT_PZ.LUFTWAFFE,
-- choices = {} -- choices as nil means random
-- },

-- pe_luftwaffe_left_first = {
-- main = CT_PZ.LUFTWAFFE,
-- choices = {CT_PZ.LUFTWAFFE_00, CT_PZ.LUFTWAFFE_01, CT_PZ.LUFTWAFFE_02, CT_PZ.LUFTWAFFE_10, CT_PZ.LUFTWAFFE_11, CT_PZ.LUFTWAFFE_12,}
-- },

-- pe_luftwaffe_right_first = {
-- main = CT_PZ.LUFTWAFFE,
-- choices = {CT_PZ.LUFTWAFFE_10, CT_PZ.LUFTWAFFE_11, CT_PZ.LUFTWAFFE_12,CT_PZ.LUFTWAFFE_00, CT_PZ.LUFTWAFFE_01, CT_PZ.LUFTWAFFE_02,}
-- },

-- pe_scorched_random = {
-- main = CT_PZ.SCORCHED_EARTH,
-- choices = {} -- choices as nil means random
-- },

-- pe_scorched_left_first = {
-- main = CT_PZ.SCORCHED_EARTH,
-- choices = {CT_PZ.SCORCHED_EARTH_00, CT_PZ.SCORCHED_EARTH_01, CT_PZ.SCORCHED_EARTH_02, CT_PZ.SCORCHED_EARTH_10, CT_PZ.SCORCHED_EARTH_11, CT_PZ.SCORCHED_EARTH_12,}
-- },

-- pe_scorched_right_first = {
-- main = CT_PZ.SCORCHED_EARTH,
-- choices = {CT_PZ.SCORCHED_EARTH_10, CT_PZ.SCORCHED_EARTH_11, CT_PZ.SCORCHED_EARTH_12, CT_PZ.SCORCHED_EARTH_00, CT_PZ.SCORCHED_EARTH_01, CT_PZ.SCORCHED_EARTH_02,}
-- },

pe_tankdestroyer_random = {
main = CT_PZ.TANK_DESTROYER,
--choices = {} -- choices as nil means random
},

pe_tankdestroyer_left_first = {
main = CT_PZ.TANK_DESTROYER,
choices = {CT_PZ.TANK_DESTROYER_00, CT_PZ.TANK_DESTROYER_01, CT_PZ.TANK_DESTROYER_02, CT_PZ.TANK_DESTROYER_10, CT_PZ.TANK_DESTROYER_11, CT_PZ.TANK_DESTROYER_12,}
},

pe_tankdestroyer_right_first = {
main = CT_PZ.TANK_DESTROYER,
choices = {CT_PZ.TANK_DESTROYER_10, CT_PZ.TANK_DESTROYER_11, CT_PZ.TANK_DESTROYER_12, CT_PZ.TANK_DESTROYER_00, CT_PZ.TANK_DESTROYER_01, CT_PZ.TANK_DESTROYER_02,}
},

For WH Blitz only is the same stuff just comment other two doctrines, i have not tested yet but it should work ;).
Re-install and re-editing lines should always work :).

Reward units are fixed internally and i guess i can post that fix cuz it is just a one file that fixes it will see with others. But that fix will be out with new patch i guess :P.

Hope it helps.

Hi Jojo not a problem at all. I'm sorry if I sounded impatient because I actually wasn't. I only took your word seriously that you said you'll maybe help me in a day or two when you're free  :-X Didn't mean to rush you or anything so again I apologise. I'm actually a very patient person when it comes to EF_mod releases. There's just so much to experiment and explore! (vs AI of course  :P)

To be honest I am very new to modding and have little to no experience. The last time I modded COH to my taste was back during vanilla release and I think it was Corsix's mod studio. Do I need to download that and edit the lines like you suggested? I'm still trying to understand your instructions since I'm very confused and the lines can't help but make me feel abit intimidated since I'm abit at a loss on where exactly to start..

Thanks for taking the time to help me out with this though, I really appreciate it!
« Last Edit: August 23, 2012, 12:21:39 AM by jojorabbit »

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #18 on: August 22, 2012, 02:16:32 AM »
Hi guys, just got back from a week on the road.

@viruz777: Welcome to the club. You are quite a HasenJaeger. Please post your wishlist for EF_mod AI behaviour on the Compstompers corner THread. It will be taken under advisement. - PM me.

I too wish to see a mode of player for compstompers which allows the selection of particular AI Personalities pre-game. THis is do-able. It is not at this time politically viable in the EF_mod. I hope to change this but as Sharks suggested: We are not fast. I will add to that we are not slow, we are half fast.  :P I have hopes that perhaps by the time the first or second Ostheer patch is offered we might be able to get this feature. If you can;  Lobby JoJo. He is after all the only Dev here.

Regarding your request to fight only Jagdpanzers in TD mode this is do-able as well. Jojo has a program to select a particular reward unit and THe CT tree used in a game can be selected at start with rudumentary knowledge of lua coding. Download a copy of "notepad ++" text editor and we can get you started. I can show you how to increase the occurance of Jagdpanzers in ai play but that is not so rudimenatary. Don't let the balancers intimidate you. They are good guys but they don't understand why anyone like you and I prefer compstomping.

Thanks for the welcome :) what is a HasenJaeger? Thanks for bringing my attention to that thread, I never knew it was around and it's great to finally meet someone else who enjoys compstomping! I find PvP is too fast paced that I am unable to enjoy and appreciate the game at my own pace + the graphics and gameplay aspect of it.

Yes AI personalities should be a very helpful option which I feel will benefit newcomers to CoH and EF_mod alike. I first noticed how useful it is in the C&C3 and Generals franchise. I know that EF_mod isn't as fast as how most people would want but I am not like most people and I can understand :) I am not demanding that they work quicker and roll out stuff faster just so they can start working on this AI improvement thing. I was about to say to Sharks that I didn't mean to hustle jojo since I actually took his word that he'd be free to help me in a couple of days but I cleared that up. Anyway, are you by any chance one of the devs? I'm surprised you are quite confident and positive to say that this is do-able. I would very much wish to lobby with jojo but it's abit hard sometimes since I wouldn't want to take too much of his time away from doing the real work and rolling out 'what needs to be rolled out' quick hahaha... but also mainly since english isn't his first language, it's abit hard to understand what he's trying to say exactly - no offense to you jojo!

I've downloaded a copy of notepad++ as instructed so feel free to instruct me here :D I'm not exactly intimidated by the devs here but in fact I appreciate the vast knowledge they have with coding - as shown by the fantastic details on the EF_mod models.  It's just that when I'm asking for something like this and they try to help it can be abit hard to understand because it seems quite advanced and the coding itself intimidates me. Will PM you the details on the compstomp wishlist,

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #19 on: August 22, 2012, 02:34:06 AM »
Hi Jojo after really reading properly I think I understand what you're trying to say and I see the difference in the code.

Basically just add "--" to all those doctrine lines that you don't want and the AI will ignore it right? I can see tank destroyer didn't have "--" in their lines.

Seems simple enough just adding -- there :D Problem now is using the right tools to edit it hmm..

Anyway, what about if I wanted AI to not build artillery like nebelwerfer, calliope etc?

Thanks again for your help!

Offline jojorabbit

  • Developer
  • Commissar
  • *
  • Posts: 481
    • View Profile
Re: 'Controlling' the AI
« Reply #20 on: August 22, 2012, 12:17:49 PM »
Hi Jojo after really reading properly I think I understand what you're trying to say and I see the difference in the code.

Basically just add "--" to all those doctrine lines that you don't want and the AI will ignore it right? I can see tank destroyer didn't have "--" in their lines.

Seems simple enough just adding -- there :D Problem now is using the right tools to edit it hmm..

Anyway, what about if I wanted AI to not build artillery like nebelwerfer, calliope etc?

Thanks again for your help!

Yes "--" means one line comment.

Some instructions :

Just open command_tree_prefs_lib.ai in notepad++ aka  npp, on toolbar select Language-> L -> Lua and you will get Lua syntax coloring.
Also you can use other editors like metapad, scite etc, i recommend npp.

When you turn on syntax coloring you will get something like on this image:


When you comment line/s they will be colored green ;). Without syntax coloring everything will be gray so it is hard to notice it :P.

Tip: For faster commenting just select lines you want to comment and press CTRL+Q and all of then will be auto commented.

File you need to open is located in : COH_HOME\Eastern_Front\Data\ai\personality folder

P.S.

Quote
I was about to say to Sharks that I didn't mean to hustle jojo since I actually took his word that he'd be free to help me in a couple of days but I cleared that up.

 I would very much wish to lobby with jojo but it's abit hard sometimes since I wouldn't want to take too much of his time away from doing the real work and rolling out 'what needs to be rolled out' quick hahaha... but also mainly since english isn't his first language, it's abit hard to understand what he's trying to say exactly - no offense to you jojo!

Don't worry am not so easy to offend. I did not know that my english is that bad :D, my problem is cuz i think everyone knows everything so sometimes i skip some of stuff that should be explained.

Quote
Anyway, what about if I wanted AI to not build artillery like nebelwerfer, calliope etc?
When you get this working then we will go to other step ;).

Feel free to ask anything you need.

Offline Otto Halfhand

  • Donor
  • Mr. Spam
  • *
  • Posts: 1166
    • View Profile
Re: 'Controlling' the AI
« Reply #21 on: August 22, 2012, 03:06:03 PM »
Hey viruzz777 HasenJaeger is Pennsylvania Dutch for Rabbit Hunter. We haven't gotten jojorabbit out of his hole since fishing season started. Looks like he's got you started on the right paw.  ;) good luck.
孫 The
EF_v1.7.10
子 Art
Illegitimi non Carborundum -"Vinegar" Joe Stilwell
兵 of
Sun Tzu says: In warfare one compels and is not compelled by others
法 War

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #22 on: August 22, 2012, 07:59:44 PM »
Hi Jojo

Yes the instructions you provided are clearer to understand now. Thanks for the additional instructions it made it much much easier :D Also, your english is not bad. It's just at first when you replied to this thread it was harder to understand until GodlikeDennis helped clear things up for me.

I have edited the code and tried playing a game but the game pauses after finish loading and says "FATAL AI ERROR - EXECUTION PAUSED". What did I do wrong and what should I do now? All I did was add the -- to every line as shown in your example except US Armor, UK Royal Engineers, Axis Blitz, PE Tank Destroyer and Soviet Breakthrough. I started a game with US vs PE and Axis and that error message popped up.

Edit : Tried continuing my SP campaign while waiting for response and found that the editing also affected it. After loading it would stay in black screen and not continue to play cutscene. Tried replacing the edited file with the original and everything went back to normal. I'm surprised that editing this AI personality would also affect SP experience since I thought it would only affect skirmish.
« Last Edit: August 22, 2012, 08:36:28 PM by viruz777 »

Offline jojorabbit

  • Developer
  • Commissar
  • *
  • Posts: 481
    • View Profile
Re: 'Controlling' the AI
« Reply #23 on: August 22, 2012, 09:35:36 PM »
Hm, am not sure what you did wrong i did not tested this yet but i will test it and will attach whole file that works.
Also it is great that you made backup of original file.

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #24 on: August 23, 2012, 12:09:00 AM »
Hey Jojo yes please try to test it and see how it works. I copied everything EXACTLY like the example you gave me and I still got that fatal AI error again. When I looked carefully I realised this line:

-------------------------------------------------------
   -- AXIS PE

   -- LUFTWAFFE SUPPORT
   -- pe_luftwaffe_random = {
      -- main = CT_PZ.LUFTWAFFE,
      choices = {} -- choices as nil means random

The highlighted red line I added the "--" as well but I noticed in your example it didn't have it. So I thought it was my mistake and I removed the -- but it still gave me error.

Funny thing though, I used original file and ONLY edited Wehr Blitz and PE Tank Destroyer instead of all the other countries, WITH adding -- in that "choices = {} -- choices as nil means random" line. The game launched fine and no error but the code didn't affect AI and they still build terror doctrine and luftwaffe...

Offline jojorabbit

  • Developer
  • Commissar
  • *
  • Posts: 481
    • View Profile
Re: 'Controlling' the AI
« Reply #25 on: August 23, 2012, 12:28:22 AM »
choices = {} -- choices as nil means random
That red line needs to be commented. Probably my mistake with CTRL + Q.

Quote
. The game launched fine and no error but the code didn't affect AI and they still build terror doctrine and luftwaffe...

Did you commented just _random or all three _left, _right?

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #26 on: August 23, 2012, 12:40:55 AM »
Oh ok that means I did it correctly first time around but they still used terror and luftwaffe  ???

I commented on all three _random, _left and _right just like your example showed.

Here is download link of my edited file for you to see for yourself if I did it correctly : https://rapidshare.com/files/3211722122/command_tree_prefs_lib.ai

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #27 on: August 23, 2012, 02:29:03 AM »
Tried another game and I think this time I got lucky since wehr AI selected blitzkrieg but it kept spamming geschutzwagen  :-\

PE AI still chose luftwaffe again so I don't think both AI choices was a result from the editing that I did. Also kept spamming Marder III at me -_- Can't wait to get past this stage and learn how to prevent AI from building those!

Offline Otto Halfhand

  • Donor
  • Mr. Spam
  • *
  • Posts: 1166
    • View Profile
Re: 'Controlling' the AI
« Reply #28 on: August 23, 2012, 02:50:30 AM »
Hey jojo give viruzz jar.scar.  I don't think its a sectret.
孫 The
EF_v1.7.10
子 Art
Illegitimi non Carborundum -"Vinegar" Joe Stilwell
兵 of
Sun Tzu says: In warfare one compels and is not compelled by others
法 War

Offline viruz777

  • Ingenery
  • *
  • Posts: 46
    • View Profile
Re: 'Controlling' the AI
« Reply #29 on: August 23, 2012, 01:27:26 PM »
What's a jar.scar?  ???