Welcome to HABAI - Hardware Accelerated Battlefield AI

Give your bots the CPU cycles they deserve. They have earned it !

HABAI Multic0re Drawing

Friendly in game botsBot filling MG positionAnother position filledBots are more intelligentOperation Totalize HABAI 3Extra HABAI chaos (Operation Supercharge)

Hardware Accelerated Battlefield AI (HABAI) improves AI bot performance. At the present time it is only available for the Forgotten Hope mod for Battlefield 2. Support for other mods like AIX2 may follow as as for ArmA2:OA. What does this mean ? For the player it means more intense game play, with bots using and performing better with weapons and vehicles. That means blistering game play with more bullets flying, more explosions, more aggressive AI, more fun ! Mods without servers full of human players can be given a new lease of life. The AI is more difficult to play with as it responds faster. Clans can use this mod to improve training in BF2 with bots.

The mod will also allow easy switching of maps using the in game map voting menu. There will also a be a custom quick start GUI so single player and coop players can get quickly into a multicore accelerated game with the AI.

In game single player/coop map menu
This screen shot shows the in game map chooser (map vote menu).

The mod will also fix the "autobalance.py" Python script provided by DICE as the current version does not balance bots when using more than 96 bots. At the present time the maximum 50/50 team balance can be achieved with 96 bots, with 48 on each team.

Proof of 50/50 96 bot team balance
Yes, there really can be 96 bots balanced 50/50 in Battlefield 2 (plus one, me, the human player).

More bots can be added (up to 255 but that is a theoretical maximum) but one team will always be set at 48. With a fixed "autobalance.py" script balancing should be achievable for more than 96 bots. A solution will also be provided for becoming squad leader as when the maximum number of squads is reached it is not yet possible to become the squad leader. Other fixes and innovations may be developed.

The technical details

HABAI Multic0re Drawing
HABAI sets up a multi threaded environment for Battlefield 2

As the AI has a seperate CPU core all to itself the engine does not scale down AI performance. DICE have stated that their engine does indeed do this when resources are limited ...

Tobias_Karlsson_(DICE) wrote:"Battlefield [...] is a real time system, which means that all subsystems have a very limited amount off time to perform their calculations [...] The AI system is time sliced, that means that all the major [AI] systems can abort, break, or postpone their calculations if they run out of time."

Quoted from "An Introduction to AI in Battlefield 1942" [Battlefield 2 AI is an almost identical system], Tobias Karlsson, Digital Illusions CE AB, p4, 2003-11-07.

This is done by splitting server (AI/bots) and client (graphical) operations between cores (CPU affinity) on a single machine with a multicore CPU. This is currently working but was not easy to achieve because various server options are sometimes poorly documented and sometimes don't work as expected. More so the Battlefield 2 engine architecture, especially the operation of the AI, is not widely understood (I thank Void here for his help, see his ESAI ).

My testing shows much improved frame-rates ... for example there are no slow downs when there are lots of AI in one area. Benchmarks prove that there is an improvement. The important figure in the following tables is the "Avg" (average) number for FPS - Frames Per Second. The benchmarks were all taken on the same Forgotten Hope level, Anctoville, as all 48 bots of one side spawn in a single area. This is where AI slow down often occurs as well as framerate glitches. Benchmarks taken on Quadcore Q6600 and Nvidia 9800GT machine.

Fraps benchmark for a game started using the in game server creator.

Frames, Time (ms), Min, Max, Avg
1485, 60000, 15, 42, 24.750

Server and client on single core.

Frames, Time (ms), Min, Max, Avg
1657, 60000, 17, 60, 27.617

Server and client on seperate cores effectively making BF2 "multi-threaded".

Frames, Time (ms), Min, Max, Avg
2713, 60000, 0, 61, 45.217

This improves AI performance as well as keeping the framerate in the graphical client as high as possible.

CREDITS

Thanks to the Forgotten Hope team for their high quality mod and for supporting AI. Thanks to Forgotten Hope single player fans in the FHSP forum section and to Project Reality for bringing clarity to Battlefield 2 modding. Thanks to djinn for moral support. Thanks to Void for AI enlightenment.

Image RSS Feed Latest Screens
AIX2 HABAI squad join with max squads HABAI covered on BFSP - Page Excerpt HABAI covered on BFSP - Full Page
Blog RSS Feed Report abuse Latest News: Returning to work on the mod !

6 comments by DJ_Barney on Feb 25th, 2014

Hello. It's been a few months but I've been happy to get some time to work on the mod.

I played a game of Forgotten Hope St. Vith started entirely in the client with 64 bots. The FPS often goes down to ~20 and below.

As you can see in the map of St. Vith above (courtesy of Forgotten Hope dev team) the map is has quite a complex layout. I suspect this is why the frame rate is very low with the AI on this map. Other levels are not this bad even without the dedicated server. The AI is having to do a lot of path finding around obstacles on the navmesh which puts more strain on the CPU. Running the AI on the dedicated server solves all that by handing off all the AI stuff to another CPU core. On that point ...

