Forgotten Hope Public Forum

Forgotten Hope 2 => Singleplayer and Coop => Topic started by: Kev4000 on 17-03-2011, 16:03:07

Title: performance improvement
Post by: Kev4000 on 17-03-2011, 16:03:07
Just a thought for you SP'ers out there.

Run a BF2 dedicated server in LAN mode:
C:\Program Files\EA GAMES\Battlefield 2\BF2ServerLauncher.exe

Open task manager - processes - right click "bf2_w32ded.exe" and set affinity CPU1 only.

Then run BF2, and do the same in task manager just set it to CPU0 only. Then join local.

This may increase performance by quite a bit, since you'll use one CPU core for processing bots, and another for the game.
Title: Re: performance improvement
Post by: kummitus on 17-03-2011, 17:03:59
(http://i218.photobucket.com/albums/cc249/warchief_album/screen277.jpg)

Fps wise it works but the bots tend to teleport from one place to another :P
Title: Re: performance improvement
Post by: Raziel on 18-03-2011, 08:03:35
Will try it this weekend! Thanks Kev  ;D
Title: Re: performance improvement
Post by: Michael Z Freeman on 24-03-2011, 01:03:14
Yeah, I was wondering about this. Just never got round to trying it. Does this work then ?
Title: Re: performance improvement
Post by: Raziel on 24-03-2011, 09:03:43
Didn't have time to test it last weekend....was busy filming my latest FH2 film  ;D
Title: Re: performance improvement
Post by: Michael Z Freeman on 24-03-2011, 10:03:48
OK, I'll give this a test on my quad core. FH is noticeably slower (framerate drop) than other mods I have that run very smoothly ... even with only 48 bots.

Will look forward to the film !   :D
Title: Re: performance improvement
Post by: Michael Z Freeman on 24-03-2011, 22:03:08
Don't know why I never tried this. Anyway, better late than never.

On my quad core I put the server on CPU0 and BF2 on CPU2 (Affinity util recommended). I ran Libisey with 64 bots and x2 anti-aliasing.

Here are the averages from FRAPS.

BF2 ONLY

Frames, Time (ms), Min, Max, Avg

  6869,    194384,   0, 101, 35.337

SERVER & BF2

Frames, Time (ms), Min, Max, Avg

 24356,    476502,   0,  96, 51.114

Looks good but this is the first time I've done this. Num of frames is different between the tests and frame rate changes depending on built up / open area. I'd like to run a few more tests.

This is good advice anyway as I think I have a performance increase running BF2 on it's own (without the server) on CPU2 as I think the system as background tasks on CPU0. Why wasn't I doing this before  ::).
Title: Re: performance improvement
Post by: kummitus on 25-03-2011, 11:03:15
What cpu you got? Or actually what clock speed?
Title: Re: performance improvement
Post by: Michael Z Freeman on 25-03-2011, 13:03:26
Intel Core 2 Quad Processor Q6600, (8M Cache, 2.40 GHz, 1066 MHz FSB) .
Title: Re: performance improvement
Post by: kummitus on 25-03-2011, 13:03:03
Ye just wondered that those are not the best possible results. I guess some dualcore 3.5ghz cpu could almost do with some 200ish bots as my 3.2ghz i7 runs the game around 30fps when 255 bots but the server is on it's knees and 30fps+ with only game and 127 bots with ease
Title: Re: performance improvement
Post by: Michael Z Freeman on 25-03-2011, 17:03:59
As I said, its only an initial basic test; ie. not very scientific.

255 bots ? Do you know that bf2 will only handle 108 bots (hard coded) ? The other 147 will just stand around and do nothing  ;D.
Title: Re: performance improvement
Post by: kummitus on 26-03-2011, 11:03:45
atleast they eat cpu power as 127 is smooth and 255 is not
Title: Re: performance improvement
Post by: Devilman on 26-03-2011, 13:03:28
Do you know that bf2 will only handle 108 bots (hard coded) ? The other 147 will just stand around and do nothing  ;D.

Do you know,thats not true
the number 108 comes from,
9 squads (alpha to India)
6 soldiers per squad =54
2 teams multiplied by 54 =108

these 108 bots will receive and follow commander orders
the remaining bots which arent in squads will follow the maps objectives,use vehicles as usual and will engage enemies with their handweapons when within their handweapons AI range
but they do not stand around and do nothing

200 bots,46 unassigned on each team,and all of them moving to the next flag and engaging enemies

