~starkingdoms/starkingdoms

248837408ff9aac7a539ff7d1201252e76496ad8 — core 26 days ago 386a970
fix: wasm
M Cargo.lock => Cargo.lock +32 -90
@@ 820,55 820,6 @@ dependencies = [
]

[[package]]
name = "bevy-inspector-egui"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3692cbc0a76398ee01dde2c49951c8a92c5373c58e8720a0909e9504d21e9ab"
dependencies = [
 "bevy-inspector-egui-derive",
 "bevy_app",
 "bevy_asset",
 "bevy_camera",
 "bevy_color",
 "bevy_core_pipeline",
 "bevy_ecs",
 "bevy_egui",
 "bevy_image",
 "bevy_light",
 "bevy_log",
 "bevy_math",
 "bevy_mesh",
 "bevy_pbr",
 "bevy_platform",
 "bevy_reflect",
 "bevy_render",
 "bevy_state",
 "bevy_time",
 "bevy_utils",
 "bevy_window",
 "bytemuck",
 "disqualified",
 "egui 0.33.2",
 "fuzzy-matcher",
 "image",
 "opener",
 "smallvec",
 "uuid",
 "winit",
]

[[package]]
name = "bevy-inspector-egui-derive"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9569b1caad44483de562c6115c773d4311374d1740f5e6e69413d92206363c3"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "bevy_a11y"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1377,6 1328,7 @@ dependencies = [
 "bevy_log",
 "bevy_math",
 "bevy_mesh",
 "bevy_pbr",
 "bevy_picking",
 "bevy_platform",
 "bevy_post_process",


@@ 2200,17 2152,6 @@ dependencies = [
]

[[package]]
name = "bstr"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab"
dependencies = [
 "memchr",
 "regex-automata",
 "serde",
]

[[package]]
name = "bumpalo"
version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3952,15 3893,6 @@ dependencies = [
]

[[package]]
name = "fuzzy-matcher"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
dependencies = [
 "thread_local",
]

[[package]]
name = "generational-box"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 5309,15 5241,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51"

[[package]]
name = "normpath"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf23ab2b905654b4cb177e30b629937b3868311d4e1cba859f899c041046e69b"
dependencies = [
 "windows-sys 0.61.2",
]

[[package]]
name = "notify"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 5905,17 5828,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"

[[package]]
name = "opener"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb9024962ab91e00c89d2a14352a8d0fc1a64346bf96f1839b45c09149564e47"
dependencies = [
 "bstr",
 "normpath",
 "windows-sys 0.60.2",
]

