EFEastern Front Forum Archive
Read-only public archive · no login or tracking

Archived topic · 72 posts

'Controlling' the AI

General Discussion

#129791

'Controlling' the AI

I really doubt this will work but is it actually possible to sort of 'control' what doctrines and what units the AI can roll out? For instance if I wanted them to roll out Jagdpanzers instead of hetzers, and if I wanted them to roll out Jagdtigers instead of Jagdpanthers, or if I wanted PE AI to choose Tank Destroyer doctrine, or if I wanted Wehr AI to choose Blitzkrieg doctrine.

Would this be at all possible? The reason is because I want to sort of experiment with some builds and counters and sort of enjoy doing it at my pace, without being harassed or kited by annoying nebels and mortar halftracks and also without having to restart the game everytime I don't get the desired AI doctrine to fight against.
#129848

Re: 'Controlling' the AI

Nothing? Just silent viewers coming and going?  :'(
#129849

Re: 'Controlling' the AI

I honestly don't know the answer to this so I can't say. IDK if that makes u feel any better :P
Forum post image
Om Nom Nom Nom
"Panzer-Guppy ready for battle!"
"Ha Ha Ha! We have the ZEAL!"
"Grenadiers! Fall In!!"
#129851

Re: 'Controlling' the AI

If you want controlled play, best way is VS another player. The AI can't be controlled to physically build the exact order you want it to. We have AI experts working on reprogramming the new AI but they probably won't be able to make build orders checked/unchecked by the player, probably selected at random.
"Balancers are 10 a penny"
#129853

Re: 'Controlling' the AI

Sir wrote:
I honestly don't know the answer to this so I can't say. IDK if that makes u feel any better :P


Well at least you popped by and said something about it so it does make me feel better to know that it's not fallen on deaf ears :)
#129855

Re: 'Controlling' the AI

Cranialwizard wrote:
If you want controlled play, best way is VS another player. The AI can't be controlled to physically build the exact order you want it to. We have AI experts working on reprogramming the new AI but they probably won't be able to make build orders checked/unchecked by the player, probably selected at random.


I'm just the sort of person who enjoys casual play with AI. Playing with another player just seems abit daunting to me so I hope you understand :) I'm not exactly looking for the AI to build the exact build order or anything because I notice that they dynamically change it every now and then. I was just wondering if there was a possibility to sort of disable AI from building artillery/long range units like mortar halftracks/nebels.

Alternatively, is it possible to sort of create preset AI doctrines where you can choose what doctrine they will play? Sort of like CNC3 where you could choose AI behaviour (eg. Steamroller had them rolling armor only whilst Guerilla had a mix but mostly hit + run + stealthy play). I would very much like to fight vs wehr Blitzkrieg and PE Tank Destroyer Doctrines and not always have to restart game and see if I get lucky and get what I want to fight against.

Also, is it possible for the customize army menu to affect the AI as well? For example if I check Jagdpanther tanks then AI can't build Hetzers, or if I uncheck Geschutzwagen then they stick to building Stug IV?
#129856

Re: 'Controlling' the AI

IIRC AI has a 40% chance of picking reward units, regardless if you've checked them or not. Controlling whether the AI can do it? Take it up with the AI coders :P
Forum post image
Om Nom Nom Nom
"Panzer-Guppy ready for battle!"
"Ha Ha Ha! We have the ZEAL!"
"Grenadiers! Fall In!!"
#129858

Re: 'Controlling' the AI

Hi,

QuoteI was just wondering if there was a possibility to sort of disable AI from building artillery/long range units like mortar halftracks/nebels.

Yes there is. You need to comment few lines will write which ones when i will have more time(in day or two ;) ).

Quote I would very much like to fight vs wehr Blitzkrieg and PE Tank Destroyer Doctrines and not always have to restart game and see if I get lucky and get what I want to fight against.

Yes it is possible. Same as above :).

QuoteIIRC AI has a 40% chance of picking reward units

