Overclockers Australia!
Make us your homepage. Add us to your bookmarks  
Major Sponsors:

News Archive

Articles & Reviews

Folding Team
Seti@Home Team
Climate Prediction

OCAU Sponsors
Online Vendors
Motorcycle Club

Timedemo Benchmarking in BF2 Demo
Date 21st June 2005
Author Arithon
Editor James "Agg" Rolfe

Agg note: Arithon sent this article in as news, hosted as a zipfile on his friend's webspace. I thought it was interesting enough to become an OCAU article, so with his permission I've reproduced it here. You can grab the files mentioned in the article from our mirror here (350kb). The Battlefield 2 demo, all 572MB of it, is here.

There's a few benchmarks around of various Battlefield 2 system components and video settings tweaks. Most of them are done in a haphazard way, with straight playback of a Battle Recorder file with the camera locked to one view, and no real consistency. With the help of BadSplat, I've come up with a way to produce demo files with decent camera tracks and a process for using them in a timedemo benchmark with statistics output (including detailed frame-per-frame statistics).

GameDir - where you installed BF2 to. Default is Program Files\EA Games\Battlefield 2 Demo

Package Instructions:
Extract the package into your Battlefield 2 Gamedir with paths enabled. That should give you these files:

  • Benchmarking-Readme.txt - text of this article
  • Demo.cmd - From EA Games (Community update 6/10/2005) - I've added to this to include +width and +height parameters, and the +nosound parameter
  • BF2 Video Config Generator.exe - used to modify default video.con settings
  • sample.bf2demo - optional, sample demo
  • sample-def.bf2demo - optional, default camera recorded with sample demo
  • sample.bf2cam - optional, user recorded camera
Microsoft .NET Framework 1.1 - required to run "BF2 Video Config Generator.exe" If you don't want to use that app, then you don't need the Framework.

Recording a Demo:
This can be done in-game, at any time. You will have to be the server of the game, so either start up a single-player match with bots, or start a multiplayer map with a few friends. You can also source a Battle Recorder file from a server that has it enabled, but then you are limited to a demo of the entire game instead of a section that you choose.

Once the game has started, and you're at the point where you want to start recording, open the console ("`") and type:


The demo will start recording at that point. Wait until you have enough footage, and then in the console, type:

demo.stopRecording (pretty simple huh?)

You will now have 2 files saved in the gamedir\mods\bf2\Demos directory, .bf2demo and -def.bf2cam. The second file is a camera file that is recorded for you of the view from about a foot behind the players head. Well, that's when you're moving, otherwise it tends to be right inside your head.

Now that you have the demo files, its time to record your camera movements.

Recording Camera Movements:
Right, now the power of demo.cmd comes into play. This file has been kindly written by EA and performs a bunch of commands for you. Effectively it builds a demo.tmp file that tells the game what actions to perform.

First, start a shell and navigate to your gamedir. Just for interest, run demo.cmd to see the help.

To see what the default camera looks like, try the following:
demo.cmd sample sample-def
This plays back sample.bf2demo, with the sample-def.bf2cam camera file.

I would suggest getting familiar with the following camera commands in your demo first by executing:
This starts playback of your demo with no camera, giving you the oppurtunity to have a play.

Now, to record a better camera track for your new demo, type:
demo.cmd +c
The game will load, and the demo will be paused. This give you a chance to get your camera into position before recording. Just for reference, here is a copy of the controls available to you in demo mode (courtesy of the BF2 readme.txt file.)

As well as using the 'Q' and 'T' keys to control the playback of a
recording, you can also use a set of keyboard shortcuts:

- Keys 1 - 9
Change the playback speed.
- Toggle Free Camera / Player Camera
Alt Fire Key. By default this is the Right Mouse Button.

While in free camera mode:
- W, A, S, D
Move forwards, backwards, strafe left and right.
- Double Tap W
Move camera quickly. Alternatively you can hold the Sprint key.
- Crouch / Prone
Move camera up and down.
- Mouse
Rotate camera.

While in the player follow camera mode:

- Space bar
Next / previous player.
- W and A or the mouse scroll wheel
Zoom camera in and out.
- Crouch / Prone
Tilt the camera up and down.
- Mouse
Rotate camera around the player.

So get your camera into position, and start the demo playback. I would suggest a slower speed (25%) as it gives you more time to move the camera around. I would also check to see what effect holding the Shift key has on your system. On my system where I have always-run set on, the shift key actually slows the camera movement down, making for better camera motions. Also note that you can pause the playback, move the camera elsewhere, and continue the playback again to cut around the battlefield.

