Page 1 of 2

[AI] BoneCrusher! bot player for 3.1.x

Posted: 25 May 2015, 23:05
by Prot
AI Mod WIP.
This is non-cheat bot originaly developed for AI vs AI competition.
GitHub page: https://github.com/EuPhobos/bonecrusher

It's still stupid, and far to final release, but it is another non-fork bot, write from scratch.
Bot write as non-cheat player follow by the game rules (cannot change units templates and produce it's without HQ, or cannot see any enemies/rigs in fog of war.. etc) for little office competition for dual AI vs AI, later i add teamplay support and some improvements for normal play in multiplayer.
I have two branches on github, in master i test alot it without any errors, in devel - WIP.

Distributed under Creative Commons CC-0 license.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 02 Jun 2015, 09:43
by NoQ
Hello, nice to see this finally(?) posted. Thanks for the convenient comments and debug prints in my native language, that explains why you bear so much hate for the predicates (=

At a glance, there must be some trouble with your code around pickStructLocation(), because sometimes the AI builds the base in a pretty weird way, i couldn't instantly debug it though:
Spoiler:
Overally, i bear huge respect for your attempt, and even more so for your goal of creating an AI that works without visibility-cheating. There's a lot of tweaking you may like to do, from grouping units into armies to refining the early build order. Wish you have more fun while coding and sharing this (=

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 02 Jun 2015, 12:07
by Legion
Hilariously, I had one of these BoneCrushers immediately truck rush and build a factory in the middle of where my base would be at the start of a game...the sad part is that if it didn't build a truck unit first, it might have ruined my game lol

So yes, it is doing funny things with base structures

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 07 Jun 2015, 18:10
by Prot
NoQ wrote: At a glance, there must be some trouble with your code around pickStructLocation(), because sometimes the AI builds the base in a pretty weird way, i couldn't instantly debug it though:
Spoiler:
Overally, i bear huge respect for your attempt, and even more so for your goal of creating an AI that works without visibility-cheating. There's a lot of tweaking you may like to do, from grouping units into armies to refining the early build order. Wish you have more fun while coding and sharing this (=
Yeah, i use standard function pickStructLocation(), which work as found near empty location, and when it has no space, then this function may return far location, i do not check it, and can't, because in this version of game i do not have some function, as "distance by propulsion", and sometime "near" by dist Between Two Points() not mean near for the builder. Btw this way "strange building base", when no more space, also affects by the nexus, semperfi and nullbot ;) Especially on SK-Rush maps.
Legion wrote:Hilariously, I had one of these BoneCrushers immediately truck rush and build a factory in the middle of where my base would be at the start of a game...the sad part is that if it didn't build a truck unit first, it might have ruined my game lol

So yes, it is doing funny things with base structures
Yeah, i known this bug, and i known how to reproduce it, when you select the bot player and then swap the slots by you and bot, the bot "think" his is still on the same slot, where player selected, and go to the start "old slot" location to build base there =) This is strange behavior due to variable "me". I need workaround this..

Anyway, i look to write bot to 3.2+ version the game, there more functions and more ways to easy write bots.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 07 Jun 2015, 20:13
by NoQ
Btw this way "strange building base", when no more space, also affects by the nexus, semperfi and nullbot
Not that much, there must be some bug in your scripts as well, even though i didn't instantly find any. On the screenshot i posted, there clearly *were* closer positions to build.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 08 Jun 2015, 11:42
by Prot
NoQ wrote:
Btw this way "strange building base", when no more space, also affects by the nexus, semperfi and nullbot
Not that much, there must be some bug in your scripts as well, even though i didn't instantly find any. On the screenshot i posted, there clearly *were* closer positions to build.
Strange, what the map on screenshot?

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 12 Jun 2015, 10:02
by NoQ
Uhm, still no time to investigate myself...

That was the Calamity map, a version with spectators, i put myself in spectator position on top and destroy everything and put a CC below the wall through cheats, then put BoneCrusher on top and NullBot on bottom and enjoy a 1x1 AI match, this way i ran thousands of tests for NullBot.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 15 Jun 2015, 22:25
by Prot
NoQ wrote:Uhm, still no time to investigate myself...

That was the Calamity map, a version with spectators, i put myself in spectator position on top and destroy everything and put a CC below the wall through cheats, then put BoneCrusher on top and NullBot on bottom and enjoy a 1x1 AI match, this way i ran thousands of tests for NullBot.
Yeah, i test it on this map and find the problem, it's strange variable "me", if i set "bot" start base position by this "startPositions[playerData[me].position];", then he thinks that his starting position is the one that was before the player swap the "players slots" on lobby.
He is try to build base around and near by the spectator position.

If i set my self on spectator slot (2), and set bot on slot (0), then variable "me" anyway gets as 2.
Like "me" variable is intended to a living player, and not to a running script bot.
This code return:

Code: Select all

    for(var e = 0; e < maxPlayers; ++e){
        var msg = "Игрок ["+e+"] мой ";
        if(allianceExistsBetween(me,e)){msg += "союзник";}
        else{msg += "враг";}
        debugMsg(msg,2);
    }

Code: Select all

bc[2]{1}: Игрок [0] мой враг
bc[2]{1}: Игрок [1] мой враг
bc[2]{1}: Игрок [2] мой союзник
bc[2]{1}: Игрок [3] мой враг
But slot (0) it is bot him self, and (2) not ally =)

