[DEV] BetaAI | TOTAL REDO ?

Improvements and ideas

Discussion about the game and its default mods.
Matt
Posts: 1144
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

That is great. I directed some people to your thread to help you tweak the settings you exposed to yaml configuration files. Does this also mean that you support the other mods now if someone updates the yaml accordingly? Might have the time to play around with this in some months or so.

Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

Excellent work, I might play around with my own AI (based on your code probably). Could have some AI development competitions (one's AI versus another's AI duking it out), though my mod has production speed multipliers if you build additional factories of a type. :shifty:

Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

Here's a crash I got running the AI:

Code: Select all

Exception of type `System.InvalidOperationException`: Attempted to get trait from destroyed object (e1 215 (not in world))
   at OpenRA.TraitDictionary.CheckDestroyed(Actor actor)
   at OpenRA.TraitDictionary.Contains[T](Actor actor)
   at OpenRA.Actor.HasTrait[T]()
   at OpenRA.Mods.RA.Classic.AI.Squad.React()
   at OpenRA.Mods.RA.Classic.AI.BetaAI.AssignRolesToUnits(Actor playeractor)
   at OpenRA.Mods.RA.Classic.AI.BetaAI.Tick(Actor self)
   at OpenRA.World.<Tick>b__7&#40;TraitPair`1 x&#41;
   at OpenRA.WorldUtils.<>c__DisplayClass18`1.<DoTimed>b__17&#40;T x&#41;
   at OpenRA.Exts.Do&#91;T&#93;&#40;IEnumerable`1 e, Action`1 fn&#41; in C&#58;\Users\Maikel\Desktop\OpenRA-OpenRA-3e81a4b\OpenRA.FileFormats\Exts.cs&#58;line 36
   at OpenRA.WorldUtils.DoTimed&#91;T&#93;&#40;IEnumerable`1 e, Action`1 a, String text, Double time&#41;
   at OpenRA.World.Tick&#40;&#41;
   at OpenRA.Game.Tick&#40;OrderManager orderManager&#41;
   at OpenRA.Game.Tick&#40;OrderManager orderManager, Viewport viewPort&#41;
   at OpenRA.Game.Run&#40;&#41;
   at OpenRA.Program.Run&#40;String&#91;&#93; args&#41;
   at OpenRA.Program.Main&#40;String&#91;&#93; args&#41;
Here's another crash, same function from the looks of it (this was after an hour or so):

Code: Select all

Exception of type `System.NullReferenceException`&#58; Object reference not set to an instance of an object.
   at OpenRA.Mods.RA.Classic.AI.Squad.React&#40;&#41;
   at OpenRA.Mods.RA.Classic.AI.BetaAI.AssignRolesToUnits&#40;Actor playeractor&#41;
   at OpenRA.Mods.RA.Classic.AI.BetaAI.Tick&#40;Actor self&#41;
   at OpenRA.World.<Tick>b__7&#40;TraitPair`1 x&#41;
   at OpenRA.WorldUtils.<>c__DisplayClass18`1.<DoTimed>b__17&#40;T x&#41;
   at OpenRA.Exts.Do&#91;T&#93;&#40;IEnumerable`1 e, Action`1 fn&#41; in C&#58;\Users\Maikel\Desktop\OpenRA-OpenRA-3e81a4b\OpenRA.FileFormats\Exts.cs&#58;line 36
   at OpenRA.WorldUtils.DoTimed&#91;T&#93;&#40;IEnumerable`1 e, Action`1 a, String text, Double time&#41;
   at OpenRA.World.Tick&#40;&#41;
   at OpenRA.Game.Tick&#40;OrderManager orderManager&#41;
   at OpenRA.Game.Tick&#40;OrderManager orderManager, Viewport viewPort&#41;
   at OpenRA.Game.Run&#40;&#41;
   at OpenRA.Program.Run&#40;String&#91;&#93; args&#41;
   at OpenRA.Program.Main&#40;String&#91;&#93; args&#41;

BenjaminLSR
Posts: 43
Joined: Sun May 22, 2011 3:26 pm

Post by BenjaminLSR »

PROJECT ABORDED.
Feel free to move to IranAI.

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

Post by Matt »

It is spelled "aborted". I think Iran is mainly working on the classic mod and adapting your bot to the legacy gameplay, but not further improving the artificial intelligence.

I tried your latest version and it captured my construction yard in the early game. I captured it back but it still kept sending spies and engineers only, also one lonely rifle men. That was a little annoying as the spy stole some money and the engineer avoided the anti-infantry cleverly. However it did not send any bigger attack waves and kept wasting money on multiple refineries. I then captured the bots base.

I don't really understand what

Code: Select all

		Tweaks&#58;
			rand_b&#58; 20%
			rand_u&#58; 10%
		TicketsLimits&#58;
			iteration0&#58; 0
			iteration1&#58; 4000
			iteration2&#58; 8000
			iteration3&#58; 12000
is. Maybe you should implement a build-order instead of hard-coded times.

BenjaminLSR
Posts: 43
Joined: Sun May 22, 2011 3:26 pm

Post by BenjaminLSR »

BetaAI needs a total redo.
If such things happens I will need someone that know red alert strategies well, to work on it with me (I will handle coding).

Every AI available yet (BetaAI first) are wrong.
The first thing that need to be done is a full 'base handling'. Anything such as units, superpowers or attack/defend will have to wait.

I'm taking a one week holidays so, if you're interested Cmd. Matt, we could start working on it.

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

Post by Matt »


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

Post by Matt »

I let 4 AI bots play against each other and everyone had a different build order (interesting). One bot was a little too passive getting his harvester destroyed in the early game. After the aggressive bot also tried to steal money the game crashed.
Exception of type `System.InvalidOperationException`: Attempted to get trait from destroyed object (e3 85 (not in world))
at OpenRA.TraitDictionary.CheckDestroyed (OpenRA.Actor actor) [0x00025] in /home/matthias/Projekte/OpenRA/OpenRA.Game/TraitDictionary.cs:61
at OpenRA.TraitDictionary.Contains[CrushableInfantry] (OpenRA.Actor actor) [0x00000] in /home/matthias/Projekte/OpenRA/OpenRA.Game/TraitDictionary.cs:65
at OpenRA.Actor.HasTrait[CrushableInfantry] () [0x00000] in /home/matthias/Projekte/OpenRA/OpenRA.Game/Actor.cs:216
at OpenRA.Mods.RA.AI.Squad.React () [0x00919] in /home/matthias/Projekte/OpenRA/OpenRA.Mods.RA/AI/HackyAI.cs:289
at OpenRA.Mods.RA.AI.BetaAI.AssignRolesToUnits (OpenRA.Actor playeractor) [0x001d3] in /home/matthias/Projekte/OpenRA/OpenRA.Mods.RA/AI/HackyAI.cs:1147
at OpenRA.Mods.RA.AI.BetaAI.Tick (OpenRA.Actor self) [0x00066] in /home/matthias/Projekte/OpenRA/OpenRA.Mods.RA/AI/HackyAI.cs:1015
at OpenRA.World.<Tick>m__78 (TraitPair`1 x) [0x00000] in /home/matthias/Projekte/OpenRA/OpenRA.Game/World.cs:177
at (wrapper delegate-invoke) <Module>:invoke_void__this___TraitPair`1<ITick> (OpenRA.TraitPair`1<OpenRA.Traits.ITick>)
at OpenRA.WorldUtils+<DoTimed>c__AnonStorey27`1[OpenRA.TraitPair`1[OpenRA.Traits.ITick]].<>m__4C (TraitPair`1 x) [0x0000c] in /home/matthias/Projekte/OpenRA/OpenRA.Game/WorldUtils.cs:152
at OpenRA.Exts.Do[TraitPair`1] (IEnumerable`1 e, System.Action`1 fn) [0x00013] in /home/matthias/Projekte/OpenRA/OpenRA.FileFormats/Exts.cs:36
at OpenRA.WorldUtils.DoTimed[TraitPair`1] (IEnumerable`1 e, System.Action`1 a, System.String text, Double time) [0x00026] in /home/matthias/Projekte/OpenRA/OpenRA.Game/WorldUtils.cs:149
at OpenRA.World.Tick () [0x000e0] in /home/matthias/Projekte/OpenRA/OpenRA.Game/World.cs:175
at OpenRA.Game.Tick (OpenRA.Network.OrderManager orderManager) [0x0017a] in /home/matthias/Projekte/OpenRA/OpenRA.Game/Game.cs:184
at OpenRA.Game.Tick (OpenRA.Network.OrderManager orderManager, OpenRA.Graphics.Viewport viewPort) [0x00030] in /home/matthias/Projekte/OpenRA/OpenRA.Game/Game.cs:131
at OpenRA.Game.Run () [0x00026] in /home/matthias/Projekte/OpenRA/OpenRA.Game/Game.cs:335
at OpenRA.Program.Run (System.String[] args) [0x00010] in /home/matthias/Projekte/OpenRA/OpenRA.Game/Support/Program.cs:91
at OpenRA.Program.Main (System.String[] args) [0x0002b] in /home/matthias/Projekte/OpenRA/OpenRA.Game/Support/Program.cs:36

BenjaminLSR
Posts: 43
Joined: Sun May 22, 2011 3:26 pm

Post by BenjaminLSR »

I don't need crash report as I'm about to recode the whole thing.

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

Post by zypres1 »

why redo? I never had the bugs, and its still a huge improvment that changes the way the AI play.....

If 36 can get into next playtest (soon?), then players can give comments that will make it easier for you to program. Else you can schedule a day for programming and get some testers and strategy masters to help you on irc.

But IMHO I think 36 was amazing, and would love to see it into game. If you have the energy to redo it all, then it will be even more amazing.

Just please make some easy examples in the code, so its easier for others to improve it..
You also seemed to comment the code well, thanks for doing that.

And if possible, please make it possible to create easy AI maps like wave-games. Without the need for editing cs and making mods. Just a new file into oramaps, like AI.yaml and some examples on some maps would make a whole lot of new games..

Tips for modders: https://github.com/OpenRA/OpenRA/wiki/M ... ding-Ideas

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

Post by Matt »

Does your AI support loading and dropping units? Maybe parts of the logic could get reused to fix https://github.com/OpenRA/OpenRA/issues/2246

FLy1nRabBit
Posts: 2
Joined: Sat Nov 10, 2012 8:39 pm

Post by FLy1nRabBit »

So...what's happening? Are you re-doing it or is the project dead?

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

Post by Matt »

I tried to clean this up for a merge into https://github.com/OpenRA/OpenRA and rebased it onto current bleed, but there is lot's of stuff to do. I did a dos2unix with your text files so we can see a proper diff: https://github.com/Mailaender/OpenRA/co ... mproved-ai You also use spaces instead of tabs which is a little annoying. The more severe problems are the compiler warnings:
CSC mods/ra/OpenRA.Mods.RA.dll
OpenRA.Mods.RA/AI/HackyAI.cs(404,27): warning CS0472: The result of comparing value type `OpenRA.CPos' with null is `false'
OpenRA.Mods.RA/AI/HackyAI.cs(405,17): warning CS0162: Unreachable code detected
OpenRA.Mods.RA/AI/HackyAI.cs(426,32): warning CS0472: The result of comparing value type `OpenRA.CPos' with null is `false'
OpenRA.Mods.RA/AI/HackyAI.cs(427,21): warning CS0162: Unreachable code detected
OpenRA.Mods.RA/AI/HackyAI.cs(436,24): warning CS0472: The result of comparing value type `OpenRA.CPos' with null is `false'
OpenRA.Mods.RA/AI/HackyAI.cs(437,17): warning CS0162: Unreachable code detected
OpenRA.Mods.RA/AI/HackyAI.cs(471,24): warning CS0472: The result of comparing value type `OpenRA.CPos' with null is `false'
OpenRA.Mods.RA/AI/HackyAI.cs(472,17): warning CS0162: Unreachable code detected
OpenRA.Mods.RA/AI/HackyAI.cs(621,17): warning CS0219: The variable `refund' is assigned but its value is never used
OpenRA.Mods.RA/AI/HackyAI.cs(751,17): warning CS0219: The variable `myBuildings' is assigned but its value is never used
OpenRA.Mods.RA/AI/HackyAI.cs(826,31): warning CS0472: The result of comparing value type `OpenRA.CPos' with null is `true'
OpenRA.Mods.RA/AI/HackyAI.cs(1071,45): warning CS0472: The result of comparing value type `OpenRA.CPos' with null is `true'
OpenRA.Mods.RA/AI/HackyAI.cs(1147,42): warning CS0472: The result of comparing value type `OpenRA.CPos' with null is `false'
OpenRA.Mods.RA/AI/HackyAI.cs(1148,21): warning CS0162: Unreachable code detected
OpenRA.Mods.RA/AI/HackyAI.cs(499,29): warning CS0414: The private field `OpenRA.Mods.RA.AI.HackyAI.playerSupport' is assigned but its value is never used
OpenRA.Mods.RA/AI/HackyAI.cs(1017,15): warning CS0414: The private field `OpenRA.Mods.RA.AI.HackyAI.repairTarget' is assigned but its value is never used
Compilation succeeded - 16 warning(s)
You also added lot's of Red Alert specific code: This makes it very hard to adapt it to the other mods and those complex rules seem to be the error source when the AI reacts to dead units (crashes with the exception posted above). In fact cnc and d2k are currently crashing on startup with your code so I suggest if you want to make an RA-only AI you should not replace HackyAI and hack it exclusively into BaseBuilder, but keep it separate.

I agree that this addresses many https://github.com/OpenRA/OpenRA/issues and should make it's way into the game sometime. The BetaAI currently focuses too much on lame tactics such as engineer and spy wasting lot's of money and you can't see it's full potential. This can be fixed easily if you restrict this to a Secret Service AI - I suggest to name it "M" in yaml ;) and the other ones use tanks, jeep rush and planes to kick the players ass in a more traditional way.

Post Reply