archive by month
Skip to content

a first look at the FastAPproximation combat simulator

Comments pointed out the new C++ combat simulator FastAPproximation (FAP) by N00byEdge. It’s included in the source of the bot Neohuman, but it has virtually no dependencies and can be easily ported to use in another bot. It is under an MIT license, like UAlbertaBot and Steamhammer, so it also has light legal constraints.

I haven’t tried it yet. No time! Here are my impressions after reading the code.

• I think it’s not quite finished. For one thing, the parent bot that it is part of doesn’t use it yet. For another, it’s still under rapid development. In the last 2 days it has gotten support for stim and medics, and has had at least 2 bug fixes and other changes.

• Even so, bftjoe uses it, so it is in a usable state.

• It’s simple and short and easy to understand. You can read through and easily see its abilities, and its bugs and limitations. SparCraft is large and complex and difficult to understand and modify. I think understandability is a major advantage. If it has problems that affect your bot’s play, you can fix it yourself.

• It supports more stuff than SparCraft. This is a big deal. Unlike SparCraft, FAP explicitly supports bunkers, reavers, and carriers. Overall, SparCraft has major omissions and makes a lot of mistakes with units it does support—for example, the new version claims to handle mutalisks versus spore colonies, but in practice doesn’t do an acceptable job. A combat simulator which handles those things even halfway correctly could have big advantages.

• Its combat simulation is extremely simple. Each unit finds the closest enemy and attacks it as possible, moving toward it until it can. SparCraft has “scripts” that allow much more flexible specification of behavior.

• No support for terrain. SparCraft constrains ground units to walkable terrain. FAP doesn’t read the map at all. Both pretend that units are allowed to freely overlap each other when they move (which in Brood War is only true for air units). Neither understands high ground, which affects visibility and hit probability and makes a giant difference. So SparCraft has a theoretical advantage in simulating ground battles that are in chokes or otherwise affected by terrain obstacles, while both are weak in coping with high versus low ground.

• It ought to be reasonably fast due to its simplicity. With the addition of a location-indexed data structure to find nearest targets quickly, it could be made very fast.

• Other limitations: I didn’t notice any support for suicide units (scourge, infested terrans, spider mines). No splash damage. No support for most spells, not even repair (only stim and medic healing). Details for bunkers, carriers, and reavers are simplified.

• Bugs: The range bonus for a bunker is added on only 1 of 2 #ifdef paths. When a bunker is destroyed, it seems that the 4 fictional marines which are assumed to be in the bunker also disappear, so bunkers will be underestimated.

Trackbacks

No Trackbacks

Comments

Hannes Bredberg on :

Thanks for the pointers. I'm adding suicide units and elevation to the sim now, because of this post :)

Jay Scott on :

Sure enough, it wasn’t finished. :-)

Joseph Huang on :

Note that a lot of the benefits of sparcraft are negated by the fact that there is no way to extract which moves sparcraft found to be optimal - making the sim slower and more complex for no benefit.

tolmar on :

I'd love to see the different combat simulators benchmarked against each other (and maybe against a total resource cost based one as a control?). So if you ever decide to use it in Steamhammer, maybe post the percent win rate against SparCraft?

Jay Scott on :

It’s a good idea, and I may do it if I find time. Unfortunately win rates are noisy so it would take a ton of games to get good numbers.

tolmar on :

The trick is to try to convince someone else to do all the hard work ;-).

Jay Scott on :

And you haven’t succeeded yet. :-)

MicroDK on :

My tests show that FAP does a very good job and I have not noticed any different behaviour comared to using SparCraft. Also, we get the benefits of being much faster, at least 2x with a low amount of units and properly much faster with many units, and the code is much less complicated so it can easily be changed and bug fixed. So in the long run FAP will be the default replacement for SparCraft.

liongis on :

Steamhammer is very aggressive, how do you get it to defend?
I come from China.

Jay Scott on :

It’s aggressive because it plays better that way. During the opening build order, you can write "go defensive" into the build order and units will stay home and defend until the opening is over. For more control than that, you can modify code in CombatCommander to give squads the order Hold (meaning “hold this ground”) for any location.

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.