# revival-forge/bytefield architecture

> Architecture diagram of the GitHub repository revival-forge/bytefield, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/revival-forge/bytefield
- Repository: https://github.com/revival-forge/bytefield

## Overview

Bytefield is a Rust engine for playing Battlefield 1942 and supported mods using the player’s own game data. Its principal workflow is to find game content, load a level, run the simulation, and present play through the client; bots can supply player-like inputs, and a separate server supports Bytefield multiplayer. The graph preserves documented modes, graphics, and content-management capabilities. Some subsystem paths and links are based on the file tree or README rather than sampled implementation, so those relationships are marked unverified where appropriate.

Main entry points: [`crates/sim/src/lib.rs`](https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/lib.rs) (Simulation core), [`crates/client/src/main.rs`](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/main.rs) (Client startup), [`crates/client/src/play/mod.rs`](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/play/mod.rs) (Play loop), [`crates/client/src/level.rs`](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/level.rs) (Level rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game client"]
  node_client_app["Client startup<br/>[main.rs]"]
  node_play_loop["Play loop<br/>[mod.rs]"]
  node_level_view["Level rendering<br/>[level.rs]"]
  node_graphics["Graphics settings<br/>[settings.rs]"]
end

subgraph group_content["Content and assets"]
  node_assets["Game assets<br/>[assets.rs]"]
  node_content_discovery["Content discovery<br/>[discover.rs]"]
  node_content_config["Content configuration<br/>[config.rs]"]
end

subgraph group_simulation["Simulation and bots"]
  node_sim_core["Simulation core<br/>[lib.rs]"]
  node_sim_mechanics["Game mechanics"]
  node_bot_view["Bot interface<br/>[bot_api.rs]"]
  node_bot_teams["Team bots<br/>[mod.rs]"]
  node_bot_body["Bot skills<br/>[shooter.rs]"]
  node_bot_legacy["Alternative bots<br/>[mod.rs]"]
end

subgraph group_multiplayer["Multiplayer"]
  node_server["Game server<br/>[lib.rs]"]
  node_server_udp["UDP transport<br/>[udp.rs]"]
end

subgraph group_foundation["Data foundations"]
  node_con_language["Script language<br/>[session.rs]"]
  node_formats["Game formats"]
  node_vfs["Virtual filesystem<br/>[lib.rs]"]
end

node_player(("Player"))

node_player -->|"starts"| node_client_app
node_client_app -->|"finds content"| node_content_discovery
node_client_app -->|"loads config"| node_content_config
node_client_app -.->|"starts play"| node_play_loop
node_play_loop -->|"steps simulation"| node_sim_core
node_play_loop -->|"updates view"| node_level_view
node_level_view -->|"loads assets"| node_assets
node_level_view -->|"reads settings"| node_graphics
node_sim_core -.->|"uses mechanics"| node_sim_mechanics
node_sim_core -->|"builds bot view"| node_bot_view
node_bot_teams -->|"uses skills"| node_bot_body
node_bot_legacy -->|"uses skills"| node_bot_body
node_sim_core -.->|"selects bots"| node_bot_teams
node_sim_core -.->|"selects bots"| node_bot_legacy
node_player -->|"joins multiplayer"| node_server
node_server -->|"uses transport"| node_server_udp
node_client_app -.->|"connects to"| node_server
node_sim_core -.->|"loads scripts"| node_con_language
node_sim_core -.->|"reads game data"| node_formats
node_assets -.->|"reads files"| node_vfs

click node_client_app "https://github.com/revival-forge/bytefield/blob/main/crates/client/src/main.rs"
click node_play_loop "https://github.com/revival-forge/bytefield/blob/main/crates/client/src/play/mod.rs"
click node_level_view "https://github.com/revival-forge/bytefield/blob/main/crates/client/src/level.rs"
click node_graphics "https://github.com/revival-forge/bytefield/blob/main/crates/client/src/settings.rs"
click node_assets "https://github.com/revival-forge/bytefield/blob/main/crates/client/src/assets.rs"
click node_content_discovery "https://github.com/revival-forge/bytefield/blob/main/crates/content/src/discover.rs"
click node_content_config "https://github.com/revival-forge/bytefield/blob/main/crates/content/src/config.rs"
click node_sim_core "https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/lib.rs"
click node_sim_mechanics "https://github.com/revival-forge/bytefield/tree/main/crates/sim/src"
click node_bot_view "https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bot_api.rs"
click node_bot_teams "https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bots3/mod.rs"
click node_bot_body "https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bots3/body/shooter.rs"
click node_bot_legacy "https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bots2/mod.rs"
click node_server "https://github.com/revival-forge/bytefield/blob/main/crates/server/src/lib.rs"
click node_server_udp "https://github.com/revival-forge/bytefield/blob/main/crates/server/src/udp.rs"
click node_con_language "https://github.com/revival-forge/bytefield/blob/main/crates/con-lang/src/session.rs"
click node_formats "https://github.com/revival-forge/bytefield/tree/main/crates/formats/src"
click node_vfs "https://github.com/revival-forge/bytefield/blob/main/crates/vfs/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_app,node_play_loop,node_level_view,node_graphics toneBlue
class node_assets,node_content_discovery,node_content_config toneAmber
class node_sim_core,node_sim_mechanics,node_bot_view,node_bot_teams,node_bot_body,node_bot_legacy toneMint
class node_server,node_server_udp toneRose
class node_con_language,node_formats,node_vfs,node_player toneIndigo
```

## Components

### Game client

- [Client startup](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/main.rs): `crates/client/src/main.rs`
- [Play loop](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/play/mod.rs): `crates/client/src/play/mod.rs`
- [Level rendering](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/level.rs): `crates/client/src/level.rs`
- [Graphics settings](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/settings.rs): `crates/client/src/settings.rs`

### Content and assets

- [Game assets](https://github.com/revival-forge/bytefield/blob/main/crates/client/src/assets.rs): `crates/client/src/assets.rs`
- [Content discovery](https://github.com/revival-forge/bytefield/blob/main/crates/content/src/discover.rs): `crates/content/src/discover.rs`
- [Content configuration](https://github.com/revival-forge/bytefield/blob/main/crates/content/src/config.rs): `crates/content/src/config.rs`

### Simulation and bots

- [Simulation core](https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/lib.rs): `crates/sim/src/lib.rs`
- [Game mechanics](https://github.com/revival-forge/bytefield/tree/main/crates/sim/src): `crates/sim/src`
- [Bot interface](https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bot_api.rs): `crates/sim/src/bot_api.rs`
- [Team bots](https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bots3/mod.rs): `crates/sim/src/bots3/mod.rs`
- [Bot skills](https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bots3/body/shooter.rs): `crates/sim/src/bots3/body/shooter.rs`
- [Alternative bots](https://github.com/revival-forge/bytefield/blob/main/crates/sim/src/bots2/mod.rs): `crates/sim/src/bots2/mod.rs`

### Multiplayer

- [Game server](https://github.com/revival-forge/bytefield/blob/main/crates/server/src/lib.rs): `crates/server/src/lib.rs`
- [UDP transport](https://github.com/revival-forge/bytefield/blob/main/crates/server/src/udp.rs): `crates/server/src/udp.rs`

### Data foundations

- [Script language](https://github.com/revival-forge/bytefield/blob/main/crates/con-lang/src/session.rs): `crates/con-lang/src/session.rs`
- [Game formats](https://github.com/revival-forge/bytefield/tree/main/crates/formats/src): `crates/formats/src`
- [Virtual filesystem](https://github.com/revival-forge/bytefield/blob/main/crates/vfs/src/lib.rs): `crates/vfs/src/lib.rs`

### Other components

- **Player**

## Connections

- Player → Client startup: starts (evidence: `README.md`)
- Client startup → Content discovery: finds content (evidence: `crates/client/src/main.rs`)
- Client startup → Content configuration: loads config (evidence: `crates/client/src/main.rs`)
- Client startup → Play loop: starts play (evidence: `crates/client/src/main.rs`)
- Play loop → Simulation core: steps simulation (evidence: `crates/client/src/play/mod.rs`)
- Play loop → Level rendering: updates view (evidence: `crates/client/src/play/mod.rs`)
- Level rendering → Game assets: loads assets (evidence: `crates/client/src/level.rs`)
- Level rendering → Graphics settings: reads settings (evidence: `crates/client/src/level.rs`)
- Simulation core → Game mechanics: uses mechanics (evidence: `crates/sim/src/lib.rs`)
- Simulation core → Bot interface: builds bot view (evidence: `crates/sim/src/bot_api.rs`)
- Team bots → Bot skills: uses skills (evidence: `crates/sim/src/bots3/mod.rs`)
- Alternative bots → Bot skills: uses skills (evidence: `crates/sim/src/bots2/mod.rs`)
- Simulation core → Team bots: selects bots (evidence: `crates/sim/src/lib.rs`)
- Simulation core → Alternative bots: selects bots (evidence: `crates/sim/src/lib.rs`)
- Player → Game server: joins multiplayer (evidence: `README.md`)
- Game server → UDP transport: uses transport (evidence: `crates/server/src/lib.rs`)
- Client startup → Game server: connects to
- Simulation core → Script language: loads scripts
- Simulation core → Game formats: reads game data
- Game assets → Virtual filesystem: reads files
