Useful Debugging Commands

#### Useful Debugger Commands

There are many. I've enclosed optional parameters in square brackets. You enter these commands from the game console (press ~). There is also an autocomplete feature that is very useful. Once a command is started, pressing the tab key will finish the command as far as possible. If there is more than one possible completion, pressing tab twice will show a list of possible completions. Hitting tab one more time will show a list with parameters as well. A bool or boolean is a 0 or 1. The three I use the most are:

* game.enableFreeCamera bool
* game.useHud bool
* renderer.vertexFogEnable bool

So I can move around freely and view the map clearly. Here are a few that display useful debugging information onscreen. To turn on AI deubugging:

* game.showAIStats [bool] - turn off/on ai debugging.

Once AI debugging is on, you can selectively turn on or off certain debugging information with these:

* ai.showAll bool
* ai.showBot bool
* ai.showStrategic bool
* ai.showBotStats [bool]
* ai.showBotUrgencies [bool]
* ai.showBotSpawnCoord [bool]
* ai.showBotSense [bool]
* ai.showStrategies [bool]
* ai.showSAIStats [bool]
* ai.showStrategicAreas [bool]
* ai.aiMeshRendering [bool]

Collision meshes are displayed with:

* standardMesh.drawCollisionLods [-1,0,1]

-1 turns it off, 0 & 1 render the different collision mesh lods. And you can view object portals with:

* portal.showStats [bool]

These commands are interactive and should not be used at the same time:

* game.aiSensingDebugingActive [bool]
* game.aiPathfindingDebugingActive [bool]

The AI sense debugging is useful to determine the exact coordingates of an object. Position an object in the center of the screen and click fire. With AI pathfinding debugging active, click the fire button to mark a starting position (a white circle) and again to mark the ending position of a path. Its also useful for determining the exact coordinate of a spot on the terrain, since the coordinates are displayed onscreen. Also, when AI pathfinding or senseing debugging is active, you can use these commands to tune the information displayed:

* aiTools.pathfindingVehicle [0-4]
* aiTools.pathfindingMode [local,strategic,full]
* aiTools.sensingMode [0-4]

If you would like the camera to follow the bots around, use:

* ai.attachCamera
* ai.attachCameraCycle

The debug logs may be huge, but here are a few commands that make them even larger:

* ai.pathfindingDebugLevel [uint]
* aiStrategicArea.enableDebug [bool]
* aiStrategy.enableDebug [bool]
* animationStateMachine.debugMode bool
* game.debugDamage [bool]

Here are a few more console commands that provide onscreen information:

* game.drawDebug [bool]
* game.clearDebugLines

The first command, drawDebug, will eventually flood the screen with lines that do not get cleared. The second command, clearDebugLines, is needed to erase the existing lines.

This command is a cheat, since it displays both teams in the minimap, but might be useful while developing it:
hud.toggleDebugMapThese 2 commands provide performance information onscreen:

* console.showFPS [bool]
* console.showStats [bool]

These can be used to turn different types of rendering on or off:

* renderer.drawObjects [bool]
* renderer.drawOpaqueObjects [bool]
* renderer.drawSky [bool]
* renderer.drawTerrain [bool]
* renderer.drawTranslucent [bool]
* renderer.drawTransparentObjects [bool]
* renderer.drawTrees [bool]

These commands dump files into various places off the game's root folder:

* aiStrategicArea.saveAll
* animationStateMachine.saveAnimationCache
* Editor.saveAllObjects [string]
* Editor.saveAllSpawners
* Editor.saveAllTemplates
* Editor.saveAllTemplatesAndObjects
* Editor.saveAllUsedTemplates filename
* Editor.saveSpawners bool bool bool
* geometryTemplate.saveAll
* lodSelectorTemplate.saveAll
* materialManager.dumpMaterialList
* object.saveAll
* objectTemplate.saveAll
* sky.saveAll
* TerrainEditor.saveHeightMap
* TerrainEditor.saveRoadMap
* weather.saveAll

I'm still going thru them all looking for more goodies. I've been playing with the weather commands, but have had no luck with them yet. I did notice that when I entered:

* weather.initWeather

Another group of commands appeared that go with it:

* wPart.acceleration
* wPart.active
* wPart.centerAroundObject
* wPart.close
* wPart.color
* wPart.displacement
* wPart.fadeInValue
* wPart.fadeZ
* wPart.getTexture
* wPart.numParticles
* wPart.partSize
* wPart.pointSpriteMaxSize
* wPart.pointSpriteMinSize
* wPart.radius
* wPart.random
* wPart.removeAll
* wPart.scale
* wPart.setTexture
* wPart.speed
* wPart.type

It appears that the weather was meant to be like an effect, but may never have been implimented in bf. It's not used anywhere in the game. If anybody has any luck with this, please let me know. I would love to see a battle in a rain storm.