Cobra skirmish AI

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
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Cobra skirmish AI

Post by Berserk Cyborg »

Image
Cobra.wz
git repository

I would like to introduce a modified Semperfi-js AI skirmish bot I have been working on. I made this bot with team battles in mind, but it should do fine without an ally as well.
-I do use a custom NullBot standard file since it has a bunch of useful data about research and weapons.

--Chat commands--
It will give allies helpful text throughout the course of the skirmish. These include:
--What player it is attacking.
--Which player has been the most harmful towards the bot.
--Various calls for help like wanting a unit or needing power.
--Beacons.

--Personalities--
AC: cannons and mortars. AR: flamers and mortars. AB: Rockets and missiles. AM: machine-guns and (fire)mortars. All personalities use lasers/plasma cannons when possible.

Current list of commands:
“need power/truck/tank/cyborg/vtol” → request that item
“attackX” → X is a player number you want to attack.
"oilX" → X is a player number you want Cobra to target oil.
"stats" → ask which player is being the most harmful to the AI.
Entering a personality name will change Cobra to that specific one. (list in personality section).


Edit: version 1.06 brings hover map support and a more dynamic build/research order depending on starting technology and bases. Adds a new personality that focuses on machine-guns/mortars/fire mortars. A bunch of smaller improvements made as well.
Last edited by Berserk Cyborg on 08 Mar 2017, 18:43, edited 12 times in total.
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: Cobra skirmish AI

Post by Prot »

Excellent, the more bots, the more interesting!
Today will definitely test it.
User avatar
montetank
Regular
Regular
Posts: 642
Joined: 14 Feb 2013, 00:05
Location: Montenegro

Re: Cobra skirmish AI

Post by montetank »

Berserk Cyborg wrote:Image
Cobra.wz
I would like to introduce a modified Semperfi-js AI skirmish bot I have been working on. I made this bot with team battles in mind, but it should do fine without an ally as well.
Nice. Its good, that somebody works on the AI. So NoQ is not alone.
Here is my Question: Is it possible, that the bots detect the oil barrels and oil derricks, which are covered/surrounded by treas?
The reason i ask: We know, that over 90% of the players are playing alone the skirmish maps against the bots. When i try to create maps, i often want to place oil barrels which are hidden by treas or walls (So-the player has to produce a combat unit at first before the oil could be arrived). But thats unfair. The Al cant detect the hidden oil and so it is a big advantage for the player. The AI should handle the treas like enemys, to get the oil.

Sorry for my bad english. I am sure, you understand, what i want to ask. I will test your bots now.
In case the WZ-game ends in a draw , the game winner will be determined by penalty shoot-out.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Cobra skirmish AI

Post by Berserk Cyborg »

montetank wrote:Here is my Question: Is it possible, that the bots detect the oil barrels and oil derricks, which are covered/surrounded by treas?
Yes. Most bots will just count some feature on a map on a set timer so to speak. NullBot can seek out oil drums/artifacts on its own, but I do not know if it will destroy structures blocking important items.

I can add some code to Cobra that makes some units target buildings/walls/trees around oil drums and resources.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Cobra skirmish AI

Post by Per »

The micro-AI (in the C++ code) will shoot at features blocking a droid's path after being stuck for a bit, so you can order them to ignore such obstacles, and that should take care of it.
User avatar
montetank
Regular
Regular
Posts: 642
Joined: 14 Feb 2013, 00:05
Location: Montenegro

Re: Cobra skirmish AI

Post by montetank »

My experience: For example in this screenshot. The AI will never send a tank to destroy the treas or other objects to arrive the oil derrick (or barrels, which were placed there by map makers). Thats my experience. I tested this many times.
Attachments
wz2100-20170111_010532-gzu-T1.jpg
wz2100-20170111_010532-gzu-T1.jpg (130.36 KiB) Viewed 14795 times
In case the WZ-game ends in a draw , the game winner will be determined by penalty shoot-out.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Cobra skirmish AI

Post by Berserk Cyborg »

Been working on this AI lately and made some improvements. New version is in my first post and report any bugs or anomalies you find.

-Better build order (also oil is more likely to be taken) and Cobra should no longer use too much power early on in T2/T3.
-Fixed vtol related research/weapons and vtol factory building.
-No longer spams beacons at an incredible rate and thus crashing warzone.
-Basic laser satellite support.
-Builds anti-air defenses (needs improvement).
-Better module building decisions.
-Sensors are accompanied by an attack unit. Other sensors are used as backup in case the active sensor unit is destroyed.
-Performance improvements all around.
-Tries not to build stuff in dangerous locations.
-Bunch of other changes I likely forgot about.

