[DEV] BetaAI | TOTAL REDO ?

Improvements and ideas

Discussion about the game and its default mods.
User avatar
riderr3
Posts: 98
Joined: Sat Feb 26, 2011 11:26 pm
Location: Camo pillbox
Contact:

Post by riderr3 »

Ok, this is one more TODO list with some things that can be discussed...
*some units or features not yet in OpenRA, but it would be possible in future.


Service depot and repairing/restoring.

-Repairs air units on service depot when they damaged.

-Repairs submarines/ships in subpens/shipyards where they near base and damaged.

-Repairs vehicles when they defending base and damaged.

-Repairs vehicles after destroying one computer/player. (after battle, return to base and repair)

-Selling unused harvesters in service depot when all ore on map is collected. (and no ore mines at all)

-Selling some vehicles in service depot when they has no money, no harvesters and no unnecessary buildings.

-Mechanic follow friendly troops to enemy base, but if troops stops, mechanic stay in back of tank crowd for safety. Like this:
B - base which AI player attacked.
T - AI troops.
M - Mechanic(s).

BBBB T TT
BBBB TT TT
BBBB TTT T M
BBBB T TT TT
BBBB T T T

-Engineers to repair buildings. Place engineers near construction yard, war factories, and other important buildings, then repairs after buildings critically damaged.


Attacking and moving.

-Can flee the battle sometimes, example:
HackyAI trying to destroy enemy ore truck > enemy defend truck and send many tanks > HackyAI saw there are no chance and flees to base.

-Send supply trucks to ally. In this cases: HackyAI have ally player/computer, player have no money (0-50 or something), and HackyAI have much money. (10000 and more, or something)


Harvest and resources.

-If ore trucks collect both gold and crystals, they more preferred to collect crystals instead of gold.


Buildings and stuff.

-Place SAMS and AA Guns in direction where enemy plane with paratroopers dropped first time. (may be in place which close to map edge?)

-If ore very near to base, place ore refineries in that direction, near ore.

-Produce MCV's and able to build new bases in other places on map.

-Selling all buildings if there are no chances. (Example: HackyAI have 4 SAMS, 2 power plants, 2 silos, then sell all buildings and attack. This means there are no key buildings, and no money, like in Red Alert 1)


On water.

-Using a transports with units, looking for shore tiles to landing.

-Using helicarriers with helicopters, send with group of ships/subs, and protect them.


Tricky.

-Minelayers lay mines near small/big bridges and river passes, then return to service depot for reloading mines (probably HackyAI trying to find tile with bridge/river pass. Other mine tactic may be hard to implement for now).

-Destroying bridges near enemy bases in some cases.

-Hide infantry under the trees. Like rocket soldiers, dogs, or something. (HackyAI search where is a tree)

-If lose all units and structures (means enemy attack with many units, HackyAI only have group of 2-5 weak technicians and gunners), then split and try to run away from enemy in opposite direction (Cowards?). Probably in some cases.

-Shoot and run tactics. Artillery or V2RL shoot in enemy buildings 1-2 times, then return back to base/previous place.

