I looked at the SemperFi-js AI code and it looked a bit... unfinished. So I went and fixed it up and made it a lot more maintainable. Added stuff like hover map support and anti-air defense building. It never built rearming pads for VTOL units, so I added that as well.

I still need to see how the original Semper-FI AI works and add anything missing from it and do more tests and bug fixes. Right now it might trigger a fatal lockup that I can not always reproduce (really just slows down warzone a bit and then crashes hard). Have not found the cause of that yet. Fixed it.

One annoying little bug I found: Whenever the AI ally steals an oil derrick from right under my nose (which every AI does), it orders my trucks to build defenses for it. An ally should never order my droids around...

On a side note, I wonder if there is anything we can do to make the AI stop "stealing" "my" oil derricks... It is a bit annoying when you play with an AI buddy. (No idea if playing with an AI ally is something someone else does, or if it just me, though.)

The author of this AI does that. Basically the AI checks if the distance between the startPosition of an ally and an oil is less than some value and it will not take that oil if it within a certain distance of their base.

On a side note, I wonder if there is anything we can do to make the AI stop "stealing" "my" oil derricks... It is a bit annoying when you play with an AI buddy. (No idea if playing with an AI ally is something someone else does, or if it just me, though.)

On game init I loop through all players to find the closest ally and closest enemy x,y coordinates by searching for their HQ or first constructor droid they have if they don't have a HQ.

Then if gameTime < 6000 (first 10 minutes of game) I check if the distance between the oil resource is closer to the closest ally or closer to me. If closer to the closest ally then don't build it.

I backed it out because it caused problems when trying to compete for legit resources out on the map and never revisited it. It would probably be better to just keep track of all ally x,y base coordinates and just check if the oil resource is within say ~10 tiles of their base like Berserk said above.

I'm not sure if that is going to produce the best results. Often the derricks that my ally AI steals from me are far from my base. I just killed all enemies around the oil well, and it is burning. By the time I revisit the area, my ally has sent a truck and built that derrick. The derricks closest to my base I usually get to first anyway, although I can see that it would be frustrating for players that are slower to lose even those.

Perhaps a combination of proximity check of distance to ally's base, and a proximity check of allied forces around the oil well, would work.

(1) I still believe that AI stealing oils is a non-issue. It's better to let the AI mine the oil and compensate it via asking for gifts of energy through chat commands if you still want this energy for yourself. You're a team, your resources are shared, and it's better to let the AI mine than to not mine at all.

(2) If we still want to avoid AI taking "your" derricks, the AI could ping you with a beacon and a chat message "hey, this oil is yours, please don't forget to take it, or i'm going to take it away from you in 30 seconds".

Pushed some updates for SemperFi-js. Fixes a few minor things and added electronic defense building (random chance) and allow Dragon body units to use an EMP-cannon on occasion.

Is it possible to make the mini AI (source side) more aggressive with destroying nearby features near its base? I have seen that the numerous trees in maps like Melting can stall an AI's building process.

Berserk Cyborg wrote:Is it possible to make the mini AI (source side) more aggressive with destroying nearby features near its base? I have seen that the numerous trees in maps like Melting can stall an AI's building process.

That's not hard to do, I'm just worried that it will make the AI waste a lot of precious time in the early game destroying features when it should be putting pressure on the enemy. I think if such problematic features exist, then it is a map problem, not an AI problem.

Been slowly working on a few improvements. Still, very basic but effective. Has an oil and base builder group and now does a more desirable battle tactic (oil->factories->constructors). Thing I still have yet to figure out is how to prevent multiple constructors from going after the same oil.

I also included a cheap knock off of Nexus called "Nexus JS". Essentially a SemperFi-JS personality, but with a preference for cannons/gauss/lasers and cyborgs. One time I had these two fight in a FFA skirmish in the Melting map and later saw these two were the last ones alive and then proceeded to have a stalemate. It lasted for a simulated 4.5 hours before I quit the match (to date I have only ever seen a stalemate four times with completely different AI).

function captureOil(oil){ // "oil.y * mapWidth + oil.x" is a number that uniquely (but not very verbosely) // describes the "let's capture the oil at these coordinates" event. if (throttled(90000, oil.y * mapWidth + oil.x)) { return; } // Proceed with ordering a single truck to build the derrick.}

While the approach with the map is quite trivial and seems performant, it might still be valid to ask for an API function, eg. hasBlueprint(oil, player) or maybe even enumBlueprints(label|area|whatever, player).