(http://i135.photobucket.com/albums/q137/DEVILMAN_09/200bots.jpg)
Title: Re: performance improvement
Post by: kummitus on 26-03-2011, 13:03:54
I wonder how easy it would be to implement that increased squad size what 128 player server has to sp and make more bots to join squads
Title: Re: performance improvement
Post by: Michael Z Freeman on 26-03-2011, 16:03:31
Do you know that bf2 will only handle 108 bots (hard coded) ? The other 147 will just stand around and do nothing  ;D.

Do you know,thats not true

...

200 bots,46 unassigned on each team,and all of them moving to the next flag and engaging enemies

OK. I stand corrected. The extra bots just don't receive commander orders, but they do something. Cheers.
Title: Re: performance improvement
Post by: Ajs47951 on 27-03-2011, 07:03:45
(http://i51.tinypic.com/aazxb8.jpg)
(http://i53.tinypic.com/158v21.jpg)


255 bots  the bots in the frist pic were just standing around the hole game
ever thing was on max gfx i just lowered the quality in Photoshop so i did not have to upload as much "yes my upload speed sucks ass"

I was get 105-160fps with 255bots

pc specs
Processor  AMD Phenom II X6 Black. Model 1090T 3.8hghz 16m Cache "overclock to 4.2ghz"
RAM DDr3 8gigs "overclock" cant remember what rate  
GPU "old buying new one" 2-9800gtx2 sli 1gig each card default clock
hard drive 2-640gig raid 0  1-2.4tb "just for storing stuff like torrents ISO.....
psu 1000w coolmaster
Title: Re: performance improvement
Post by: Devilman on 27-03-2011, 10:03:36
BF2
Gulf Of Oman 16 Size SP
255 Bots
Run in normal SP mode,and not in the above described "performance improvement" mode
Equal teams
Map starts with the US, only having the beach flag
Below pic shows the 74 bots not in a squad have moved away from the beach flag,where they originally spawned

(http://i135.photobucket.com/albums/q137/DEVILMAN_09/255bots.jpg)
Title: Re: performance improvement
Post by: cannonfodder on 27-03-2011, 11:03:34
In short, the idling bots is caused by a problem with the AI in FH2, not BF2.

Even with 64 (or less) bots in FH you'll get a number of bots standing around doing nothing, usually AT bots.


On topic: Haven't tried it yet, but what a top idea. Nice one Kev... :)
Title: Re: performance improvement
Post by: YaPh1l on 27-03-2011, 13:03:39
96 bots works without big lags with this method while using only BF2 starts lagging with 48 bots for me. Thanks!
But I have some questions:
- How do I balance the bots correctly? When using BF2 to start a server I set AIDefault.ai to the max. number of bots (96), bot ratio to 100 and bot count to 48 and both teams have 48 bots. But somehow the server works differently.
- How can I set different map sizes. Event with MaxPlayers set to 64, the serevr uses the 32 player size. Is this even possible?

Best regards, Phil.
Title: Re: performance improvement
Post by: Devilman on 30-03-2011, 14:03:18
OK. I stand corrected. The extra bots just don't receive commander orders, but they do something. Cheers.

It seems that the so called "active bot limit",has been a common misconception for years
Even one of the BF2/DICE coders,Power Poker,was under the same impression
Even though he did a lot of AI coding for DICE himself  ???

(http://i135.photobucket.com/albums/q137/DEVILMAN_09/PPSQUADS.jpg)
Title: Re: performance improvement
Post by: djinn on 31-03-2011, 17:03:29
So what orders DO those extra bots get. I sure see everyone charge in hell for leather when i have 120 bots, but i can't tell if they are just engaging enemy as they see them, or moving to cap flags.
Title: Re: performance improvement
Post by: lemonwire on 01-04-2011, 16:04:27
96 bots works without big lags with this method while using only BF2 starts lagging with 48 bots for me. Thanks!
But I have some questions:
- How do I balance the bots correctly? When using BF2 to start a server I set AIDefault.ai to the max. number of bots (96), bot ratio to 100 and bot count to 48 and both teams have 48 bots. But somehow the server works differently.
- How can I set different map sizes. Event with MaxPlayers set to 64, the serevr uses the 32 player size. Is this even possible?

Best regards, Phil.

I also can confirm that there is a huge FPS boost when using the dedicated server method with 96 bots, I'd usually be stuttering with this amount on normal bf2.
also I'd like to know the answers to Phil's questions,
If I can't get even teams with higher numbers, there won't be any point using the dedicated servers method since I have high fps with lower bot amounts anyway. But this looks really really promising.

Edit: Actually, even with only 64 bots, using the dedicated method, there is a HUGE fps boost especially on maps that used to be EPIC laggy for me, such as Anctoville, thanks a bunch for the great suggestion!
Title: Re: performance improvement
Post by: YaPh1l on 02-04-2011, 00:04:52
I think I figured out the answers to my questions.
Here is what I did step by step for FH2 (but should work with any mod):
Open Program Files\Battlefield 2\mods\fh2\AI\AIDefault.ai with notepad
Back it up before proceeding!
Change aiSettings.setMaxNBots BOT_NUMBER to the total number of bots you want ingame.
Save it.

Go to Documents\Battlefield 2\ServerConfigs
- Open _serverSettings.con with notepad
Change sv.coopBotCount BOT_NUMBER to the half of the number you saved in AIDefault.ai
Change sv.coopBotRatio BOT_RATIO to 100
Change sv.coopBotDifficulty BOT_DIFF to the difficulty level you want (10-100)
Save it.
- Open _mapList.con with notepad
For each map write one line with MapList.append MAP_NAME gpm_coop MAP_SIZE
Note that MAP_NAME has to be the name of the map's folder and MAP_SIZE has to be valid.
Save it.

Open a command prompt
Execute cd "Your Install Folder Of\Battlefield 2"
And then Bf2_w32ded.exe +ai 1 +gameMode gamemode +config "@HOME@/ServerConfigs/_serverSettings.con" +mapList "@HOME@/ServerConfigs/_maplist.con" +modPath mods/fh2 +ignoreAsserts 1

Set the affinity of the process(es).
And don't forget to change AIDefault.ai back to it's original state.

Best regards, Phil.
Title: Re: performance improvement
Post by: Michael Z Freeman on 17-04-2011, 20:04:08
I have not tried that method yet but it looks similar to what I just got working using BF2CC. Here is a guide I wrote ...

Setting up a Coop or SP Battlefield 2 Game on a Multi Core Machine (http://gateway.djbarney.org/freelinking/Setting%20up%20a%20Coop%20or%20SP%20Battlefield%202%20Game%20on%20a%20Multi%20Core%20Machine)

That produces 64 bots equally balanced between each team, but I have not yet tried more than 64 bots.

Plus I have a question. I think I need to add the FH server files. If so then do I just add all the SP fixes again ?