Making Hard AI, hard?

Discussion about the game and its default mods.
djwhitfield
Posts: 4
Joined: Sat Apr 14, 2012 6:48 pm

Making Hard AI, hard?

Post by djwhitfield »

Is there a way to make the Hard AI hard?

I played against 8 or 10 Hard AIs with two friends and they were simply too easy.
We expected 3 AIs to be enough, fighting one each. But 8 or 10 Hard AIs is still too easy for us. Any suggestions please?

psydev
Posts: 84
Joined: Sat Mar 31, 2012 4:49 am

Post by psydev »

on that note, can we please have a new AI for CNC, other than "easy bot"?

earthpig
Posts: 31
Joined: Sat Apr 21, 2012 1:10 am

Post by earthpig »

It's actually pretty easy to tweak some values and get different behavior.

open this in a text editor:

openra/mods/ra/rules/system.yaml

(er... probably c:\program files\openra\moda\ra\rules\system.yaml for you windows folks)

copy and paste the lines from "HackyAI@HardAI:" to "SquadSize", so you've not got two HardAIs.

change "@HardAI" to "@myTestAI" and give it a name such as "Name:my AI" (if you have two that are named HardAI, it'll crash on startup).

To see what the things under "BuildingFractions" and "UnitsToBuild" are, open up structures.yaml, infantry.yaml, and vehicles.yaml and look around. It's fairly self-documenting.

It is very easy to tweak these values and get different behavior, it is NOT however very easy to make the AI actually harder.

If you cut down on proc (ore processing facility) for example, the AI gets a very slow start early on in the game.

Here is something y'all may find interesting: Just as I was typing this, a bot that I've been tweaking attacked me... with aircraft!

EDIT: And that AI only built 4 ore refineries, too. :)

earthpig
Posts: 31
Joined: Sat Apr 21, 2012 1:10 am

Post by earthpig »

grrrr... last game I got strafed by an AI (first time I ever managed to make it do that, got excited) and this game both the soviet and allied bot are sitting their with aircraft on the pad/field and doing nothing with them.

User avatar
zypres1
Posts: 277
Joined: Mon Oct 24, 2011 8:22 pm

Hard AI

Post by zypres1 »

There are 2 ways of making AI harder.
In yaml in your maps you can also change what they are supposed to build, for each map.
They rotate in order in what to buid.

Questions:
1: what is harder, bigger squad size or smaller? Seems like it depends when in game it is..
2: https://github.com/OpenRA/OpenRA/issues/2014 would make the Ai harder, if you can limit on how many ore refins they are allowed to build.. Comment on it if you agree

earthpig
Posts: 31
Joined: Sat Apr 21, 2012 1:10 am

Re: Hard AI

Post by earthpig »

zypres1 wrote: 1: what is harder, bigger squad size or smaller? Seems like it depends when in game it is..
Early in the game, smaller is harder. Later in the game, larger is harder.

For #1. I'm working on making it so the squad size that is sent is pseudo random, but still trends towards squadsize: https://github.com/OpenRA/OpenRA/issues/2048

I haven't gotten around to fixing what head honcho wants fixed in the code, but I will at some point.

User avatar
zypres1
Posts: 277
Joined: Mon Oct 24, 2011 8:22 pm

thank you

Post by zypres1 »

Thank you for fixing this, Earthpig..

Matt
Posts: 1146
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Challenge accepted!

Post by Matt »

I created an AI with optimized build order that currently beats all available bots. Put this into your mods/ra/rules/system.yaml:

Code: Select all

	HackyAI@OptiAI:
		Name:Optimized AI
		BuildingFractions:
			proc: 25.1%
			powr: 35%
			tent: 0.1%
			barr: 0.1%
			weap: 0.1%
			fix: 0.1%
			dome: 0.1%
			atek: 0.1%
			stek: 0.1%
		UnitsToBuild:
			e1: 50%
			e2: 1%
			e3: 10%
			medi: 1%
			apc: 10%
			jeep: 10%
			ftrk: 25%
			1tnk: 25%
			2tnk: 50%
			3tnk: 75%
			4tnk: 100%
			arty: 30%
			v2rl: 30%
		SquadSize: 10
It builds less refinerys (it seems to stop at 5 in the end game, but builds the second one early after the barracks) and can spend therefore more money for units. It techs faster, but only builds each production building once (not 3 radar domes). It also builds more advanced units (Mammoth tanks and medics) which can give favor to it in battles. The attacks are still a little careful stopping at the base entry hunting harvesters down and using artillery to bomb down base defend buildings, but this seems to be the attack waypoint code. It won't build any turrets to become more offensive and because the placement algorithm is not very clever at the moment. https://github.com/OpenRA/OpenRA/issues/2064

Generalcamo
Posts: 50
Joined: Sun Sep 26, 2010 12:06 am

Post by Generalcamo »

Hopefully I can improve that AI by adding the ability to build hero units.

Matt
Posts: 1146
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

Generalcamo wrote: Hopefully I can improve that AI by adding the ability to build hero units.
That is easy: just add e7 to units to build, but I doubt he will use C4 on buildings.

earthpig
Posts: 31
Joined: Sat Apr 21, 2012 1:10 am

Re: Challenge accepted!

Post by earthpig »

Cmd. Matt wrote: I created an AI with optimized build order that currently beats all available bots. Put this into your mods/ra/rules/system.yaml:

Code: Select all

	HackyAI@OptiAI:
		Name:Optimized AI
		BuildingFractions:
...
			v2rl: 30%
		SquadSize: 10
It builds less refinerys (it seems to stop at 5 in the end game, but builds the second one early after the barracks) and can spend therefore more money for units. It techs faster, but only builds each production building once (not 3 radar domes). It also builds more advanced units (Mammoth tanks and medics) which can give favor to it in battles. The attacks are still a little careful stopping at the base entry hunting harvesters down and using artillery to bomb down base defend buildings, but this seems to be the attack waypoint code. It won't build any turrets to become more offensive and because the placement algorithm is not very clever at the moment. https://github.com/OpenRA/OpenRA/issues/2064
Call it Matt AI (or some other cooler name - I went with famous WW2 dudes for the "Rommel AI" and "Zhukov AI" that you now see, but Patton and Monty remain unclaimed) and submit it to the bug tracker.

Matt
Posts: 1146
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

Maybe all bots could get this new build order. If not then I will submit it as Eisenhower AI.

Another thing: at the end the bots seems to build the last building in the list multiple times even though it is just 0.1%. Maybe the power plant should be last so he won't waste money on another radar dome or tech center.

They also don't care too much about percentage in UnitsToBuild as medi: 1% will result in ~50% medics.

earthpig
Posts: 31
Joined: Sat Apr 21, 2012 1:10 am

Post by earthpig »

I'd suggest going with a new AI rather than replacing anything that already exists. Then me (and others) can look at yours, experiment, synthesize, etc.

Matt
Posts: 1146
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

I added a patch at https://github.com/OpenRA/OpenRA/issues/2204 All my github branches are full of other stuff so I can't get a clean pull request. Now also with heroe units to fulfill Generalcamos wish. However he builds too many Tanyas ignoring the 0.01% setting (it's more like 30%).

User avatar
zypres1
Posts: 277
Joined: Mon Oct 24, 2011 8:22 pm

Post by zypres1 »

Please come back to help Valkirie.. He needs yaml help

Post Reply