BF2.US bf2-rsdeveloper wiki Parity Discord bf2.us
On this page

What goes into an object

An object in a level is an instance of a template, and a template is a small tree: a root with its own property lines, a geometry, a collision mesh, and children that are templates again (seats, wheels, engines, sounds, effects). The village jeep shows the whole chain.

BF22142Heroes

From the level to the jeep#

village places no jeep. Its game mode script places an ObjectSpawner, and the spawner names the jeep per team:

Levels/village/GameModes/gpm_ctf/16/GamePlayObjects.con (retail, the royals' base jeep)
ObjectTemplate.create ObjectSpawner WEST_CPNAME_VV_16_CTF_royals_base_Jeep
ObjectTemplate.setObjectTemplate 2 bri_jeep_willys
ObjectTemplate.minSpawnDelay 10
ObjectTemplate.maxSpawnDelay 10
ObjectTemplate.maxNrOfObjectSpawned 2

bri_jeep_willys itself comes from Objects/vehicles/bri_jeep_willys/bri_jeep_willys.con (its .tweak is included at its end), which creates the geometry, the collision template and the PlayerControlObject with its children.

The tree#

WEST_CPNAME_VV_16_CTF_royals_base_Jeep (ObjectSpawner) Levels/village/GameModes/gpm_ctf/16/GamePlayObjects.con setObjectTemplate 2 bri_jeep_willys (8 lines) bri_jeep_willys PlayerControlObject bri_jeep_willys.con 117 lines S_bri_jeep_willys_Ambient Sound bri_jeep_willys.con 0 lines S_bri_jeep_willys_AmbientDamaged Sound bri_jeep_willys.con 0 lines Willys_SteeringWheel RotationalBundle bri_jeep_willys.con 24 lines S_Willys_SteeringWheel_RotationRpm Sound bri_jeep_willys.con 0 lines Willys_Engine Engine bri_jeep_willys.con 55 lines S_Willys_Engine_RotationRpm Sound bri_jeep_willys.con 0 lines S_Willys_Engine_Idle Sound bri_jeep_willys.con 14 lines S_Willys_Engine_Rpm1 Sound bri_jeep_willys.con 14 lines S_Willys_Engine_Rpm2 Sound bri_jeep_willys.con 14 lines S_Willys_Engine_Load Sound bri_jeep_willys.con 12 lines Willys_Nav_Front_Right RotationalBundle bri_jeep_willys.con 13 lines S_Willys_Nav_Front_Right_RotationRpm Sound bri_jeep_willys.con 0 lines Willys_Wheel_Front_Right Spring bri_jeep_willys.con 14 lines S_Willys_Wheel_Front_Right_Rotation Sound bri_jeep_willys.con 0 lines web_wheelBig WheelEffectBundle web_wheelbig.con 22 lines Willys_Nav_Front_Left RotationalBundle bri_jeep_willys.con 14 lines S_Willys_Nav_Front_Left_RotationRpm Sound bri_jeep_willys.con 0 lines Willys_Wheel_Front_Left Spring bri_jeep_willys.con 14 lines S_Willys_Wheel_Front_Left_Rotation Sound bri_jeep_willys.con 0 lines Willys_Nav_Back_Left RotationalBundle bri_jeep_willys.con 13 lines S_Willys_Nav_Back_Left_RotationRpm Sound bri_jeep_willys.con 0 lines Willys_Wheel_Back_Left Spring bri_jeep_willys.con 14 lines S_Willys_Wheel_Back_Left_Rotation Sound bri_jeep_willys.con 0 lines Willys_Nav_Back_Right RotationalBundle bri_jeep_willys.con 13 lines S_Willys_Nav_Back_Right_RotationRpm Sound bri_jeep_willys.con 0 lines Willys_Wheel_Back_Right Spring bri_jeep_willys.con 14 lines S_Willys_Wheel_Back_Right_Rotation Sound bri_jeep_willys.con 0 lines e_exhaust_small EffectBundle e_exhaust_small.con 28 lines S_e_exhaust_small_Start Sound e_exhaust_small.con 0 lines em_exhaust_small_smoke SpriteParticleSystem e_exhaust_small.con 65 lines Willys_DriverCamera_Rotation RotationalBundle bri_jeep_willys.con 13 lines S_Willys_DriverCamera_Rotation_RotationRpm Sound bri_jeep_willys.con 0 lines Willys_DriverCamera Camera bri_jeep_willys.con 33 lines S_Willys_DriverCamera_RotationRpm Sound bri_jeep_willys.con 0 lines Willys_EntryPoint EntryPoint bri_jeep_willys.con 3 lines Willys_CoDriver PlayerControlObject bri_jeep_willys.con 15 lines S_Willys_CoDriver_Ambient Sound bri_jeep_willys.con 0 lines S_Willys_CoDriver_AmbientDamaged Sound bri_jeep_willys.con 0 lines Willys_Passenger PlayerControlObject bri_jeep_willys.con 15 lines S_Willys_Passenger_Ambient Sound bri_jeep_willys.con 0 lines S_Willys_Passenger_AmbientDamaged Sound bri_jeep_willys.con 0 lines Car_horn GenericFireArm car_horn.con 29 lines S_Car_horn_Fire1P Sound car_horn.con 0 lines S_Car_horn_Fire1P_Outdoor Sound car_horn.con 0 lines S_Car_horn_Fire3P Sound car_horn.con 9 lines S_Car_horn_BoltClick Sound car_horn.con 0 lines S_Car_horn_TriggerClick Sound car_horn.con 0 lines S_Car_horn_SwitchFireRate Sound car_horn.con 0 lines S_Car_horn_Reload1P Sound car_horn.con 0 lines S_Car_horn_Reload3P Sound car_horn.con 0 lines S_Car_horn_Deploy1P Sound car_horn.con 0 lines S_Car_horn_Deploy3P Sound car_horn.con 0 lines S_Car_horn_Zoom Sound car_horn.con 0 lines S_Car_horn_CriticalShotFire Sound car_horn.con 0 lines S_Car_horn_CriticalShotHit Sound car_horn.con 0 lines S_Car_horn_IdleMale1 Sound car_horn.con 0 lines S_Car_horn_IdleMale2 Sound car_horn.con 0 lines S_Car_horn_IdleFemale1 Sound car_horn.con 0 lines S_Car_horn_IdleFemale2 Sound car_horn.con 0 lines e_amphib_wake_small EffectBundle e_amphib_wake_small.con 31 lines S_e_amphib_wake_small_Start Sound e_amphib_wake_small.con 0 lines em_amphib_wake_small_stripe TrailSystem e_amphib_wake_small.con 61 lines e_sinking_vehicle EffectBundle e_sinking_vehicle.con 33 lines S_e_sinking_vehicle_Start Sound e_sinking_vehicle.con 1 lines em_sinking_vehicle_froth NonScreenAlignedParticleSystem e_sinking_vehicle.con 62 lines em_sinking_vehicle_rings NonScreenAlignedParticleSystem e_sinking_vehicle.con 62 lines em_sinking_vehicle_bubble SpriteParticleSystem e_sinking_vehicle.con 64 lines em_sinking_vehicle_spray SpriteParticleSystem e_sinking_vehicle.con 64 lines geometry: BundledMesh bri_jeep_willys Objects/vehicles/bri_jeep_willys/meshes/bri_jeep_willys.bundledmesh collision: bri_jeep_willys Objects/vehicles/bri_jeep_willys/meshes/bri_jeep_willys.collisionmesh network: BasicInfo seats: 0: bri_jeep_willys, 1: Willys_CoDriver, 2: Willys_Passenger columns: template (indent = child depth), class, the file that created it and its kept property lines; generated from bf2_editor --template / --object

The diagram is drawn from the editor's own dump (bf2-editor level.rs: LevelData::object_json for the spawner, LevelData::template_json for the jeep; bf2_editor --object <id> / --template bri_jeep_willys print the same JSON the web editor's inspector gets). The jeep's tree has 69 templates: 3 PlayerControlObjects (the driver's, the co-driver's and the passenger's seat), 6 RotationalBundles (wheels, steering wheel), 4 Springs, an Engine, a Camera, an EntryPoint, a horn GenericFireArm, effect bundles and particle systems, and 42 Sound templates (sounds). A slimmer JSON of the same tree is in docs/dev/assets/img/object_jeep_tree.json for tools (the editor's node graph).

What each part brings#

PartCON lineFile it readsReader
geometryGeometryTemplate.create BundledMesh bri_jeep_willys, ObjectTemplate.geometrymeshes/bri_jeep_willys.bundledmeshbf2-mesh MeshFile::parse (meshes)
collisionCollisionManager.createTemplate, ObjectTemplate.collisionMeshmeshes/bri_jeep_willys.collisionmeshbf2-collision CollisionMesh::parse
materials of the collision facesObjectTemplate.mapMaterial <i> <name> <id>the game's material tablebf2-objects template properties
componentscomponent lines such as ObjectTemplate.armor.hitPoints 120 (the editor's vehicle.armour list)-bf2-objects template/props*.rs (the property tables of each game)
childrenObjectTemplate.addTemplate <name> + setPosition / setRotationthe child's own templatebf2-objects template tree (children)
networkObjectTemplate.networkableInfo-the editor's network section

Every property line remembers the script that set it, so the editor (and this diagram) can say which file to change: the jeep's lines come from bri_jeep_willys.con and the tweak it includes; a level can still override a template with its own ObjectTemplate.activeSafe lines. The CON language itself is on the CON system; changing a vehicle step by step on add a vehicle.

How it is tested#

  • Templates from the shipped scripts: the object tests run the game's own .con and .tweak files through the template host (crates/bf2-objects/tests/retail_levels.rs; skipped without an install); a line the port cannot read fails there.
  • What a constructor leaves in a template against the original's listing (ctor_values_bf2.rs), and the value converters against the original's run natively (conversions.rs).
  • Per class: a bundle's added templates, the rotational bundle's properties, 2142's and Heroes' own classes, each in its game's process.

How an object behaves once built is on objects and templates.

Where it is read#

Stepbf2-rs
run the CON scripts into templatesbf2-con (the console), bf2-objects template/ (TemplateManager, property tables)
a level's placed objectsbf2-editor level.rs LevelData::load, objects_json
the inspector's dumpbf2-editor level.rs object_json, template_json; the API: notes/editor/api.md

Effects are template trees of the same kind (an EffectBundle with its particle systems): effects.

Source: docs/dev/assets/object.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.