It was before but now AI can take 1...n reward units means Wehr AI could take only Geshutzewagen or only schwimmwagen or both.

To make it simple.
AI goes through all reward units and takes 50% chances that AI will choose reward unit.
Before it was all reward units or none.

Hope it helps.
#129859

Re: 'Controlling' the AI

Wow an AI coder has emerged! Thanks for clearing this up and it's really good to know that these things are actually possible  :D

However, what do you mean when you say
Quote
QuoteI was just wondering if there was a possibility to sort of disable AI from building artillery/long range units like mortar halftracks/nebels.

Yes there is. You need to comment few lines will write which ones when i will have more time(in day or two ;) ).


Do you mean I need to say here which artillery/long range units I don't want AI to build and use against me or are you in the process of already adding this feature?

Quote
Quote I would very much like to fight vs wehr Blitzkrieg and PE Tank Destroyer Doctrines and not always have to restart game and see if I get lucky and get what I want to fight against.

Yes it is possible. Same as above :).

So does this mean that you are in the middle of doing this feature and I'll be able to choose which AI doctrine to fight?


QuoteTo make it simple.
AI goes through all reward units and takes 50% chances that AI will choose reward unit.
Before it was all reward units or none.

Whenever I got to fight PE Tank Destroyer Doctrine, 1/10 times they build jagdpanzer against me. The rest is ALWAYS hetzer :( that's why I wish I could sort of choose what units AI can build, whether I want to fight Jagdpanther/Jagdtiger or Hetzer/Jagdpanzer.
#129862

Re: 'Controlling' the AI

A wild jojorabbit has appeared!

jojorabbit uses explanation.

It's not very effective...

jojorabbit flees.

I guess he means to tell you he will write here what lines pertain to your question and tell you how to mod it yourself to get the situation you're after. You'll be able to tell the AI exactly what you want it to build.
If you get into an argument with me, you're wrong.

Last edited August 18, 2012 at 3:31 AM by GodlikeDennis

#129868

Re: 'Controlling' the AI

Hahahaha thanks very much it really clears things up for me. Looking forward to be able to play it customised to my taste. One thing though, am I really allowed to modify the game files that you guys have worked hard for? And what if a new update rolls and the EF launcher can't update it properly because the modded files messed it up?
#129871

Re: 'Controlling' the AI

QuoteDo you mean I need to say here which artillery/long range units I don't want AI to build and use against me or are you in the process of already adding this feature?

I mean you can turn off some units for AI (just for your testing or whatever you r doing), am not adding that feature am trying to turn on all units for AI like vampires, halftracks etc etc...

You can comment, discuss some stuff about AI here: http://www.easternfront.org/forums/index.php?topic=7958.0
Or gamemodes here: http://www.easternfront.org/forums/index.php?topic=8058.0

QuoteSo does this mean that you are in the middle of doing this feature and I'll be able to choose which AI doctrine to fight?

No, am will explain you what files you need to edit to remove other doctrines so AI will always choose Tank Destroyer or Blitz.

QuoteWhenever I got to fight PE Tank Destroyer Doctrine, 1/10 times they build jagdpanzer against me. The rest is ALWAYS hetzer that's why I wish I could sort of choose what units AI can build, whether I want to fight Jagdpanther/Jagdtiger or Hetzer/Jagdpanzer.

I wont explain this it is fixed in internal version as i told post ago, sometimes AI will choose 1...n units. You cant tell AI what units too build in late game, well you could make some sort of your AI mod  ;D.

QuoteOne thing though, am I really allowed to modify the game files that you guys have worked hard for? And what if a new update rolls and the EF launcher can't update it properly because the modded files messed it up?

If new update rolls out and you mess something up, you can always re-install  :P.
#129878

Re: 'Controlling' the AI

Quote
QuoteSo does this mean that you are in the middle of doing this feature and I'll be able to choose which AI doctrine to fight?

No, am will explain you what files you need to edit to remove other doctrines so AI will always choose Tank Destroyer or Blitz.

Ok I look forward to you teaching me what to do when you're free :). Will you PM or post here?

Quote
QuoteWhenever I got to fight PE Tank Destroyer Doctrine, 1/10 times they build jagdpanzer against me. The rest is ALWAYS hetzer that's why I wish I could sort of choose what units AI can build, whether I want to fight Jagdpanther/Jagdtiger or Hetzer/Jagdpanzer.

I wont explain this it is fixed in internal version as i told post ago, sometimes AI will choose 1...n units. You cant tell AI what units too build in late game, well you could make some sort of your AI mod  ;D.

So it is not possible to edit AI to build Jagdpanzer only and not Hetzer? Like how you said can stop AI from building artillery/mortars? Nah I wouldn't want to spend so much time making my own mod. I just want to custom these few things only that I've mentioned already that's all ;)

Quote
QuoteOne thing though, am I really allowed to modify the game files that you guys have worked hard for? And what if a new update rolls and the EF launcher can't update it properly because the modded files messed it up?

If new update rolls out and you mess something up, you can always re-install  :P.

Re-install then re-edit the AI lines and it will still work?
#130223

Re: 'Controlling' the AI

Any news on when I'll be able to learn what I need to do jojorabbit?
#130224

Re: 'Controlling' the AI

You'll find EF doesn't work as fast as most ppl like :P. Give him time
Forum post image
Om Nom Nom Nom
"Panzer-Guppy ready for battle!"
"Ha Ha Ha! We have the ZEAL!"
"Grenadiers! Fall In!!"
#130235

Re: 'Controlling' the AI

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:


	-------------------------------------------------------
	-- 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 edited August 22, 2012 at 12:22 AM by jojorabbit

#130237

Re: 'Controlling' the AI

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

[b] 法 War
#130243

Re: 'Controlling' the AI

jojorabbit wrote:
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:


	-------------------------------------------------------
	-- 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 edited August 22, 2012 at 10:21 PM by jojorabbit

#130245

Re: 'Controlling' the AI

Otto wrote:
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,
#130250

Re: 'Controlling' the AI

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!
#130283

Re: 'Controlling' the AI

viruz777 wrote:
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:
Forum post 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.

QuoteAnyway, 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.
#130293

Re: 'Controlling' the AI

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

[b] 法 War
#130342

Re: 'Controlling' the AI

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 edited August 22, 2012 at 6:36 PM by viruz777

#130369

Re: 'Controlling' the AI

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.
#130389

Re: 'Controlling' the AI

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...
#130391

Re: 'Controlling' the AI

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?
#130393

Re: 'Controlling' the AI

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
#130394

Re: 'Controlling' the AI

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!
#130396

Re: 'Controlling' the AI

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

[b] 法 War
#130412

Re: 'Controlling' the AI

What's a jar.scar?  ???
#130413

Re: 'Controlling' the AI

viruz777 wrote:
What's a jar.scar?  ???


This :D, It is code that fixes reward units for AI so AI chooses 0....n reward units. Before it was all or none :P.

Here is code i will attach file later.
Just import it in scarUtil.scar and put in folder with scarUtil, ref: ..\Eastern_Front\Data\scar, script will be automatically activated when you import it. You can see output in console.


----------------------------------------------------------------
-- THIS SCRIPT WAS WRITTEN BY: jojorabbit
----------------------------------------------------------------
-- Fix for AI using reward units aka jojorabbit`s AI reward unit fix aka jar
----------------------------------------------------------------
-- @author: jojorabbit
-- @version: v 1.0 b270412
-- @filename: jar.scar
-- This file fixes AI usage of reward units, in vCoH ai uses all or none reward units
-- If you are gonna use this with other mod give me credits
----------------------------------------------------------------


----------------------------------------------------------------
-- REFERENCE
----------------------------------------------------------------
-- ALLIED UPGRADES
-- upgrade\upgrade_allied_105.lua
-- upgrade\upgrade_allied_hellcat.lua
-- upgrade\upgrade_allied_jumbo.lua
-- upgrade\upgrade_allied_staghound.lua

--  AXIS UPGRADES
-- upgrade\upgrade_axis_geschutzwagen.lua
-- upgrade\upgrade_axis_schwimmwagen.lua
-- upgrade\upgrade_axis_tiger_ace.rgd
-- upgrade\upgrade_axis_officer.rgd

-- COMMONWEALTH UPGRADES
-- upgrade\upgrade_british_comet.lua
-- upgrade\upgrade_british_kangaroo.lua
-- upgrade\upgrade_british_staghound.lua
-- upgrade\upgrade_british_sas.lua -- THIS IS/(WILL BE) HANDLED IN aiutil.scar

-- PANZER ELITE UPGRADES
-- upgrade\upgrade_panzer_elite_hotchkiss.lua
-- upgrade\upgrade_panzer_elite_jagdpanzer.lua
-- upgrade\upgrade_panzer_elite_jagdtiger.lua
-- upgrade\upgrade_panzer_elite_schwimmwagen.lua
-- upgrade\upgrade_panzer_elite_nashorn.rgd

-- SOVIET UPGRADES
-- upgrade\upgrade_soviets_is3
-- upgrade\upgrade_soviets_kv1
-- upgrade\upgrade_soviets_su_122.rgd

-- OSTHEER UPGRADES
-- NONE TILL IT IS FINISHED

----------------------------------------------------------------
-- INIT
----------------------------------------------------------------
function OnInit()
	print("JAR Init")
	AddRewardUnitsToAIPlayers()
end

Scar_AddInit(OnInit)

----------------------------------------------------------------
-- CONSTANTS
----------------------------------------------------------------
isDebug = true -- turn on/off logging

-- ALLIES
R_ALLIES_SHERMAN_105 = BP_GetUpgradeBlueprint("upgrade/upgrade_allied_105.lua")
R_ALLIES_HELLCAT = BP_GetUpgradeBlueprint("upgrade/upgrade_allied_hellcat.lua")
R_ALLIES_SHERMAN_JUMBO = BP_GetUpgradeBlueprint("upgrade/upgrade_allied_jumbo.lua")
R_ALLIES_STAGHOUND = BP_GetUpgradeBlueprint("upgrade/upgrade_allied_staghound.lua")

ALLIES_REWARD_UNITS = {
	R_ALLIES_SHERMAN_105,
	R_ALLIES_HELLCAT,
	R_ALLIES_SHERMAN_JUMBO,
	R_ALLIES_STAGHOUND,
}

-- AXIS
R_AXIS_GESCHUTZEWAGEN = BP_GetUpgradeBlueprint("upgrade/upgrade_axis_geschutzwagen.lua")
R_AXIS_SCHWIMMWAGEN = BP_GetUpgradeBlueprint("upgrade/upgrade_axis_schwimmwagen.lua")
R_AXIS_TIGER_ACE = BP_GetUpgradeBlueprint("upgrade/upgrade_axis_tiger_ace.lua")
R_AXIS_LW_OFFICIER = BP_GetUpgradeBlueprint("upgrade/upgrade_axis_officer.lua")

-- table
AXIS_REWARD_UNITS = {
	R_AXIS_GESCHUTZEWAGEN,
	R_AXIS_SCHWIMMWAGEN,
	R_AXIS_TIGER_ACE,
	R_AXIS_LW_OFFICIER,
}
-- COMMONWEALTH
R_CW_COMET = BP_GetUpgradeBlueprint("upgrade/upgrade_british_comet.lua")
R_CW_KANGAROO = BP_GetUpgradeBlueprint("upgrade/upgrade_british_kangaroo.lua")
R_CW_STAGHOUND = BP_GetUpgradeBlueprint("upgrade/upgrade_british_staghound.lua")

CW_REWARD_UNITS = {
	R_CW_COMET,
	R_CW_KANGAROO,
	R_CW_STAGHOUND,
}
-- PE
R_PE_HOTCHKISS = BP_GetUpgradeBlueprint("upgrade/upgrade_panzer_elite_hotchkiss.lua")
R_PE_JAGDPANZER = BP_GetUpgradeBlueprint("upgrade/upgrade_panzer_elite_jagdpanzer.lua")
R_PE_JAGDTIGER = BP_GetUpgradeBlueprint("upgrade/upgrade_panzer_elite_jagdtiger.lua")
R_PE_SCHWIMMWAGEN = BP_GetUpgradeBlueprint("upgrade/upgrade_panzer_elite_schwimmwagen.lua")
R_PE_NASHORN = BP_GetUpgradeBlueprint("upgrade/upgrade_panzer_elite_nashorn.lua")

PE_REWARD_UNITS = {
	R_PE_HOTCHKISS,
	R_PE_JAGDPANZER,
	R_PE_JAGDTIGER,
	R_PE_SCHWIMMWAGEN,
	R_PE_NASHORN,
}
-- SOV
R_SOV_IS3 = BP_GetUpgradeBlueprint("upgrade/upgrade_soviets_is3.lua")
R_SOV_KV1 = BP_GetUpgradeBlueprint("upgrade/upgrade_soviets_kv1.lua")
R_SOV_SU122 = BP_GetUpgradeBlueprint("upgrade/upgrade_soviets_su_122.lua")

SOVIET_REWARD_UNITS = {
	R_SOV_IS3,
	R_SOV_KV1,
	R_SOV_SU122,
}
-- OST


----------------------------------------------------------------
-- METHODS
----------------------------------------------------------------
function AddRewardUnitsToAIPlayers()
	for i = 1, World_GetPlayerCount() do
		local player = World_GetPlayerAt(i)
		-- only for AI players
		if(AI_IsEnabled(player)) then
			local race = Player_GetRaceName(player)

			LogOutput("AI race= "..race)

			-- ALLIES
			if(race == TRACE_ALLIES) then
				rewardTable = ALLIES_REWARD_UNITS
			-- AXIS
			elseif(race == TRACE_AXIS) then
				rewardTable = AXIS_REWARD_UNITS
			-- CW
			elseif(race == TRACE_ALLIES_COMMONWEALTH) then
				rewardTable = CW_REWARD_UNITS
			-- PE
			elseif(race == TRACE_AXIS_PANZER_ELITE) then
				rewardTable = PE_REWARD_UNITS
			-- SOV
			elseif(race == TRACE_ALLIES_SOVIETS) then
				rewardTable = SOVIET_REWARD_UNITS
			-- OST
			end

			if(rewardTable ~= nil) then
				LogOutput("rewardtable size "..#rewardTable)
				ApplyRewardUnits(player, rewardTable)
			end
		end
	end
end


function ApplyRewardUnits(player, rewardTable)
--~ 	local rndTable = Table_GetRandomItem()
	local randomTest = World_GetRand(1, 100)
	LogOutput("Test: rnd= "..randomTest)

	for n = 1, table.getn(rewardTable) do
		local rnd = World_GetRand(1, 100)
		LogOutput("Test: "..n.." rnd= "..rnd)
		if((rnd % 2) == 0) then
			LogOutput("Activating - "..BP_GetName(rewardTable[n]))
			Command_PlayerUpgrade(player, rewardTable[n], true, false)
		end
	end
end

function LogOutput(message)
	if(isDebug) then
		print(message)
	end
end


Note: part of ScarUtil.scar code:


...
import("NIS.scar")
import("Debugger.scar")
import("GarrisonBuilding.scar")
import("jar.scar")
...
#130414

Re: 'Controlling' the AI

Excellent! so if I download attached file and put it in folder - what will happen? Abit confused on how this works since I don't really understand your explanation sorry xD This will affect if AI will choose to build Jagdpanzer and not Hetzer?

Also what about my earlier issue with command_tree_pref? Did you manage to see my attached file and see if I did anything wrong? Please help me on that. :-*
#130421

Re: 'Controlling' the AI

Still testing that issue jojo?  ;)
#130429

Re: 'Controlling' the AI

viruzz upload the file for your command_tree issue here. I don't have time to futz with a rapidshare account right now. I can give you a looksee while jojo is fishing/working

孫 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

[b] 法 War
#130436

Re: 'Controlling' the AI

Oops I didn't know this forum had the option to upload attachments that's why i did it through rapidshare. Now I've found it and here you go!
#130447

Re: 'Controlling' the AI

viruz777 wrote:
Excellent! so if I download attached file and put it in folder - what will happen? Abit confused on how this works since I don't really understand your explanation sorry xD This will affect if AI will choose to build Jagdpanzer and not Hetzer?

Also what about my earlier issue with command_tree_pref? Did you manage to see my attached file and see if I did anything wrong? Please help me on that. :-*


0...n it is simple math explanation or [0,n] :D, to make it simple, before this file AI used all reward units or none. With this file AI will use sometimes 0, sometimes only 1 reward unit, like only geshutzewagen, sometimes only 2 like offiecer and schwimmwagen, etc... for PE it means AI could choose jagdpanzers and jagtiger or only jagdpanzers, or only nashorn.
So sometimes AI will attack you with jagdpanzers and jagdpanther, sometimes hetzer and jagdtiger etc etc....

Conclusion it makes AI more human alike cuz some ppl choose only some units :P.
Hope it helps.

I will help you dont worry i just dont have so much time to test and see everything in one day.
#130495

Re: 'Controlling' the AI

Ahhh I see what you mean now that explains it better thanks jojo ^^ So will this file improve the chance that AI will build Jagdpanzer instead of Hetzer? Or is it still 50/50 chance? There's really no way at all to make AI 100% build Jagdpanzer instead of Hetzer by editing this file?

Again I really appreciate the time you're taking and the help you're giving me in teaching a noob like me jojo. I don't mean to sound impatient but I'm sorry if I gave you that impression. It's just that when I get started on a new piece of work that I have no experience on, I am eager to learn and move forward. So since I am stuck with this error/AI still building other doctrines I get frustrated that something went wrong and I want to know how to fix it otherwise I feel unsettled like work is unfinished. Hope you understand how I feel ^^
#130497

Re: 'Controlling' the AI

viruz777 wrote:
Ahhh I see what you mean now that explains it better thanks jojo ^^ So will this file improve the chance that AI will build Jagdpanzer instead of Hetzer? Or is it still 50/50 chance? There's really no way at all to make AI 100% build Jagdpanzer instead of Hetzer by editing this file?

Again I really appreciate the time you're taking and the help you're giving me in teaching a noob like me jojo. I don't mean to sound impatient but I'm sorry if I gave you that impression. It's just that when I get started on a new piece of work that I have no experience on, I am eager to learn and move forward. So since I am stuck with this error/AI still building other doctrines I get frustrated that something went wrong and I want to know how to fix it otherwise I feel unsettled like work is unfinished. Hope you understand how I feel ^^


To make 100% just comment 2 lines in for loop:

it needs to look like this:
Quote
for n = 1, table.getn(rewardTable) do
local rnd = World_GetRand(1, 100)
LogOutput("Test: "..n.." rnd= "..rnd)
--if((rnd % 2) == 0) then -> this is commented -> %2 basically means 50%-50% chances
LogOutput("Activating - "..BP_GetName(rewardTable[n]))
Command_PlayerUpgrade(player, rewardTable[n], true, false)
--end -> this is commented
end


With those 2 lines commented AI will always use reward units.
Hope it helps.

I know the feeling making and programming AI is painful i know. Will try to resolve doctrines asap.
#130502

Re: 'Controlling' the AI

Hmm if that's the case then I think I will still have to keep restarting in order to get to fight the units I want. If I make AI choose 100% reward units then it's great that PE will definitely choose jagdtiger and jagdpanzer to fight me but I usually fight 1v2 Expert AI with 1 Wehr and 1 PE. The wehr AI will not build stug IV but Geschutzwagen instead which will be another long range headache -_-

So to explain it simply, having AI choose 100% reward units won't be good and having AI 100% not choose reward units is also not good so I will have to stick with 50/50 chance in order to get the units I want. What I thought would be possible is just to single out AI to use jagdpanzer only not hetzer and the rest of the reward units can stay normal but I guess this is not possible since earlier in the thread you said it is not possible to force AI to build what you want, even though it's a single reward unit like Jagdpanzer instead of Hetzer, since it is all or nothing am I correct? ^^

Anyway let me know when you've resolved it then we can move on to next step in preventing AI from building long range units + artillery. If you want to know the reason I am doing all this to give you a better understanding is because I love tank vs tank battles especially heavy tanks like Tiger, Pershing, IS-2 etc which is why I feel long range units spoil the fun if you know what I mean. Thanks jojo!
#130524

Re: 'Controlling' the AI

QuoteSo to explain it simply, having AI choose 100% reward units won't be good and having AI 100% not choose reward units is also not good so I will have to stick with 50/50 chance in order to get the units I want. What I thought would be possible is just to single out AI to use jagdpanzer only not hetzer and the rest of the reward units can stay normal but I guess this is not possible since earlier in the thread you said it is not possible to force AI to build what you want, even though it's a single reward unit like Jagdpanzer instead of Hetzer, since it is all or nothing am I correct? ^^


That is purpose of the file that AI is more human alike sometimes 1reward, sometimes 2 etc etc, so it is not all or nothing.
But it is possible to force PE to use jagdpanzer reward and WH not to use geschutzwagen reward :P. You just need to modify file a little bit :P.

By commenting one line you can easy turn off WH reward units :P.

Quote
if(race == TRACE_ALLIES) then
rewardTable = ALLIES_REWARD_UNITS
-- AXIS
elseif(race == TRACE_AXIS) then
-- rewardTable = AXIS_REWARD_UNITS -> this needs to be commented.
        -- CW
elseif(race == TRACE_ALLIES_COMMONWEALTH) then
rewardTable = CW_REWARD_UNITS
-- PE


Here is part of code that should force PE to use Tank_Destroyer, And Wehr to use Blitz, i did not had much time to test it, so if it does not work inform me so i can speed up testing:
Quote
-- AXIS
elseif(race == TRACE_AXIS) then
--rewardTable = AXIS_REWARD_UNITS -- commented cuz STUG IV
UI_ForceCommanderTreeChoice(player, COMMANDER_TREE.AXIS.BLITZKRIEG) -- this is added
-- CW
elseif(race == TRACE_ALLIES_COMMONWEALTH) then
rewardTable = CW_REWARD_UNITS
-- PE
elseif(race == TRACE_AXIS_PANZER_ELITE) then
rewardTable = PE_REWARD_UNITS
UI_ForceCommanderTreeChoice(player, COMMANDER_TREE.ELITE.TANK_DESTROYER) -- force tank d.


Hope it helps.

Last edited August 24, 2012 at 8:51 PM by jojorabbit

#130528

Re: 'Controlling' the AI

Haha you should have said so sooner that I can actually still modify it. From the way you make it sound in 1st page of the thread I thought it was not possible:

QuoteIt was before but now AI can take 1...n reward units means Wehr AI could take only Geshutzewagen or only schwimmwagen or both.

To make it simple.
AI goes through all reward units and takes 50% chances that AI will choose reward unit.
Before it was all reward units or none.


and

QuoteI wont explain this it is fixed in internal version as i told post ago, sometimes AI will choose 1...n units. You cant tell AI what units too build in late game, well you could make some sort of your AI mod


Based on what you said I thought it's just 3 options = 100%, 0% reward units or your modded code of 50%. I can't really test it now since I still can't set command_tree_pref.ai to choose that doctrine to see if I use the jar.scar with the commented line works. But it's really great to know that all this is possible when I first thought I could never really get the kind of AI I want. Thanks again jojo! :)
#130529

Re: 'Controlling' the AI


Quote
-- AXIS
elseif(race == TRACE_AXIS) then
--rewardTable = AXIS_REWARD_UNITS -- commented cuz STUG IV
UI_ForceCommanderTreeChoice(player, COMMANDER_TREE.AXIS.BLITZKRIEG) -- this is added
-- CW
elseif(race == TRACE_ALLIES_COMMONWEALTH) then
rewardTable = CW_REWARD_UNITS
-- PE
elseif(race == TRACE_AXIS_PANZER_ELITE) then
rewardTable = PE_REWARD_UNITS
UI_ForceCommanderTreeChoice(player, COMMANDER_TREE.ELITE.TANK_DESTROYER) -- force tank d.


Oh I see you added new line of code! Is this in the jar.scar file that you sent me or in command_tree_pref.ai? The code looks different from the first file you told me to work on. So what will I do with the modified command_tree_pref.ai file?
#130531

Re: 'Controlling' the AI

QuoteOh I see you added new line of code! Is this in the jar.scar file that you sent me or in command_tree_pref.ai? The code looks different from the first file you told me to work on. So what will I do with the modified command_tree_pref.ai file?


Yes all code i told you to modifiy is jar.scar.
Remove that modified command_tree_pref.ai and use old one :P.
#130537

Re: 'Controlling' the AI

Jojo do I just copy paste the whole modified jar.scar into ..\Eastern_Front\Data\scar or do I copy the entire text and paste at bottom of scarUtil.scar?
#130538

Re: 'Controlling' the AI

Hi jojo I copy pasted the edited jar.scar into /scar folder as you instructed. I also copied the entire text and pasted at the bottom of scarutil.scar and also added import "jar.scar" inside there. (if that is what you mean by import it in scarUtil.scar)

It still gave Fatal Scar Error - Execution paused.

here is screenshot :

Forum post image



I think it has something to do with the added lines of the command tree? Please help what should I do now?

Last edited August 25, 2012 at 12:34 AM by viruz777

#130575

Re: 'Controlling' the AI

viruz777 wrote:
Jojo do I just copy paste the whole modified jar.scar into ..\Eastern_Front\Data\scar or do I copy the entire text and paste at bottom of scarUtil.scar?


Hm, am not sure what entire text, i said edit jar.scar and all bolded is what needs to be added or commented.

Only thing you need to do with scarUtil is to add import of jar.scar after all other imports at begging of the file :).
If you get same error then i will make you new jar.scar and new scarUtil.scar and upload it here, when i will have more free time.
#130582

Re: 'Controlling' the AI

Ok jojo I see what you mean. Just copy edited jar.scar and paste into /scar folder, then add "import jar scar" line after garrisonbuilding.scar.

I did it already and got the same error. Did you see the screenshot of the error in console? Do you know what is causing that error or if it's something that I'm doing wrong?

Anyway yes I'd appreciate you send me the new jar.scar and new scarUtil.scar when you can :) unless it is something easily fixable on my end. Just let me know what to do next.
#130684

Re: 'Controlling' the AI

Here are files. PE will always use reward units, and always Tank Destroyer Doctrine. Wehr will never use reward units and always Blitzkrieg Doctrine.

Hope it helps.

EDIT: Also you can see new PE Tank Destroyer Trees here :P
http://www.easternfront.org/forums/index.php?topic=8569.msg130646#msg130646

Last edited August 26, 2012 at 12:02 PM by jojorabbit

#130708

Re: 'Controlling' the AI

Haha thanks jojo I'll try it later and hope it works.

Yes I saw that update on facebook and even commented there giving credit to you and thanking you for your help in helping me mod AI :D
#130711

Re: 'Controlling' the AI

It works i have tested it ;).
No problem, if you need anything else you know where to find me.
I dont like fb, i never used it and i dont plan to use it.