I noticed in the dedicated server readme.txt this; "Only run one instance of BF2 per physical CPU with Hyperthreading disabled". I assume "BF2" means the server seeing as this is in the server readme. I'd been running the server on two cores. I think this may explain some server crashes I've had before. So forcing the server to one core should help with that.

So with the client connecting to a dedicated server on the same machine the FPS is 99% of the time @ 60 fps on St. Vith ! Even reducing the bots in a client only game to 48 in total the FPS is @ ~48. Playable, but 60 fps is much more immersive.

So there's a few problems to fix now.

Running an identical copy of FH Coop Patch C files on the server gives ...

1. Sometimes missing shell change sounds in tanks.

2. Double fire sound on some German tanks.

3. Inability to become squad leader.

These are all problems that arise when running with the dedicated server. They do not happen when starting a game entirely in the client without the dedicated server. So there are some fixes needed in the server files. I think the sound problems can be fixed. The squad problem might be more tricky.

I'm also going to work on a GUI to make starting games easier. It will be much like the GUI within the client for starting client only games but will have more features like showing the full "mini" map as found on the FH website (if FH devs will allow me to distribute them). I'm considering coding this in C++ but might choose some kind of scripting language.

OK, thanks for reading if you got this far and on with the development !

Downloads RSS Feed Latest Downloads
HABAI Testing Release

HABAI Testing Release

Mar 17, 2014 Script 4 comments

This download provides the ServerSettings.con file and a description of how to go about setting everything up to allow acceleration of bots in Battlefield...

HABAI testing release for ArmA:OA

HABAI testing release for ArmA:OA

Sep 12, 2012 Singleplayer Map 7 comments

The idea here is to encourage testing of the ArmA2:OA set up and development of creative ideas for making the ArmA2:OA AI game as fun as possible. This...

Post comment Comments  (20 - 30 of 50)
abrun4
abrun4 Oct 22 2012, 4:36am says:

So when can i get it?

+2 votes     reply to comment
DJ_Barney
DJ_Barney Nov 5 2012, 10:02am replied:

I can't give a release date at the moment. But I am working on it and there will be a release (maybe be subject to acts of God, invasions of Tribble's, etc).

+2 votes     reply to comment
MasterofMetal
MasterofMetal Sep 19 2012, 2:12am says:

YAY about time someone updated the AI on FH2.
Will the bots obey verbal commands? Such as "Follow me", or "hold fire".
BF2 won't work on Windows 7, so I ported it to mac. Don't worry, I can easily install it if its in .exe form.

+2 votes     reply to comment
dodgevipergts
dodgevipergts Nov 23 2012, 11:19am replied:

BF2 does work on windows 7

+1 vote     reply to comment
DJ_Barney
DJ_Barney Nov 5 2012, 10:11am replied:

Yes, it is an update of the AI. But it uses the AI functions that were always there, at least it will in the initial release. But game play can be quite different because the bot behaviour is changed (see details above). The bottom line is that Battlefield 2 can be made to be "multithreaded" (or multicore compatible as many games are advertised as being these days) which extends bot behaviour. But this is not a case of simply flicking on a few settings. Its tricky to set up the server and client for this and it requires a lot of testing. Plus the mod intends to make this fun and easy to use. Because the client is running with a server its difficult to change the running map without swapping out of BF2 and restarting the server (especially if your are just a single player). This can be made easy by using the in client map voting menu - the drop down list in the BF2 GUI. I want to make it easy :)

+2 votes     reply to comment
scopedknife
scopedknife Sep 12 2012, 6:21pm says:

Do the bots use sprint?

+2 votes     reply to comment
DJ_Barney
DJ_Barney Nov 5 2012, 10:13am replied:

Not in the initial release. There won't be any added bot behaviours. It may be possible to do that using Python scripting. We'll see.

+2 votes     reply to comment
Mushroomman
Mushroomman Sep 4 2012, 6:57pm says:

Oh god, if this mod dies, I will kick a baby.
Any chance single player support could be added to some of the multiplayer maps? Unless it's dead...

+2 votes     reply to comment
DJ_Barney
DJ_Barney Sep 12 2012, 8:19am replied:

A mod never dies ... it just becomes community property <grin>. It will be released when its ready. Single player support for some maps is another issue. The FH devs as well as the community can do that.

+3 votes     reply to comment
Simcardo
Simcardo Nov 14 2012, 9:29pm replied:

You were always able to do that

+2 votes     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Battlefield 2 Icon
Platform
Windows
Developed By
DJ_Barney
Contact
Send Message
Release Date
TBD
Mod Watch
Track this mod
Share
Style
Genre
Tactical Shooter
Theme
War
Players
Single & Multiplayer
Embed Buttons

Promote HABAI on your homepage or blog by selecting a button and using the HTML code provided (more).

HABAI
HABAI
Statistics
Rank
2,415 of 22,302
Last Update
6 months ago
Watchers
94 members
Addons
1
Files
1
News
5