Skip to content

[Feature] Simulation tick metadata on 2D collision events #208

@vmarcella

Description

@vmarcella

Overview

Add simulation tick or step metadata to collision events so consumers can
correlate events with deterministic game logic, replay systems, and debugging
tools.

Current State

Collision events do not currently report which simulation step produced them.
Consumers that need frame or step correlation must invent their own wrapper
state outside PhysicsWorld2D.

Scope

Goals:

  • Add step or tick metadata to collision and query debug outputs
  • Define whether the metadata refers to world steps, substeps, or both
  • Keep event timestamps deterministic within the simulation layer

Non-Goals:

  • Wall-clock timestamps
  • Networking or replay systems themselves
  • Full profiling instrumentation

Proposed API

pub struct CollisionEvent {
  pub kind: CollisionEventKind,
  pub body_a: RigidBody2D,
  pub body_b: RigidBody2D,
  pub simulation_step: u64,
  pub substep_count: u32,
}

Acceptance Criteria

  • Collision events include stable simulation step metadata
  • Semantics of step vs. substep are documented clearly
  • Tests verify monotonically increasing step metadata
  • Demo or logging examples show how to use the metadata
  • The implementation remains backend-agnostic

Affected Crates

lambda-rs, lambda-rs-platform

Notes

  • This is most valuable if deterministic replay or rollback work is expected.
  • The public API should not depend on the backend’s internal event queue
    numbering.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestlambda-rsIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappersphysicsAll things related to physics

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions