Expand description
Boon - A Deadlock demo file parser
This crate provides functionality for parsing Deadlock demo files (.dem), extracting game state, entity information, and metadata.
§Quick start
use std::path::Path;
use boon::Parser;
let parser = Parser::from_file(Path::new("match.dem")).unwrap();
let header = parser.file_header().unwrap();
println!("Map: {:?}", header.map_name);§Reading game events
use std::path::Path;
use boon::Parser;
let parser = Parser::from_file(Path::new("match.dem")).unwrap();
let events = parser.events(None).unwrap();
for event in &events {
println!("[tick {}] {} (msg_type {})", event.tick, event.name, event.msg_type);
}§Iterating entities per tick
use std::path::Path;
use boon::Parser;
let parser = Parser::from_file(Path::new("match.dem")).unwrap();
parser.run_to_end(|ctx| {
for (&idx, entity) in ctx.entities.iter() {
if entity.class_name == "CCitadelPlayerPawn" {
// Access entity fields by resolved key
}
}
}).unwrap();§Name lookups
// Resolve numeric IDs to human-readable names
assert_eq!(boon::hero_name(1), "Infernus");
assert_eq!(boon::team_name(2), "Hidden King");
assert_eq!(boon::team_name(3), "Archmother");Re-exports§
pub use abilities::ability_name;pub use abilities::all_abilities;pub use demo::CmdHeader;pub use demo::Context;pub use demo::GameEvent;pub use demo::MessageInfo;pub use demo::Parser;pub use demo::command_name;pub use demo::decode_event_payload;pub use entity::ClassEntry;pub use entity::ClassInfo;pub use entity::ENTITY_HANDLE_INDEX_MASK;pub use entity::Entity;pub use entity::EntityContainer;pub use entity::FieldValue;pub use entity::INVALID_ENTITY_HANDLE;pub use entity::Serializer;pub use entity::SerializerContainer;pub use entity::SerializerField;pub use entity::StringTable;pub use entity::StringTableContainer;pub use entity::StringTableEntry;pub use entity::protobuf_handle_index;pub use error::Error;pub use error::Result;pub use game_modes::all_game_modes;pub use game_modes::game_mode_name;pub use heroes::all_heroes;pub use heroes::hero_name;pub use modifiers::all_modifiers;pub use modifiers::modifier_name;pub use patron_phases::all_patron_phases;pub use patron_phases::patron_phase_name;pub use position::CELL_BITS;pub use position::CELL_SIZE;pub use position::WORLD_HALF;pub use position::cell_to_world;pub use teams::all_teams;pub use teams::team_name;
Modules§
- abilities
- Auto-generated by scripts/generate-name-tables from abilities.vdata Maps MurmurHash2(name, seed=0x31415926) → name string.
- demo
- Demo file parsing and command handling.
- entity
- Entity system for parsing and representing game state.
- error
- game_
modes - Game mode ID to name mapping for Deadlock.
- heroes
- Hero ID to name mapping for Deadlock.
- io
- I/O utilities for reading demo file data.
- modifiers
- Auto-generated by scripts/generate-name-tables from modifiers.vdata Maps MurmurHash2(name, seed=0x31415926) → name string.
- patron_
phases - Patron phase ID to name mapping for Deadlock.
- position
- World-coordinate helpers for Source 2’s split position storage.
- teams
- Team number to name mapping for Deadlock.