Anyway, i know how to workaround this. Just set start base location nearby first of builder spawn.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 16 Jun 2015, 05:58
by NoQ
Ahaha nice catch! The intended code is just "startPositions[me]".

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 05 Feb 2017, 13:15
by Prot
NoQ wrote:Ahaha nice catch! The intended code is just "startPositions[me]".
Yeah, now it's works.. i follow by this manual: https://warzone.atlassian.net/wiki/page ... eId=360510
I think that example is little bit wrong.

Just update the v0.16 version to v0.17, do not use 0.16 anymore, i can't update first topic to delete file.
And new v0.18 for wz 3.1.5
This two version 17 and 18 can play together in skirmish.

And strange, my AI-Bot just disappear from addons: http://addons.wz2100.net/294

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 06 Feb 2017, 03:43
by Berg
Prot wrote: And strange, my AI-Bot just disappear from addons: http://addons.wz2100.net/294
Its not strange if you addon has been updated in any way it has to be tested and approved again.

It would be nice to get feedback from other users also to see if it has issues for them.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 06 Feb 2017, 17:08
by Prot
Berg wrote: Its not strange if you addon has been updated in any way it has to be tested and approved again.
Understood. It is not very convenient. Now I understand why the forums are full of AI, which I never heard, only recently scoured the forum and came across a lot of AI that are not in the directory addons.wz2100.net
Or the authors are simply too lazy to put their work in the directory or they are not comfortable this approach in moderation.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 07 Feb 2017, 00:42
by Berg
Prot wrote:Or the authors are simply too lazy to put their work in the directory or they are not comfortable this approach in moderation.
The moderation is there so we have finished maps and mod that have been tested by the community and reviewer and know we that addons has good quality mods and maps.

Please read the rules for submitting addons to be included.

http://developer.wz2100.net/wiki/AddonPrototype please read


http://developer.wz2100.net/wiki/Addons please read
Prot wrote:Understood. It is not very convenient. Now I understand why the forums are full of AI, which I never heard, only recently scoured the forum and came across a lot of AI that are not in the directory addons.wz2100.net
They are not in The addons section because the authors did not complete the method of getting them in addons.

I like to be able to read what is happening in console but it seems its not in english.

EXAMPLE

Code: Select all

c[1]{260}: defenceQueue(): вражеских=0, итого=4
bc[1]{261}: getTarget: Атака на 1 цели по 4 юнита (31,50)
bc[1]{266}: getTarget: Атака на 1 цели по 4 юнита (31,50)
bc[1]{270}: defenceQueue(): Защитных башен=2, отдалённых качалок=4, типы башен=1, к постройке=4
bc[1]{270}: defenceQueue(): вражеских=0, итого=4
bc[1]{271}: getTarget: Атака на 1 цели по 4 юнита (31,50)
bc[1]{272}: checkBase(): factory=1/1; power_gen=3/3; resource_extractor=8/8; research_lab=2/2; cyborg_factory=0/0; hq=1/1; vtol_factory=0/0
bc[1]{272}: buildersOrder(): buildersMainLen=3; buildersHuntersLen=2; rnd=0; rotation=90; order=false
bc[1]{272}: buildersOrder: видимых свободных ресурсов=0, неизвестных=4, вражеских=2, цели=4
bc[1]{272}: buildersOrder(): Строители бездельничают 0
bc[1]{272}: buildersOrder(): Строители бездельничают 1
bc[1]{272}: buildersOrder(): Строители бездельничают 2
bc[1]{272}: oilHunt(): Строим вышку у вражеского ресурса
bc[1]{272}: buildersOrder: Строитель-охотник №160401 на службе? true
bc[1]{272}: buildersOrder: Строитель-охотник №160391 на службе? false
bc[1]{272}: rigDefence(): 4
bc[1]{272}: rigDefence(): Строителем №160391 строим GuardTower1 18x50
bc[1]{272}: rigDefence(): Отмена

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 07 Feb 2017, 08:15
by Berg
I was looking at the contents of your AI mod and i see all the comments in the js files are not in English.
I do think not having them in English will allow others to help advance you AI.
I’m sure I have no clue as to what your scripts do and to find the time to translate your comments is beyond my idea of constructive work.

Re: [AI] BoneCrusher! bot player for 3.1.x

Posted: 07 Feb 2017, 12:18
by Prot
Berg wrote:I was looking at the contents of your AI mod and i see all the comments in the js files are not in English.
I do think not having them in English will allow others to help advance you AI.
I’m sure I have no clue as to what your scripts do and to find the time to translate your comments is beyond my idea of constructive work.
I think after most planned features will be ready, I'll find time to translate comments. Now I am engaged in restoring order in the code, never thought that someone will be watching in. Again, I repeat, work on the bot is not finished, it is still under WIP.
It's either not worth it at all then to spread in the catalog, or it would be good to have a WIP mark and lay out the beta version, which is not quite finished, but do not contain serious errors.