DetPhysDocs日本語

detphys_debug.hdesync debugger (version 3, recording format DNDR 2, bundle DNDB 1)

Version 3 added recordings of 3D worlds (detphys3d.h); it only adds things.

  • reserved in the recording settings detphys_debug_config was renamed to dimensions (0 or 2 = 2D, 3 = 3D; left at 0 everything works as before).
  • 3D recordings are written in format 2. 2D recordings are still format 1 and their bytes are the same as in version 2. Comparing a 2D recording with a 3D one returns DETPHYS_ERR_FORMAT.
  • 3D sessions (detphys_rt_create3d, detphys_turn_create_rule3d) accept detphys_rt_set_debug / detphys_turn_set_debug too (the rt and turn versions did not change, so check detphys_debug_abi_version() >= 3).
  • In 3D, box2d_hash, box2d_first_tick and DETPHYS_DEBUG_REC_BOX2D_HASH hold Box3D's state hash (the same value as detphys3d_world_engine_hash). The names are kept from 2D.

Recording

FunctionDescription
detphys_debug_abi_versionThis header's versionUsage: Desyncs › Turning the desync debugger on
detphys_debug_config_defaultDefault recording settings (600 ticks, 256 bodies, 32 input words, 16 state words, deep hash and types / shapes)Usage: Desyncs › Recording 3D without a session
detphys_debug_recorder_sizeBuffer size needed for a recorderUsage: Desyncs › Recording without a session
detphys_debug_recorder_initUses a caller buffer as a recorderUsage: Desyncs › Recording without a session
detphys_debug_recordRecords the world's current state (with inputs and state words)Usage: Desyncs › Recording without a session
detphys_debug_record3dRecords a 3D world's current state (into a recorder created with dimensions = 3; the recorded hash equals detphys3d_world_hash). Version 3Usage: Desyncs › Recording 3D without a session
detphys_debug_recorder_clearDrops all recorded ticks
detphys_debug_recorder_stats_getRecorder statistics
detphys_debug_exportWrites a range of ticks as DNDR bytesUsage: Desyncs › Recording without a session

Reading and comparing

FunctionDescription
detphys_debug_file_info_getReads a recording (DNDR) headerUsage: Desyncs › Comparing recordings again
detphys_debug_file_tickReads the tick at an index
detphys_debug_file_find_tickFinds the index of a tick number
detphys_debug_file_bodiesReads the bodies of a tick (2D recordings only; 3D recordings return DETPHYS_ERR_FORMAT)
detphys_debug_file_bodies3dReads the bodies of a tick of a 3D recording (2D recordings return DETPHYS_ERR_FORMAT). Version 3Usage: Desyncs › Recording 3D without a session
detphys_debug_compareCompares two recordings (first diverging tick, body, field, ULPs, cause, spread)Usage: Desyncs › Comparing recordings again
detphys_debug_field_nameField name ("x", "vx", "qw", …)
detphys_debug_cause_nameCause name ("input", "physics", …)

Built into sessions

FunctionDescription
detphys_debug_session_config_defaultDefault session debug settings (off, 30-tick range, 4 reports, 10000 ms)
detphys_debug_bundle_info_getReads a bundle (DNDB) header and the positions of its two recordingsUsage: Desyncs › Comparing recordings again
detphys_debug_write_fileWrites bytes to a file (UTF-8 path)
StructDescription
detphys_debug_configRecording settings (dimensions 2 / 3; renamed from reserved in version 3)
detphys_debug_recorder_statsRecorder statistics
detphys_debug_file_infoRecording header (format_version 1 = 2D, 2 = 3D; 3D recordings have DETPHYS_DEBUG_FILE_3D in flags)Usage: Desyncs › 3D worlds and sessions
detphys_debug_tickOne tick's header (hash, deep hash [Box3D's in 3D], body count, word counts)
detphys_debug_bodyOne body in a 2D recording (raw bits of x, y, cos, sin, vx, vy, w)
detphys_debug_body3dOne body in a 3D recording (raw bits of x, y, z, qx, qy, qz, qw, vx, vy, vz, wx, wy, wz; hull = hull index; 136 B). Version 3Usage: Desyncs › Recording 3D without a session
detphys_debug_reportComparison result (cause, first diverging tick, first tick per kind, counts)
detphys_debug_diffOne differing field (body, field, values in A and B, ULPs)Usage: Desyncs › 3D worlds and sessions
detphys_debug_session_configSession debug settingsUsage: Desyncs › Turning the desync debugger on
detphys_debug_session_reportOne desync report (status, range, bytes, report, first difference)
detphys_debug_session_statsSession debug counters
detphys_debug_bundle_infoBundle header

Constants: fields DETPHYS_DEBUG_FIELD_* (2D: X, Y, COS, SIN, VX, VY, W = 0–6, EXISTS, TYPE, SHAPE, AWAKE, TAG = 7–11. 3D: X, Y, VX, VY keep their numbers and Z, QX, QY, QZ, QW, VZ, WX, WY, WZ = 12–20; COS, SIN and W are not used in 3D), DETPHYS_DEBUG_FILE_3D (0x100).

DetPhys is not affiliated with Box2D or Box3D and is not endorsed or recommended by Box2D, Box3D or their author. It uses Box2D v3 and Box3D, both under the MIT license, as its physics.

LicensesMatches the current versions (2026-11)

© 2026 PetafProductsContactPrivacy

This site uses no analytics or tracking.

↑↓ to choose, Enter to open, Esc to close