When the demo is over, it should pause. If it crashes out of Battlefield 2 at the end of the demo (or before where the end *should* have been) then the demo file is corrupt and you will need to re-record the demo from scratch. Give the game a few seconds, then bring the console down and type "quit".

Congratulations, you have now successfully recorded your camera file. It has been saved into the gamedir\mods\bf2\Demos directory along with the demo itself. You can view your masterpiece by typing:

For example, to view the sample demo type:
demo.cmd sample sample

Now you're probably wondering exactly what graphics settings is the game using to display the game in demo playback? Thats detailed in the next section.

Demo Playback Video Settings:
The demo playback uses settings from the default profiles located at:
My Documents\Battlefield 2 Demo\Profiles\Default

In particular, it uses the video.con file located there for its rendering options. Well, *most* of its options. It actually picks up its resolution from parameters you supply to demo.cmd, for example:
demo.cmd sample sample - rendered in normal size at 800x600 (the default)
demo.cmd +w sample sample - rendered in wide size at 1620x405
demo.cmd +m sample sample - rendered in mini size at 400x300

Initial testing however shows that the game *might* be using the monitor frequency set in the video.con file.

I've also added new +width and +height parameters which can be used like:
demo.cmd +width 1280 +height 1024 sample sample

Another thing to note is that when you save your settings in your own profile, the game updates the default profiles settings too. Why? Because those are the settings the game uses when it first starts up and goes to the profile selection screen. It's figured that that happens, then the player will most likely always choose the same profile and therefore the game will already have all the right settings loaded.

Right, back to the other options. If you execute the supplied "BF2 Video Config Generator.exe" (small program whipped up by me to make video settings easy) then you can modify the video settings of the default profile. First thing the application does is read in the settings from the video.con file already there. When you click Generate, it overwrites the video.con file with a new one containing your new settings.

As per usual, no warranty implied for any damages blah blah blah, run the application at your own risk etc etc. But it doesn't do much other than modify those settings for you in a familiar environment and without you have to start Battlefield 2 or know exactly what numbers match which options in the file.

So, to summarise, set your video settings for demo playback using "BF2 Video Config Generator.exe" and proceed to the next step.

Performing a Timedemo Benchmark:
With the supplied demo.cmd file, this is simple. Simple execute:
demo.cmd +timedemo

For example:
demo.cmd +timedemo sample sample

You can also add the +nosound parameter if you don't want your sound card to influence the results, for example:
demo.cmd +nosound +timedemo sample sample

And of course you can add the +width and +height parameters like so:
demo.cmd +nosound +width 1280 +height 1024 +timedemo sample sample

The demo will execute in timedemo mode, and when it gets to the end might appear to freeze. This is normal. It has in fact popped up a modal-dialog window with your timedemo statistics. Just hit escape to close the modal dialog window and you quit out.

Now, you haven't lost those results, if you look in the gamedir\mods\bf2 there will be 2 files, timedemo_report.txt (the contents of the modal dialog window above) and timedemo_frametimes.csv (a detailed breakdown of frame timing.) If you have a look at timedemo_frametimes.csv and graph the results, you will see it starts off with apparently extremely high framerates, and then drops down to something more sensible. In fact, the game seems to start recording frames as soon as the game is loaded, even before you hit the Join button; the earlier frames are when the game is displaying the briefing screen! Kind of nutty, but there yah go, just thought you should look out for it. Looking at timedemo_report.txt, the "Average Frame Rate" figure seems to be pretty far off from that calculated from the timedemo_frametimes.csv file and I suspect that the average it comes up with includes some of the time at the briefing screen.

Something else to keep in mind is the internal 100fps game tick which means the game shouldn't (on average) run faster than 100 fps. So accurate benchmarking may require choosing certain settings in order to bring about an average less than that.

So that's it, how to perform proper, consistent benchmarking with Battlefield 2. Thanks to BadSplat for his help during initial investigation and to Super-T for originally hosting this file. Feel free to share this with anyone.

We have a thread in our Games forum for comparing benchmarks and other feedback about this article.

All original content copyright James Rolfe.
All rights reserved. No reproduction allowed without written permission.
Interested in advertising on OCAU? Contact us for info.

Hosted by Micron21!

Recent Content

Crucial P1 1TB NVMe M.2 SSD

AMD Ryzen Threadripper 2970WX and 2920X

Team Group T-Force Delta R RGB SSD

FSP Amport 62 6-port USB Charger

Synology Routers, RT1900ac & RT2600ac

Getting Started with Arduino

ADATA Ultimate SU800 256GB SSD