chore(m0): initialize cargo workspace, crate skeletons and ci gate
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "content"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Data-driven content models (tanks, weapons, maps) with validation"
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
@@ -0,0 +1,9 @@
|
||||
//! Content models and validation for tanks, weapons and map presets.
|
||||
//!
|
||||
//! Content is versioned as a whole: `content_hash` pins a ruleset so that
|
||||
//! replays stay verifiable (see docs/protocol.md).
|
||||
|
||||
/// Placeholder until M2 fills in the models.
|
||||
pub fn content_hash_placeholder() -> &'static str {
|
||||
"b3:uninitialized"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "ffi"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "CDylib bridge between Flutter and the deterministic simulation"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "staticlib"]
|
||||
|
||||
[dependencies]
|
||||
sim.workspace = true
|
||||
content.workspace = true
|
||||
@@ -0,0 +1,16 @@
|
||||
//! Flutter <-> Rust bridge (flutter_rust_bridge API lives here from M3 on).
|
||||
|
||||
/// Smoke entry point so the Android build proves the CDylib pipeline works.
|
||||
pub fn sim_version() -> String {
|
||||
sim::SIM_VERSION.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn exposes_sim_version() {
|
||||
assert_eq!(sim_version(), "0.1.0");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "server"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Replay validation service (referee)"
|
||||
|
||||
[dependencies]
|
||||
sim.workspace = true
|
||||
content.workspace = true
|
||||
@@ -0,0 +1,14 @@
|
||||
//! Replay validation service. Filled in at M4 (axum, sqlx, HMAC tokens).
|
||||
|
||||
/// Reports which simulation version this server validates against.
|
||||
pub fn validated_sim_version() -> &'static str {
|
||||
sim::SIM_VERSION
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn reports_sim_version() {
|
||||
assert_eq!(super::validated_sim_version(), sim::SIM_VERSION);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "sim"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Deterministic artillery simulation core (fixed-point, no_std)"
|
||||
|
||||
[lib]
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
serde = ["dep:serde", "dep:serde_json"]
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true, optional = true }
|
||||
serde_json = { workspace = true, optional = true }
|
||||
@@ -0,0 +1,19 @@
|
||||
//! Deterministic artillery simulation core.
|
||||
//!
|
||||
//! Rules (see docs/ADR/0002-determinismus-fixed-point.md):
|
||||
//! - no floating point arithmetic
|
||||
//! - no `HashMap`/`HashSet` iteration
|
||||
//! - no `std::time`, no threads, no `unsafe`
|
||||
//! - fixed 60 Hz tick
|
||||
#![cfg_attr(not(test), no_std)]
|
||||
#![forbid(unsafe_code)]
|
||||
#![deny(clippy::float_arithmetic)]
|
||||
|
||||
#[cfg(not(test))]
|
||||
extern crate alloc;
|
||||
|
||||
/// Version of the simulation. Bumped on any formula/balance change.
|
||||
pub const SIM_VERSION: &str = "0.1.0";
|
||||
|
||||
/// Fixed simulation tick rate in Hz.
|
||||
pub const TICK_HZ: u32 = 60;
|
||||
Reference in New Issue
Block a user