Welcome to HABAI - Hardware Accelerated Battlefield AI

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

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

Very special thanks to everyone at battlefieldsingleplayer.com for keeping single player / coop alive. 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. Thanks to bfeditor.org for technical support. 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: Progress update: Focus on AIX2 and some discoveries about patch 1.5

0 comments by DJ_Barney on Nov 23rd, 2012

I've been furiously testing HABAI. CPU's have been left glowing white hot ! I've discovered that a few problems that I've had have been due to using Battlefield 2 (BF2) patch 1.5.

So I installed a 1.41 version of BF2 and what a pleasure it is to use for a single player like me ! Now I can be in a squad and have full access to commander resources. AIX2 is also a pleasure to use in 1.41 as this is what it was designed for. What a shame that EA ruined this with the 1.5 patch, and with one of the major BF2 mods out there. Maybe they will amend their error one day, AIX2 devs would certainly deserve that.

Talking of AIX2, I am concentrating on an AIX2 release now (I need to change my mod page graphics). This makes sense as AIX2 has always been the mod aimed at bot game play. This is where the full benefits of HABAI can be seen - where the bots have access to as many functions as possible.

So now in 1.41 I can join a squad when the maximum number of squads has been reached AND become the squad leader.

AIX2 HABAI squad join with max squads

1.5 would not allow this. This changes everything as the maximum number of bots is no longer an issue. The actual sane upper maximum is 108 bots in total as any more bots than this will not have orders from the commander and will stay in the area where they spawn. However they should react to nearby enemies. Machines with bigger CPU frequencies per core will be able to run more bots. But there may also be a limitation related to BF2 net code. I'm getting some occasional hit delays (there is a delay between a hit on a soldier and the actual death animation). However for the improvement in bot intelligence and reaction to their environment it would be small thing to put up with, and remember BF2 was probably never designed to have this many bots in it. This may all get cleared in further testing and settings tweaking

I need to do some more benchmarking but the best thing about all this is the stability of BF2 with the HABAI setup. In fierce bot encounters the frame rate on my machine can drop from ~50-60fps down to ~25fps but it's hardly noticeable. Before this set up I would get severe immersion killing stuttering with this number of bots in a game started from inside the client.

Keep on eye on Battlefieldsingleplayer.com in the next few weeks as I will be releasing something for others to test.

Downloads RSS Feed Latest Downloads
HABAI testing release for ArmA:OA

HABAI testing release for ArmA:OA

Sep 12, 2012 Singleplayer Map 5 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  (0 - 10 of 40)
TheManwithafan
TheManwithafan Jan 15 2013, 11:49pm says:

Just wondering, is it possible for Squad Leaders in 1.5 to be modded so that they can use artillery strikes?

+2 votes     reply to comment
Tech-E
Tech-E Dec 27 2012, 5:15pm says:

This mod is not release yet ?

+3 votes     reply to comment
josemw2playa
josemw2playa Nov 25 2012, 4:53pm says:

Will this cause lag while playing FH2 singleplayer??

and is it possible that there will be a version for us BF2 1.5 users??

Anyways it's looking good! :)

+1 vote     reply to comment
aj8898
aj8898 Nov 23 2012, 11:33am says:

Can you make bots pick you up in a chopper or car (in aix) because they leave me with only one person in a blackhawk and when I ask for a pickup, they always say no and fly away :'(

+4 votes     reply to comment
MasterofMetal
MasterofMetal Oct 24 2012, 2:42am says:

Why ARMA?

+3 votes     reply to comment
DJ_Barney
DJ_Barney Nov 5 2012, 10:01am replied:

Because the technique (detailed above) is the same for ArmA and improves performance. But I know ArmA is not for everyone so I'm now working on a proper release for HABAI for Battlefield 2 that will include Forgotten Hope, AIX2 as well as a template to use for other mods. ArmA will come later as I'm only in the initial stages of testing.

+2 votes     reply to comment
Simcardo
Simcardo Nov 14 2012, 9:27pm replied:

Can you guys make one for Project Reality sometimes?

+3 votes     reply to comment
DJ_Barney
DJ_Barney Nov 21 2012, 12:13pm replied:

Eventually. A release for AIX2 and/or FH is the priority. PR is more tricky because they enforce install of PR into a 1.5 patch BF2. HABAI runs a lot better on 1.41 because 1.5 broke so many SP/Coop/AI elements. But if people really want it I could do a release for PR 1.5 anyway.

+4 votes     reply to comment
JonathanPL
JonathanPL Nov 23 2012, 4:18pm replied:

It'd be lovely!

Like someone stated most players play 1.5, due to the fact that's the official server versions. (FH2 player here)

+1 vote     reply to comment
Simcardo
Simcardo Nov 21 2012, 12:15pm replied:

Well that's okay, Just later when your first priorities are done.
And i really love that you guys are making this for ArmA 2, So i guess that should be finished first!

But anyway, Most people play FH2 on 1.5 because you can't play FH2 Multiplayer in 1.41

+4 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
Statistics
Rank
4,163 of 19,331
Last Update
6 months ago
Watchers
58 members
Addons
1
News
3