Next I will need to make it do better research/weapon decisions, but for now it is not too much of a problem.

Also is there anything I could do with difficulty or is this already handled? I can not prove it, but it seems Nexus AI cheats with research and unit production especially on insane difficulty.
MIH-XTC
Trained
Trained
Posts: 368
Joined: 31 Jan 2014, 07:06

Re: Cobra skirmish AI

Post by MIH-XTC »

Yea you're correct in saying that Nexus AI cheat finishes research except while on easy mode. One problem I noticed with AI in 3.2 is that Nexus AI on easy mode is the only AI that continuously researches once a research lab becomes available. All other AI's do not research seamlessly from one upgrade to the next, often times they have research labs available but do not research anything.

If you want to make a truly dynamic AI that can play any map and settings very good then you will need to calculate (or consider) the following variables below. Once calculated, then it's just a matter of determining the following 4 items:

base build order
truck order (which trucks do what in which order)
research order
units to be produced

Game Settings:
Arty on/off
VTOL's on/off
Starting base (full/half)
# of allies
# of players
Starting tech

Map Properties:
# of oils in starting base
# of starting derricks
# of oils on my half of the map
# of tiles needed to reach furthest oil outside of base on my half of map (furthest middle oil)
# of tiles between starting truck and opponent starting truck

With these quantities in mind, one does not need to really look at the map to strategize. Strength of scavs and water tiles are two items that aren't so straightforward in determining AI strategy but still need to be considered.

Programming AI unit handling is an entirely different beast.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Cobra skirmish AI

Post by Berserk Cyborg »

Thanks for the input, I will definitely try using the information you provided to make Cobra more dynamic in the future.

On a side note: I just discovered a bug with group initialization should a map provide attack/sensor units so anybody who downloaded Cobra earlier should download it again.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Cobra skirmish AI

Post by Berserk Cyborg »

A new update is available (download link is in first post). As always report any new bugs with this release. Do note this is still a WIP, but from my tests everything is stable so far.

More or less just made some minor improvements which include fixes for vtol attacking and research behavior and preventing personalities from changing on save-load. Cobra starts off trying to research all the machine-gun tech (cheap and effective) and then focuses on its specific weapon of choice. Also a rocket based personality was added and each personality will use lasers as well. This means there is more unit variety.

I plan on expanding on more useful chat commands and adding some basic adaption next.
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: Cobra skirmish AI

Post by Prot »

montetank wrote:My experience: For example in this screenshot. The AI will never send a tank to destroy the treas or other objects to arrive the oil derrick (or barrels, which were placed there by map makers). Thats my experience. I tested this many times.
I think you about this ? ;)
https://youtu.be/beHZwoRU76w
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Cobra skirmish AI

Post by Berserk Cyborg »

Cobra.wz
There have been a lot of changes since the last release that I published here. These include:
1. Repair group. Makes use of the heavy repair turret when available.
2. Sensors and artillery management has improved.
3. Improvements to build/production/tactic systems.
4. Better map adaption for the personalities. A new personality, AL, is exclusive to T3 matches with at least bases (thermal based weaponry is only used).
5. Much better research choices.
6. Performance improvements.
7. It can build defenses near derricks it owns, if power levels are good enough.
...And a bunch of other stuff.

Anyway, I think I am done with this bot for the time being. Let me know if you find any bad behavior or bugs with Cobra AI (if not, I will upload this to the addons section).

Edit: v1.11 - Fixed an issue where units would not attack walls.
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

Re: Cobra skirmish AI

Post by Berg »

I edited the description in add-ons to supply chat commands if you would make it tidier i will re approve it on request keep up the good work
gamesforfun
New user
Posts: 1
Joined: 19 May 2017, 03:19
Location: Auckland new zealand

Re: Cobra skirmish AI

Post by gamesforfun »

can the original owner of this mod please fix it as it contains a virus
MOLDY2
New user
Posts: 1
Joined: 21 May 2017, 18:03

Re: Cobra skirmish AI

Post by MOLDY2 »

how do I add it to warzone I figured out maps but I cant figure out how to add the bot
Post Reply