[AI] BoneCrusher! bot player for 3.1.x

Did you create a mod, map, music, or a tool? Present them here and earn feedback!
Note: addon requests do not belong here.
Note, everything uploaded to this forum, MUST have a license!
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

[AI] BoneCrusher! bot player for 3.1.x

Post 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.
Attachments
bonecrusher_0.16.wz
(22.57 KiB) Downloaded 417 times
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

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

Post 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 (=
Legion
Greenhorn
Posts: 15
Joined: 03 Dec 2013, 16:14

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

Post 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
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

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

Post 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.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

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

Post 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.
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

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

Post 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?
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

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

Post 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.
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

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

Post 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.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

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

Post by NoQ »

Ahaha nice catch! The intended code is just "startPositions[me]".
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

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

Post 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
Attachments
bonecrusher_0.18.wz
New algorithms, new behavior
(29.05 KiB) Downloaded 196 times
bonecrusher_0.17.wz
Just update 0.16 fix startPosition
(22.97 KiB) Downloaded 180 times
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

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

Post 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.
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

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

Post 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.
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

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

Post 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(): Отмена
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

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

Post 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.
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

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

Post 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.
Post Reply