AMAI icon indicating copy to clipboard operation
AMAI copied to clipboard

Ability to share control with the AMAI

Open SMUnlimited opened this issue 1 year ago • 2 comments

From gartoll

  1. Add an option to share units with the AMAI. Like, a button that gives you control over the AMAI without it losing theirs, similarly to online Tema games, where you can share unit control with your allies. It could also go vice versa, meaning both you and the AMAI ally/allies you give control can access your units.

  2. When a bot leaves, instead of destroying their building and units, they give full control to their allies, humans or not, the same way you gain control over a leaver on online games. Extra points if there is a chance to give gold automatically to their allies before they leave.

SMUnlimited avatar Sep 08 '22 16:09 SMUnlimited

then have a other set -- Attack group now , the AI only control his Race Attack group Unit , This means Domination/Occupation(like Undead Banshee and Dark Ranger) other Race Unit ,they only pull the unit go home and you must processing build , let ai build other Race Factory and Unit

i think have a public group on comm....ai , AI can build other Race Unit and add other Race Unit to Attack group

and this can part solutions the continue production problem,have some map food upper limit > 100 or all Attack Unit usedfood = 0 (they call this is Infinite food)

jzy-chitong56 avatar Sep 09 '22 08:09 jzy-chitong56

WC3ScrnShot_091722_200153_000 the Dark Ranger control orc Tauren , but Dark Ranger is elf so AI can not used Tauren , and block up , the hero can not go out , so AI can not Attack @SMUnlimited

and ally control B.j if game mode != Intelligent mode call com.ai cmd= 200

com.ai if cmd = 200 set global variable integer control Surrender ally=01

when ai will Kill yourself Judge the integer if control surrender ally=01 then Create Unit for the player, donot used Conventional Units,used a Special units,For example, StarCraft units or Light Ranger and no kill the ai else kill the ai

B.j Monitoring unit creation event if units = special units and the units'player control is ai then if the units'player have ally and ally Still playing game delete units Share control to all allies or Change control to the first ally else kill the ai units

jzy-chitong56 avatar Sep 17 '22 20:09 jzy-chitong56

Part 1 Implemented

SMUnlimited avatar Jul 30 '23 16:07 SMUnlimited

i use this let ai take unknow unit

But I'm worried that there are too many search codes for this type of unit group Because 23 computer let games FPS drops , Single digit

function AttackGroupAddUnknown takes nothing returns nothing
  local group g = CreateGroup()
  local unit u = null
  local integer id = 0
  local integer i = 0
  call GroupEnumUnitsOfPlayer(g, ai_player, null)
  set g = SelectByAlive(g,true)
  set g = SelectUnittype(g, UNIT_TYPE_PEON, false)
  set g = SelectUnittype(g, UNIT_TYPE_STRUCTURE, false)
  loop
    exitwhen i >= attack_length
    set g = SelectById(g, old_id[attack_units[i]], false)
    set i = i + 1
  endloop
  loop
    set u = FirstOfGroup(g)
    exitwhen u == null
    set id = GetUnitTypeId(u)
    if not IsUnitType(u,UNIT_TYPE_SUMMONED) and id != 'ngir' and not IsUnitInGroup(u, unit_healing) and not IsUnitHidden(u) and (IsUnitType(u, UNIT_TYPE_ATTACKS_FLYING) or IsUnitType(u, UNIT_TYPE_ATTACKS_GROUND)) then
      call AddAssault(60,id)  //other hero and unit , like other race and custom
    endif
    call GroupRemoveUnit(g, u)
  endloop
  call DestroyGroup(g)
  set g = null
endfunction

jzy-chitong56 avatar Jul 30 '23 16:07 jzy-chitong56

Added human ally support so they don't give up. But its more difficult to get AMAI to control other AMAI units as per above.

Only way would be to change the player controlling the units directly to the other AMAI if there are no human players and its the same "race". Different races at the same time are probably not going to happen.

SMUnlimited avatar Nov 11 '23 20:11 SMUnlimited

I believe we have forgotten one factor - the personality of AI

I suggest

Still have a surrender main switch , This can control whether AI runs failure detection JOB , Default On

  • In shared mode, it is Off by default , AI will not run JOB
  • In control mode, players can use the console to switch switches

When the switch is turned On , AI runs JOB

when AI discovering oneself about to fail ,they will surrender

Based they personality

  • Some AI still self destruct all units
  • Some AI will enable shared control for allies -- if have allies
  • Some AI will desperate attack
  • Some AI will desperate attack , but they shared control for allies
  • Some AI randomly select one from above

jzy-chitong56 avatar Nov 12 '23 05:11 jzy-chitong56

https://github.com/SMUnlimited/AMAI/commit/81845bef75ecb7b9e7d8e1e90dcf4fbecd327cf4

In team games desperation attacks are not that useful either so have disabled that as well as the suicide unless they are the last player in the team.

The stubborn ai's still will fight to complete death, but others will end up shared or absorbed if possible.

SMUnlimited avatar Nov 12 '23 15:11 SMUnlimited