fann þetta….
Command Line
There are a range of commands - mainly designed for servers running BF2 - which can be activated via the BF2 command line. You can use these commands by going to your main Battlefield 2 shortcut you use to launch the game, right-click on it and select Properties. Then in the Target box, after the “C:\Program Files\EA Games\Battlefield 2\BF2.exe” +menu 1 +fullscreen 1 text, insert another space, then use any of the commands below. Each command must have a single space between it and the next command.
For example, one of the most commonly requested commands is to run BF2 in 1280x1024 resolution (or another custom resolution) - particularly for LCD displays which display the best image at their native resolution. To do this, change your command line to look like this:
“C:\Program Files\EA Games\Battlefield 2\BF2.exe” +menu 1 +fullscreen 1 +szx 1280 +szy 1024
Note the addition of the +szx and +szy commands which respectively set the width and height of the resolution to be used. Substitute other values for other resolutions (e.g. +szx 1900 +szy 1200). Also note that as of the 1.03 Patch, 1280x1024 is now a supported resolution and can be selected within the in-game settings, so you don't need to use the +szx/+szy commands to force it anymore.
The following are the known command line commands for BF2, and descriptions where possible:
+playerName - Set the player name
+playerPassword - Sets the player password
+joinServer - Join a server by IP address or hostname
+fullscreen - Start game in full screen mode
+nosound - Start game without sound
+szx - Set resolution width
+szy - Set resolution height
+dedicated - Start in dedicated server mode
+multi - Allow starting multiple BF2 instances
+password - Set the server password when joining a server
+config - Sets path to the ServerSettings.con file to use
+maplist - Sets the path to the MapList.con file to use
+lowPriority - Run the game with slightly lower priority
+loadLevel - Set the level to load
+wx - Position game window on the screen at certain x-position
+wy - Position game window on the screen at certain y-position
+demo - Sets the con-file with demo options
+maxPlayers - Sets max players
+gameMode - Sets the game mode
+modPath - Sets the mod path (default /mods/bf2)
+help - Displays help
+ranked - Allows GamSpy snapshot sending
+playNow - Use PlayNow functionality
+port - Specifies the network port to be used
+pbPath - Set the path to use for PunkBuster on multi-instance configs
+hostServer -
+checkForAvailablePatch -
+checkForPatch -
+ai -
+restart - skips intro movies
Note: You must use the correct case for these commands to work - for example the +playername command only works if used thusly: +playerName - note the capitalized N. These all work as of the latest version, including commands like +joinServer.
As you can see, most of these commands are really only useful for those running BF2 servers, and the descriptions are fairly vague. As I find out more useful commands I will add to this list.
Renderer Commands
renderer.drawHud [0,1] - Turns the Heads Up Display (HUD) on or off.
renderer.drawConsole [0,1] - Turns off access to the in-game console if set to 0.
renderer.drawFps [0,1] - Displays the current frames per second (FPS) and the time in milliseconds between frames.
Game Commands
game.sayAll [string] - Says the specified text in global chat
game.sayTeam [number] [string] - Says the specified text in team chat
game.lockFps [framerate] - Caps the game's maximum framerate to specified number
game.allowToggleFullscreen [0,1] - If set to 1 allows toggling of fullscreen/windowed mode
game.toggleFullscreen - Toggles between fullscreen and windowed mode
Demo Commands
demo.recordDemo [demoname] - Starts recording current gameplay and saves the file as demoname.bf2demo in your \Program Files\EA Games\Battlefield 2\mods\bf2\Demos directory
demo.stopRecording - Stops current demo recording
demo.ShutdownDemo - Stops and closes down current demo run
Localprofile Commands
localProfile.setName [name] - Shows/Sets the name for your current account
localProfile.setNick [nick] - Shows/Sets the nickname for your current account
localProfile.setGamespyNick [GameSpyNick] - Shows/Sets the GameSpy login name for your account
localProfile.setEmail - Shows/Sets the email account for the current account
localProfile.setPassword [password] - Shows/Sets the password for the current account
localProfile.setNumTimesLoggedIn [number] - Shows/Sets the number of times the player has logged in with the current account
localProfile.setTotalPlayedTime [seconds] - Shows/Sets the time the game has been played using the current account
localProfile.save -
localProfile.addDemoBookmark [ ] - Adds a bookmark to a Battlerecorder demo
Globalsettings Commands
globalSettings.setDefaultUser [number] - Sets the profile to use, the first one being 0001, then 0002 etc.
Sv Commands
These commands are used to adjust server settings, particularly in the Serversettings.con file under your \Documents and Settings\[username]\My Documents\Battlefield 2\Profiles\[profile]\ directory.
sv.allowNATNegotiation [0,1] -
sv.interface -
sv.timeBeforeRestarting [0,1] -
sv.autoBalanceTeam [0,1] -
sv.teamRatioPercent [0,1] -
sv.autoRecord [0,1] -
sv.demoIndexURL [address] -
sv.demoDownloadURL [address] -
sv.autoDemoHook -
sv.demoQuality -
sv.adminScript -
sv.sponsorText -
sv.sponsorLogoURL [address] -
sv.communityLogoURL [address] -
sv.radioSpamInterval -
sv.radioMaxSpamFlagCount -
sv.radioBlockedDurationTime [seconds] -
sv.useGlobalRank [0,1] -
sv.useGlobalUnlocks [0,1] -
sv.friendlyfirewithmines [0,1] -
Gamelogic Commands
gameLogic.togglePause - Toggles pausing the game.
Settingsmanager Commands
These commands set a range of variables. E.g. SettingsManager.boolSet GSUseObjectCache 1. The command used must match the type of variable (e.g. .boolset for Boolean variables, .IntSet for variables requiring integer input, etc.)
SettingsManager.stringSet -
SettingsManager.boolSet -
SettingsManager.IntSet -
SettingsManager.floatSet -
SettingsManager.u32Set -
SettingsManager.stringGet -
SettingsManager.boolGet -
SettingsManager.intGet -
SettingsManager.floatGet -
SettingsManager.U32Get -
Inputdevices Commands
InputDevices.setInvertAxis -
InputDevices.setAxisScale -
Controlmap Commands
These settings should be used in the Controls.con file under your \Documents and Settings\[username]\My Documents\Battlefield 2\Profiles\[profile]\ directory.
controlMap.deleteControlMap -
controlMap.dump -
controlMap.setButtonRiseTime -
controlMap.SetButtonFallTime -
controlMap.SetDoubleTapTime -
controlMap.addAxisToAxisMapping [string] -
controlMap.addButtonsToAxisMapping [string] -
controlMap.addKeyAndButtonToAxisMapping [string] -
controlMap.addKeysToAxisMapping [string] -
controlMap.addButtonToTriggerMapping [string] -
controlMap.AddKeyToTriggerMapping [string] -
controlMap.setAxisScale -
controlMap.setYawFactor -
controlMap.setPitchFactor -
controlMap.addAxisToTriggerMapping -
controlMap.InvertMouse [0,1] - Set to 1 for inverted mouse, 0 for default mouse
controlMap.mouseSensitivity [number] - Determines the sensitivity of the mouse
controlMap.keyboardSensitivity [number] - Deterimes the sensitivity of the keyboard
Maplist Commands
These commands are used to manage lists of maps by server administrators.
mapList.list - Lists map ID numbers, map name, game mode and the number of players if specified.
mapList.configFile [new location for file] - Used to specify the location of the _mapList.con file. Default is \My Documents\Battlefield 2\ServerConfigs\
mapList.load - Makes the server reload _mapList.con
mapList.save - Saves the current map list on the server to the file _mapList.con
mapList.mapCount - Shows the total number of maps in the current map list
mapList.currentMap - Shows the map list ID number of the current map being played
mapList.clear - Clears the current map list
mapList.remove [map ID number] - Removes the specified map from the map list
mapList.append [map name] [game mode] [number of players] - Add a new map to the end of the map list. You must specify the map name and game mode.
mapList.insert [map ID number] [map name] [game mode] [number of players] - Same as mapList.append command, but with this command you can specify at what map ID number to insert the new map into the list.
Cheat Commands
These commands allow several cheats to work, but only in Singleplayer mode
aiCheats.code TheAllSeeingEyeOfTheAIProgrammer - AI Stat Toggle
aiCheats.code BotsCanCheatToo - Bots Cheat
aiCheats.code Tobias.Karlsson - Invincibility
aiCheats.code Thomas.Skoldenborg - Kill Bots
aiCheats.code Jonathan.Gustavsson - Kill Enemy Bots
aiCheats.code WalkingIsWayTooTiresome - New Spawn Location
Admin Commands
These commands are used by server administrators.
admin.listPlayers - Lists the players connected to the server, showing their name, ID number and IP number.
admin.runNextLevel - Forces the server to end the round and start the next map in the map list.
admin.currentLevel - Shows the map list ID number for the current map being played.
admin.nextLevel - Shows the map list ID number for the next map to be played.
admin.restartMap - Restarts the current map.
admin.banPlayer [player ID number] [timeout] - Enter the player ID number you want to ban. Bans the player from the server by using their IP address. The timeout value controls the length of the ban e.g. perm for permanent ban, round to ban them for the rest of the round, and 180 is 180 seconds (3 minutes).
admin.banPlayerKey [player ID number] [timeout] - Enter the player ID you want to ban. Bans the player from the server by using their CD key hash.
admin.addAddressToBanList [IP address] [timeout] - Enter the IP number you want to ban.
admin.addKeyToBanList [CD key hash] [timeout] - Enter the CD key hash you want to ban.
admin.removeAddressFromBanList [IP address] - Enter the IP address to remove from the ban list.
admin.removeKeyFromBanList [CD key hash] - Enter the CD key hash you want to remove from the ban list.
admin.clearBanList - Clears all ban lists.
admin.listBannedAddresses - Displays a list of the currently banned IP addresses.
admin.listBannedKeys - Displays a list of the currently banned CD keys.
admin.kickPlayer [player ID number] - Enter the ID number of the player you want to kick.
Remote Console
These commands are used by server administrators.
To setup remote console access to the server, onthe server create a new plain text document in \admin\ called default.cfg and enter the following text into the new file:
port=4711
password=YourPassword
Save the file, and start the server. Now you can access the server remotely by using the following commands from a client:
rcon login [YourPassword] - Use this command to login to the server.
rcon users - This command lists all the users connected to the server. Very similar to admin.listPlayers
rcon exec [command name] - Replace with a console command you would like to execute on the server. For example: rcon exec admin.kickPlayer 3
Exit - Quits the game to desktop.
That covers the known command list. If you know precisely what a particular command above does (no guesses please), please Email Me and after testing them I will add them to this guide.
The next page concludes the guide with some neat tweaks you may find useful.
Battlefield 2 Tweak Guide
[Page 9] Neat Stuff & Conclusion
The guide is fast coming to a close. The following are some tips and tricks I've found which you may find handy.
Disabling the Intro Movies
The introductory movies to BF2, although fun to watch the first couple of times, fast become quite annoying, adding to the startup times for the game, as well as the memory usage (the main movie is 135MB in size). To disable them permanently, I don't recommend deleting the movie files - this may cause problems with verification of client information on certain servers and/or with Punkbuster.
Instead, simply rename the relevant files in your \Program Files\EA Games\Battlefield 2\mods\bf2\Movies\ directory to something else (e.g. rename the Intro.bik to Intro.backup). The files to rename are: Dice.bik, EA.bik, Intro.bik, Legal.bik and Welcome.bik. This will mean the intro movies are all skipped as BF2 starts to load. If you find the movies playing in the background of the Login screen and Settings screens annoying, you can also rename the menu.bik and menu_loggedin.bik to something else as well.
If you've also renamed/removed the menu.bik and menu_loggedin.bik movies, and don't want a dull grey background in the in-game menus, then download this small BF2_Menu_Logo.zip file (201KB), extract the contents and copy them to your \Movies directory. These small files show the BF2 logo in the background, and look much nicer. Thanks to EdisLeado for preparing these files.
Removing all the original movies from the game can save over 250MB of data being loaded up during the start of the game and being placed into memory - this will help smooth your gameplay particularly for those with less RAM. If for any reason you experience any problems with the game after renaming the movies, simply rename them back to their original names.
Update: Instead of the above, you can simply use the +restart command line command in your BF2 startup icon. See the Advanced Tweaking section.
Automatic Login
If you want to automatically be logged in each time you launch Battlefield 2, edit your BF2 Command Line as follows (See the Advanced Tweaking section for how to edit the Command Line):
“C:\Program Files\EA Games\Battlefield 2\BF2.exe” +playerName your playername +playerPassword your password
E.g: “C:\Program Files\EA Games\Battlefield 2\BF2.exe” +playerName DogMaN +playerPassword Banana1
Basically by using the +playerName and +playerPassword parameters in your command line - along with any other entries you want to put in there - you will automatically be logged in as soon as you start the game, skipping the requirement to click Login on the login screen.
Update: Dennis has emailed me and pointed out that for this to work, the playerName and playerPassword commands are case-sensitive. That is, you must enter them exactly as shown, for example +playerName, not +playername. Furthermore your username and password are case sensitive as well, and must be entered precisely as you have them shown on the login screen. This method works with all versions of BF2, including the 1.12 patch onwards.
AGP Aperture Size Tweak
Many readers have written to me swearing that increasing their AGP Aperture Size to 256MB in their BIOS has greatly improved their performance. For the simple reason that I can neither confirm nor deny this to be the truth, and that it is generally harmless to raise your AGP Aperture Size to 256MB, I am noting this here for those of you with AGP-based graphics cards so you can try for yourself.
If you're wondering what the AGP Aperture Size is (along with other graphics-related BIOS Settings), check page 2 of my ATI Catalyst Tweak Guide or my Nvidia Forceware Tweak Guide. For the record I don't believe this tweak to actually do much, however as I suggest it can't do any real harm to try if you're willing. Just remember that in some games (such as America's Army) raising the AGP Aperture Size to large values can increase memory-related errors, such as Critical Errors, crashes to Desktop and so forth, so keep that in mind while testing this out, and if in doubt set it to 128MB for optimal speed/stability.
Increasing Singleplayer Bots
To increase the number of bots used in singleplayer mode, go to your \Program Files\EA Games\Battlefield 2\mods\bf2\AI directory and open the file aidefault.ai with Notepad or Wordpad (make sure to create a backup copy of it first). Read the instructions in the file which basically involves placing the word REM in front of each of the first 5 lines starting with ‘aiSettings.set’, then removing the REM's in front of the next 4 lines starting with ‘aiSettings.set’. Change the number at the end of the aiSettings.setMaxNBots 32 line to determine the number of bots to use (e.g. aiSettings.setMaxNBots 64 for 64 bots). Note that more bots can really stress your system and hence destabilize it, causing a crash back to desktop - particularly for those with older CPUs. For example, 64 bots on most systems will cause a crash.
Unlocking All Weapons
A lot of people have emailed me asking for this tweak, and the easiest way I know to do it is to use this Weapons Unlocker add-on. Note, as of Version 1.02, this method no longer works, and I don't know any other way of unlocking the weapons in SP at the moment.
Update: Try the tips in this thread, as well as this thread for other methods of getting weapons unlocks in single player mode.
Update 2: As of the 1.4 Patch weapons unlocking is allowed now on unranked servers.
Playing 32 & 64 Player Maps in Singleplayer
Currently there is no way I know to make this tweak work properly. Several astute readers have written in to tell me it is unlikely this sort of tweak will ever work, given that the bots in the game need scripted pathways and the game developers did not invest this time into creating such scripts for the larger maps. Even if you manage to unlock to the larger maps, the bots will ignore the new sections of the map as they are not scripted for those areas. So I would suggest we are stuck with the smaller maps in singleplayer, and check the In-Game Settings section for other ways to play the large maps.
Update: There is now a BF2 64-Player Maps Mod you can try to allow you to use the larger maps in single player. You can also try checking Battlefield SinglePlayer for more custom 64-player offline maps.
Measuring Framerate, Taking Screenshots & Recording Demo Movies
You can use the renderer.drawFps 1 command in BF2 to show your current frames per second (see Console Commands section above). However there is a utility which allows you to do this and much more: FRAPS. This free utility will display a very accurate framerate counter in the corner of the screen. However Fraps also has other handy functions, such as the ability to take screenshots in various formats and even record demo movies which you can play back in a media player outside of BF2. Give it a try as it is a great utility to have on your PC.
Conclusion
The concludes this guide, and in some ways I find it unfortunate that I couldn't find more things to tweak in BF2. It is the pattern with most games from EA Games that there is little genuine ‘tweakability’ allowable, and when combined with the Punkbuster anti-cheat system, experimenting with various tweaks can see you get banned from playing the game online. Therefore the tweaks and tips in this guide are the major ones I have found through testing and research, and most importantly they should all be perfectly safe to use.
If you discover more tweaks or want to provide feedback on the guide at any time (Note that I can't provide tech support), then please Email Me. Thanks in particular to all the readers who wrote to me after the release of my BF2 Demo Tweak Guide, especially Mark Laflamme and Devin Cobaugh. Of course, just like all my other tweak guides this guide will be updated and maintained to make sure it contains all the best tips and tweaks for BF2, so make sure to check back regularly.