-Using thiefs. Especially after spy infiltrated enemy ore refineries (in this case HackyAI know how much money available, 6000-12000 whoa... it's good to try steal some money)

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

Post by BenjaminLSR »

AAAAAHHHHHHHHH !!!!!
someone had to say that...

Ok, let's say I need to prepare the code for such TODO.
I need it to be clearer and optimized before we go any further.

Also i would be pleased if those todo list could be more segmented and closer to code.
AI cooperation will come in a 2nd time, once units are "brained".

Something like:
Spy:
- Infiltrate power when enemy have superpowers.
- Infiltrate refinery when current ore is low.
- ACTION when CONDITION.

ddd
Posts: 272
Joined: Sat Oct 23, 2010 5:04 pm

Post by ddd »

Valkirie, if your want your changes to be revised and included in OpenRA you should fork bleed branch of OpenRA on github instead of using SVN or patches on the forum. Also you should join #openra IRC channel on freenode.net to discuss issues with other devs.

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

Post by zypres1 »

Guys: lets start making the list... Where should we make it? wiki / multiplayer edit sites / forum?

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

Post by BenjaminLSR »

Hi everyone,

I've been quite busy with my workd and studies lately.
I'm also trying to recode the whole thing in a more proper way.

I don't know if I've got enough skill to make the AI reach you're goal. I will try to improve it as much as I can. Yet I'm focusing on "STANDARD" behaviors and AI "BRAIN".

AI is using troops as squads.

Code: Select all

Dictionary<string, List<string>> afinities = new Dictionary<string, List<string>>&#40;&#41;
        &#123;
            &#123;"e1", new List<String>&#40;&#41;&#123;"Assault","Long"&#125;&#125;,
            &#123;"e3", new List<String>&#40;&#41;&#123;"Assault","Long"&#125;&#125;,
            &#123;"e4", new List<String>&#40;&#41;&#123;"Assault","Long"&#125;&#125;,
            &#123;"dog", new List<String>&#40;&#41;&#123;"Defense"&#125;&#125;,
            &#123;"e6", new List<String>&#40;&#41;&#123;"Assault","Defense"&#125;&#125;,
            &#123;"medi", new List<String>&#40;&#41;&#123;"Defense","Assault"&#125;&#125;,
            &#123;"e7", new List<String>&#40;&#41;&#123;"Assault"&#125;&#125;,
            &#123;"spy", new List<String>&#40;&#41;&#123;"Assault"&#125;&#125;,
            &#123;"shok", new List<String>&#40;&#41;&#123;"Assault"&#125;&#125;,
            &#123;"harv", new List<String>&#40;&#41;&#123;"Harvest"&#125;&#125;,
            &#123;"yak", new List<String>&#40;&#41;&#123;"Air"&#125;&#125;,
            &#123;"heli", new List<String>&#40;&#41;&#123;"Air"&#125;&#125;,
            &#123;"mig", new List<String>&#40;&#41;&#123;"Air"&#125;&#125;,
            &#123;"hind", new List<String>&#40;&#41;&#123;"Air"&#125;&#125;
        &#125;;

Code: Select all

/* Squad react */
            foreach &#40;Squad squad in squads.Where&#40;a => a.isFull&#40;&#41;&#41;&#41;
            &#123;
                switch &#40;squad.type&#41;
                &#123;
                    case "Assault"&#58;
                        BotDebug&#40;"Sending ASSAULT"&#41;;
                        attackTarget = ChooseEnemyTarget&#40;&#41;;
                        CPos attackTargetLocation = attackTarget.CenterLocation.ToCPos&#40;&#41;;
                        squad.Move&#40;attackTargetLocation, true&#41;;
                        squad.TryAttackNearBy&#40;&#41;;
                        break;

                    case "Harvest"&#58;
                        squad.Harvest&#40;&#41;;
                        break;
                &#125;
            &#125;
AI can build only X number of the same building.
AI can build X number of the same building once ticks per iteration is reached.

Code: Select all

Dictionary<string, int> BuildingLimits = new Dictionary<string, int>&#40;&#41;
        &#123;
            &#123;"dome", 1&#125;,
            &#123;"proc", 4&#125;,
	        &#123;"stek", 1&#125;,
	        &#123;"atek", 1&#125;,
	        &#123;"fix", 1&#125;,
	        &#123;"barr", 2&#125;,
	        &#123;"tent", 2&#125;,
	        &#123;"weap", 2&#125;,
	        &#123;"spen", 1&#125;,
	        &#123;"syrd", 1&#125;
        &#125;;
        Dictionary<int, int> TicketsLimits = new Dictionary<int, int>&#40;&#41;
        &#123;
            &#123;0, 0&#125;,
            &#123;1, 6000&#125;,
            &#123;2, 12000&#125;,
            &#123;3, 18000&#125;
        &#125;;

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

Post by BenjaminLSR »

Image

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

Post by Matt »

It seems to crash on small maps where there is few space to build (this happened on Man to Man after few seconds)

Code: Select all

Exception of type `System.NullReferenceException`&#58; Object reference not set to an instance of an object
  at OpenRA.Mods.RA.AI.HackyAI.ChooseBuildLocation &#40;System.String actorType, Boolean defense&#41; &#91;0x00082&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Mods.RA/AI/HackyAI.cs&#58;646 
  at OpenRA.Mods.RA.AI.BaseBuilder.Tick &#40;&#41; &#91;0x0018d&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Mods.RA/AI/BaseBuilder.cs&#58;83 
  at OpenRA.Mods.RA.AI.HackyAI.Tick &#40;OpenRA.Actor self&#41; &#91;0x00090&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Mods.RA/AI/HackyAI.cs&#58;816 
  at OpenRA.World.<Tick>m__79 &#40;TraitPair`1 x&#41; &#91;0x00000&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/World.cs&#58;177 
  at &#40;wrapper delegate-invoke&#41; <Module>&#58;invoke_void__this___TraitPair`1<ITick> &#40;OpenRA.TraitPair`1<OpenRA.Traits.ITick>&#41;
  at OpenRA.WorldUtils+<DoTimed>c__AnonStorey28`1&#91;OpenRA.TraitPair`1&#91;OpenRA.Traits.ITick&#93;&#93;.<>m__4D &#40;TraitPair`1 x&#41; &#91;0x0000c&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/WorldUtils.cs&#58;157 
  at OpenRA.Exts.Do&#91;TraitPair`1&#93; &#40;IEnumerable`1 e, System.Action`1 fn&#41; &#91;0x00013&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.FileFormats/Exts.cs&#58;36 
  at OpenRA.WorldUtils.DoTimed&#91;TraitPair`1&#93; &#40;IEnumerable`1 e, System.Action`1 a, System.String text, Double time&#41; &#91;0x00026&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/WorldUtils.cs&#58;154 
  at OpenRA.World.Tick &#40;&#41; &#91;0x000e0&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/World.cs&#58;175 
  at OpenRA.Game.Tick &#40;OpenRA.Network.OrderManager orderManager&#41; &#91;0x0017a&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/Game.cs&#58;184 
  at OpenRA.Game.Tick &#40;OpenRA.Network.OrderManager orderManager, OpenRA.Graphics.Viewport viewPort&#41; &#91;0x00030&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/Game.cs&#58;131 
  at OpenRA.Game.Run &#40;&#41; &#91;0x00026&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/Game.cs&#58;335 
  at OpenRA.Program.Run &#40;System.String&#91;&#93; args&#41; &#91;0x00010&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/Support/Program.cs&#58;91 
  at OpenRA.Program.Main &#40;System.String&#91;&#93; args&#41; &#91;0x0002b&#93; in /home/matthias/Projekte/OpenRA-AI/OpenRA.Game/Support/Program.cs&#58;36

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

Post by BenjaminLSR »

openRA - BetaAI rev32
Download: Click here
Comment: This is a standalone archive.

User avatar
riderr3
Posts: 98
Joined: Sat Feb 26, 2011 11:26 pm
Location: Camo pillbox
Contact:

Post by riderr3 »

more crash

Code: Select all

Platform is Linux
Using Gl renderer
Desktop resolution&#58; 1366x768
Using resolution&#58; 1318x720
Available mods&#58;
	cnc&#58; C&C &#40;&#123;DEV_VERSION&#125;&#41;
	d2k&#58; Dune 2000 &#40;beta&#41; &#40;&#123;DEV_VERSION&#125;&#41;
	example&#58; Example Mod &#40;a0001&#41;
	ra&#58; Red Alert &#40;&#123;DEV_VERSION&#125;&#41;
	ra_perf&#58; RA Perf &#40;a0001&#41;
Loading mods&#58; ra
Game started
Game started
Game started
Exception of type `System.InvalidOperationException`&#58; Attempted to get trait from destroyed object &#40;e1 111 &#40;not in world&#41;&#41;
  at OpenRA.TraitDictionary.CheckDestroyed &#40;OpenRA.Actor actor&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.TraitDictionary.Contains&#91;CrushableInfantry&#93; &#40;OpenRA.Actor actor&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Actor.HasTrait&#91;CrushableInfantry&#93; &#40;&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Mods.RA.AI.Squad.React &#40;&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Mods.RA.AI.BetaAI.AssignRolesToUnits &#40;OpenRA.Actor playeractor&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Mods.RA.AI.BetaAI.Tick &#40;OpenRA.Actor self&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.World.<Tick>b__7 &#40;TraitPair`1 x&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at &#40;wrapper delegate-invoke&#41; System.Action`1<OpenRA.TraitPair`1<OpenRA.Traits.ITick>>&#58;invoke_void__this___TraitPair`1<ITick> &#40;OpenRA.TraitPair`1<OpenRA.Traits.ITick>&#41;
  at OpenRA.WorldUtils+<>c__DisplayClass18`1&#91;OpenRA.TraitPair`1&#91;OpenRA.Traits.ITick&#93;&#93;.<DoTimed>b__17 &#40;TraitPair`1 x&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Exts.Do&#91;TraitPair`1&#93; &#40;IEnumerable`1 e, System.Action`1 fn&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.WorldUtils.DoTimed&#91;TraitPair`1&#93; &#40;IEnumerable`1 e, System.Action`1 a, System.String text, Double time&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.World.Tick &#40;&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Game.Tick &#40;OpenRA.Network.OrderManager orderManager&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Game.Tick &#40;OpenRA.Network.OrderManager orderManager, OpenRA.Graphics.Viewport viewPort&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Game.Run &#40;&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Program.Run &#40;System.String&#91;&#93; args&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
  at OpenRA.Program.Main &#40;System.String&#91;&#93; args&#41; &#91;0x00000&#93; in <filename unknown>&#58;0 
AL lib&#58; ALc.c&#58;1879&#58; exit&#40;&#41;&#58; closing 1 Device
AL lib&#58; ALc.c&#58;1808&#58; alcCloseDevice&#40;&#41;&#58; destroying 1 Context&#40;s&#41;
AL lib&#58; ALc.c&#58;1420&#58; alcDestroyContext&#40;&#41;&#58; deleting 32 Source&#40;s&#41;
Inconsistency detected by ld.so&#58; dl-close.c&#58; 731&#58; _dl_close&#58; Assertion `map->l_init_called' failed!

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

Post by BenjaminLSR »

I know this one riderr3. I'm on it already.

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

Trying out and giving feedback

Post by zypres1 »

You can try it out the recent versions (no install): Please give feedback and help it more here: http://shrib.com/gfXfm9mq

svn: http://xp-dev.com/svn/openRA/

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

Post by Matt »

Btw I like the early Yak/Heli and Jeep attacks. However the AI has problems reloading their aircrafts. They immediately take up again.

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

Post by zypres1 »

Cmd. Matt wrote: Btw I like the early Yak/Heli and Jeep attacks. However the AI has problems reloading their aircrafts. They immediately take up again.
He needs ppl to help with yaml. He's written over 1200 lines code, but most can be configured in yaml (what to attack, build etc)

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

Post by Matt »

zypres1 wrote: He needs ppl to help with yaml. He's written over 1200 lines code, but most can be configured in yaml (what to attack, build etc)
I can't find anything new to configure at http://xp-dev.com/svn/openRA/mods/ra/rules/system.yaml It looks like everything is still hardcoded to http://xp-dev.com/svn/openRA/OpenRA.Mod ... HackyAI.cs

You should really just fork https://github.com/OpenRA/OpenRA instead of using this private read-only SVN

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

Post by BenjaminLSR »

Cmd. Matt wrote:
zypres1 wrote: He needs ppl to help with yaml. He's written over 1200 lines code, but most can be configured in yaml (what to attack, build etc)
I can't find anything new to configure at http://xp-dev.com/svn/openRA/mods/ra/rules/system.yaml It looks like everything is still hardcoded to http://xp-dev.com/svn/openRA/OpenRA.Mod ... HackyAI.cs

You should really just fork https://github.com/OpenRA/OpenRA instead of using this private read-only SVN
Next release will support customisation: http://pastebin.com/FFLke1sk
Github: https://github.com/Valkirie/OpenRA

Post Reply