[[package]]
name = "openssl-probe"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 7363,7 7275,6 @@ dependencies = [
 "aeronet_websocket",
 "avian2d",
 "bevy",
 "bevy-inspector-egui",
 "bevy_common_assets",
 "bevy_egui",
 "bevy_replicon",


@@ 7379,6 7290,7 @@ dependencies = [
 "tracing-wasm",
 "url",
 "wasm-bindgen",
 "wgpu 25.0.2",
]

[[package]]


@@ 8669,6 8581,7 @@ dependencies = [
 "cfg_aliases",
 "document-features",
 "hashbrown 0.15.5",
 "js-sys",
 "log",
 "naga 26.0.0",
 "portable-atomic",


@@ 8676,6 8589,8 @@ dependencies = [
 "raw-window-handle",
 "smallvec",
 "static_assertions",
 "wasm-bindgen",
 "web-sys",
 "wgpu-core 26.0.1",
 "wgpu-hal 26.0.6",
 "wgpu-types 26.0.0",


@@ 8707,6 8622,7 @@ dependencies = [
 "thiserror 2.0.17",
 "wgpu-core-deps-apple 25.0.0",
 "wgpu-core-deps-emscripten",
 "wgpu-core-deps-wasm 25.0.0",
 "wgpu-core-deps-windows-linux-android 25.0.0",
 "wgpu-hal 25.0.2",
 "wgpu-types 25.0.0",


@@ 8737,6 8653,7 @@ dependencies = [
 "smallvec",
 "thiserror 2.0.17",
 "wgpu-core-deps-apple 26.0.0",
 "wgpu-core-deps-wasm 26.0.0",
 "wgpu-core-deps-windows-linux-android 26.0.0",
 "wgpu-hal 26.0.6",
 "wgpu-types 26.0.0",


@@ 8770,6 8687,24 @@ dependencies = [
]

[[package]]
name = "wgpu-core-deps-wasm"
version = "25.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eca8809ad123f6c7f2c5e01a2c7117c4fdfd02f70bd422ee2533f69dfa98756c"
dependencies = [
 "wgpu-hal 25.0.2",
]

[[package]]
name = "wgpu-core-deps-wasm"
version = "26.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c03b9f9e1a50686d315fc6debe4980cc45cd37b0e919351917df494e8fdc8885"
dependencies = [
 "wgpu-hal 26.0.6",
]

[[package]]
name = "wgpu-core-deps-windows-linux-android"
version = "25.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 8850,15 8785,20 @@ dependencies = [
 "cfg-if",
 "cfg_aliases",
 "core-graphics-types 0.2.0",
 "glow",
 "glutin_wgl_sys",
 "gpu-alloc",
 "gpu-allocator",
 "gpu-descriptor",
 "hashbrown 0.15.5",
 "js-sys",
 "khronos-egl",
 "libc",
 "libloading",
 "log",
 "metal 0.32.0",
 "naga 26.0.0",
 "ndk-sys 0.6.0+11769913",
 "objc",
 "ordered-float 4.6.0",
 "parking_lot",


@@ 8870,6 8810,8 @@ dependencies = [
 "renderdoc-sys",
 "smallvec",
 "thiserror 2.0.17",
 "wasm-bindgen",
 "web-sys",
 "wgpu-types 26.0.0",
 "windows 0.58.0",
 "windows-core 0.58.0",

M crates/unified/Cargo.toml => crates/unified/Cargo.toml +9 -6
@@ 9,8 9,6 @@ version = "0.1.0"

[dependencies]
bevy = { version = "0.17", default-features = false, features = [
    "hotpatching",
    "dynamic_linking",
    "serialize",
    "tonemapping_luts",
    "bevy_window",


@@ 35,7 33,8 @@ bevy = { version = "0.17", default-features = false, features = [
    "bevy_post_process",
    "bevy_anti_alias",
    "bevy_sprite_render",
    "bevy_ui_render"
    "bevy_ui_render",
    "webgl2"
] }
#bevy_rapier2d = { features = ["serde-serialize", "simd-stable"], git = "https://github.com/Deniskore/bevy_rapier", branch = "bevy-0.17" }



@@ 75,9 74,9 @@ bevy_egui = "0.38"
ordered-float = { version = "5", features = ["serde"] }
ron = "0.12"

ctrlc = "3.5"
ctrlc = { version = "3.5", optional = true }

bevy-inspector-egui = "0.35"
wgpu = "*"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]



@@ 90,8 89,12 @@ console_error_panic_hook = "0.1"
default = ["native", "particle_editor"]
native = [
    "bevy/file_watcher",
    "bevy/hotpatching",
    "bevy/dynamic_linking",
    "aeronet_websocket/server",
    "aeronet_replicon/server"
    "aeronet_replicon/server",
    "ctrlc",
    "wgpu/webgl"
]
wasm = ["getrandom/wasm_js"]
particle_editor = []

M crates/unified/src/main.rs => crates/unified/src/main.rs +14 -4
@@ 168,6 168,12 @@ fn run(cli: Cli) -> AppExit {
    app.run()
}

#[cfg(feature = "wasm")]
fn main() {
    // noop
}

#[cfg(feature = "native")]
fn main() -> AppExit {
    let cli = Cli::parse();



@@ 178,14 184,18 @@ fn main() -> AppExit {
        .finish()
        .init();

    ctrlc::set_handler(|| {
        info!("caught ^C, ciao!");
        exit(0);
    }).unwrap();
    #[cfg(feature = "native")] {
        ctrlc::set_handler(|| {
            info!("caught ^C, ciao!");
            exit(0);
        }).unwrap();
    }

    match cli {
        Cli::Client { .. } => { run(cli) },
        #[cfg(feature = "native")]
        Cli::ParticleEditor { .. } => { run(cli) },
        #[cfg(feature = "native")]
        Cli::Server { with_client, bind, hotpatching_enabled, .. } => {
            run(cli)
            /*

M crates/unified/src/wasm_entrypoint.rs => crates/unified/src/wasm_entrypoint.rs +14 -1
@@ 3,16 3,29 @@ use crate::shared_plugins::SharedPluginGroup;
use aeronet_websocket::client::WebSocketClient;
use bevy::app::{App, Startup};
use url::Url;
use bevy::log::LogPlugin;
use bevy::ui::UiPlugin;
use bevy::DefaultPlugins;
use wasm_bindgen::prelude::*;
use bevy::prelude::PluginGroup;

#[wasm_bindgen]
pub fn play(server: &str) -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    tracing_wasm::set_as_global_default();

    for instance in wgpu::Instance::enabled_backend_features().iter_names() {
        bevy::log::debug!(?instance, "available backend");
    }

    let mut app = App::new();
    app.add_plugins(
        DefaultPlugins.build()
            .disable::<LogPlugin>()
            .disable::<UiPlugin>()
    );
    app.add_plugins(ClientPluginGroup {
        server: server.to_string(),
        server: Some(server.to_string()),
    });
    app.add_plugins(SharedPluginGroup);


M crates/xtask/src/main.rs => crates/xtask/src/main.rs +7 -4
@@ 1,3 1,5 @@
#![feature(exit_status_error)]

use colored::Colorize;
use notify::{Event, EventKind, RecursiveMode, Watcher};
use std::env::{args, var};


@@ 85,7 87,7 @@ fn start_server() {

        let path = path.strip_prefix(Path::new("/")).unwrap();

        let full_path = workspace_dir().join("crates/client").join(path);
        let full_path = workspace_dir().join("crates/unified").join(path);

        let content = match fs::read(full_path.clone()) {
            Ok(r) => r,


@@ 170,7 172,7 @@ fn main() {
                std::thread::spawn(start_server);
            }

            try_build_client();
            //try_build_client();
            let (tx, rx) = mpsc::channel::<notify::Result<Event>>();

            // Use recommended_watcher() to automatically select the best implementation


@@ 293,7 295,7 @@ fn main() {
            let start = Instant::now();
            let target = workspace_dir().join("target/");
            let unified = workspace_dir().join("crates/unified/");
            exec("cargo", "build --package starkingdoms --lib --target wasm32-unknown-unknown -F wasm --no-default-features");
            exec("cargo", "build --package starkingdoms --target wasm32-unknown-unknown -F wasm --no-default-features");
            let wasm_file = target.join("wasm32-unknown-unknown/debug/starkingdoms.wasm");
            exec(
                "wasm-bindgen",


@@ 353,5 355,6 @@ fn exec(program: &str, args: &str) {
        .spawn()
        .unwrap()
        .wait()
        .unwrap();
        .unwrap()
        .exit_ok().unwrap();
}