You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by pi...@apache.org on 2026/04/02 12:42:00 UTC
(iggy) 01/01: merge
This is an automated email from the ASF dual-hosted git repository.
piotr pushed a commit to branch simulator_ui
in repository https://gitbox.apache.org/repos/asf/iggy.git
commit 052dedc5672aa59c659b7d1abe4611eab27ab734
Merge: d383e9495 b19daa9fd
Author: spetz <pi...@gmail.com>
AuthorDate: Thu Apr 2 14:41:51 2026 +0200
merge
.github/workflows/_common.yml | 32 +-
.pre-commit-config.yaml | 12 +-
Cargo.lock | 389 +++++---
Cargo.toml | 2 +
DEPENDENCIES.md | 125 +--
core/binary_protocol/src/lib.rs | 7 +
core/binary_protocol/src/primitives/mod.rs | 1 +
.../binary_protocol/src/primitives/user_headers.rs | 544 +++++++++++
core/cli/Cargo.toml | 2 +-
core/cli/src/args/permissions/mod.rs | 8 +-
core/cli/src/args/permissions/stream.rs | 10 +-
core/cli/src/commands/binary_client/get_client.rs | 20 +-
core/cli/src/commands/binary_client/get_clients.rs | 8 +-
.../binary_consumer_groups/get_consumer_group.rs | 23 +-
.../binary_consumer_groups/get_consumer_groups.rs | 19 +-
.../binary_consumer_offsets/get_consumer_offset.rs | 53 +-
.../binary_consumer_offsets/set_consumer_offset.rs | 43 +-
.../src/commands/binary_message/poll_messages.rs | 13 +-
.../src/commands/binary_message/send_messages.rs | 8 +-
.../get_personal_access_tokens.rs | 7 +-
core/cli/src/commands/binary_streams/get_stream.rs | 20 +-
.../cli/src/commands/binary_streams/get_streams.rs | 8 +-
core/cli/src/commands/binary_system/me.rs | 14 +-
core/cli/src/commands/binary_system/ping.rs | 7 +-
core/cli/src/commands/binary_system/snapshot.rs | 36 +-
core/cli/src/commands/binary_system/stats.rs | 8 +-
core/cli/src/commands/binary_topics/get_topic.rs | 18 +-
core/cli/src/commands/binary_topics/get_topics.rs | 19 +-
core/cli/src/commands/binary_users/get_user.rs | 15 +-
core/cli/src/commands/binary_users/get_users.rs | 8 +-
core/common/Cargo.toml | 1 -
.../consumer_groups/create_consumer_group.rs | 189 ----
.../consumer_groups/delete_consumer_group.rs | 147 ---
.../commands/consumer_groups/get_consumer_group.rs | 147 ---
.../consumer_groups/get_consumer_groups.rs | 126 ---
.../consumer_groups/join_consumer_group.rs | 147 ---
.../consumer_groups/leave_consumer_group.rs | 147 ---
.../consumer_offsets/delete_consumer_offset.rs | 220 -----
.../consumer_offsets/get_consumer_offset.rs | 225 -----
.../consumer_offsets/store_consumer_offset.rs | 240 -----
.../src/commands/messages/flush_unsaved_buffer.rs | 132 ---
core/common/src/commands/messages/poll_messages.rs | 341 -------
.../src/commands/partitions/create_partitions.rs | 167 ----
.../src/commands/partitions/delete_partitions.rs | 167 ----
.../create_personal_access_token.rs | 157 ---
.../delete_personal_access_token.rs | 156 ---
.../get_personal_access_tokens.rs | 86 --
.../login_with_personal_access_token.rs | 173 ----
.../src/commands/segments/delete_segments.rs | 202 ----
core/common/src/commands/streams/create_stream.rs | 153 ---
core/common/src/commands/streams/delete_stream.rs | 99 --
core/common/src/commands/streams/get_stream.rs | 99 --
core/common/src/commands/streams/get_streams.rs | 86 --
core/common/src/commands/streams/purge_stream.rs | 102 --
core/common/src/commands/streams/update_stream.rs | 151 ---
core/common/src/commands/system/get_client.rs | 113 ---
core/common/src/commands/system/get_clients.rs | 86 --
.../src/commands/system/get_cluster_metadata.rs | 59 --
core/common/src/commands/system/get_me.rs | 86 --
core/common/src/commands/system/get_snapshot.rs | 168 ----
core/common/src/commands/system/get_stats.rs | 86 --
core/common/src/commands/system/ping.rs | 87 --
core/common/src/commands/topics/create_topic.rs | 301 ------
core/common/src/commands/topics/delete_topic.rs | 126 ---
core/common/src/commands/topics/get_topic.rs | 126 ---
core/common/src/commands/topics/get_topics.rs | 99 --
core/common/src/commands/topics/purge_topic.rs | 124 ---
core/common/src/commands/topics/update_topic.rs | 302 ------
core/common/src/commands/users/change_password.rs | 246 -----
core/common/src/commands/users/create_user.rs | 347 -------
core/common/src/commands/users/delete_user.rs | 99 --
core/common/src/commands/users/get_user.rs | 99 --
core/common/src/commands/users/get_users.rs | 88 --
core/common/src/commands/users/login_user.rs | 399 --------
core/common/src/commands/users/logout_user.rs | 87 --
.../src/commands/users/update_permissions.rs | 189 ----
core/common/src/commands/users/update_user.rs | 231 -----
core/common/src/error/iggy_error.rs | 2 +
.../http/consumer_groups/create_consumer_group.rs | 60 ++
.../http/consumer_groups/delete_consumer_group.rs | 46 +
.../src/{commands => http}/consumer_groups/mod.rs | 6 +-
.../consumer_offsets/delete_consumer_offset.rs} | 13 +-
.../consumer_offsets/get_consumer_offset.rs} | 16 +-
.../src/{commands => http}/consumer_offsets/mod.rs | 0
.../consumer_offsets/store_consumer_offset.rs} | 16 +-
.../messages/flush_unsaved_buffer.rs} | 9 +-
core/common/src/{commands => http}/messages/mod.rs | 0
core/common/src/http/messages/poll_messages.rs | 89 ++
.../{commands => http}/messages/send_messages.rs | 131 +--
core/common/src/{commands => http}/mod.rs | 0
.../src/http/partitions/create_partitions.rs | 60 ++
.../src/http/partitions/delete_partitions.rs | 60 ++
.../src/{commands => http}/partitions/mod.rs | 2 +-
.../create_personal_access_token.rs | 57 ++
.../delete_personal_access_token.rs | 52 +
.../login_with_personal_access_token.rs} | 14 +-
.../personal_access_tokens/mod.rs | 1 -
core/common/src/http/segments/delete_segments.rs | 59 ++
core/common/src/{commands => http}/segments/mod.rs | 0
core/common/src/http/streams/create_stream.rs | 49 +
.../cluster.rs => http/streams/delete_stream.rs} | 27 +-
core/common/src/{commands => http}/streams/mod.rs | 4 +-
.../cluster.rs => http/streams/purge_stream.rs} | 27 +-
core/common/src/http/streams/update_stream.rs | 55 ++
.../streams/mod.rs => http/system/get_snapshot.rs} | 15 +-
core/common/src/{commands => http}/system/mod.rs | 6 -
core/common/src/http/topics/create_topic.rs | 89 ++
.../topics/delete_topic.rs} | 39 +-
core/common/src/{commands => http}/topics/mod.rs | 5 +-
.../segments.rs => http/topics/purge_topic.rs} | 41 +-
core/common/src/http/topics/update_topic.rs | 86 ++
core/common/src/http/users/change_password.rs | 74 ++
core/common/src/http/users/create_user.rs | 76 ++
.../src/{commands => http}/users/defaults.rs | 0
.../cluster.rs => http/users/delete_user.rs} | 27 +-
core/common/src/http/users/login_user.rs | 55 ++
core/common/src/{commands => http}/users/mod.rs | 3 -
.../users/update_permissions.rs} | 41 +-
core/common/src/http/users/update_user.rs | 55 ++
core/common/src/lib.rs | 29 +-
core/common/src/traits/binary_impls/cluster.rs | 19 +-
.../src/traits/binary_impls/consumer_groups.rs | 138 ++-
.../src/traits/binary_impls/consumer_offsets.rs | 82 +-
core/common/src/traits/binary_impls/messages.rs | 82 +-
core/common/src/traits/binary_impls/mod.rs | 11 +
core/common/src/traits/binary_impls/partitions.rs | 43 +-
.../traits/binary_impls/personal_access_tokens.rs | 71 +-
core/common/src/traits/binary_impls/segments.rs | 26 +-
core/common/src/traits/binary_impls/streams.rs | 86 +-
core/common/src/traits/binary_impls/system.rs | 75 +-
core/common/src/traits/binary_impls/topics.rs | 140 ++-
core/common/src/traits/binary_impls/users.rs | 151 ++-
core/common/src/traits/binary_mapper.rs | 1033 --------------------
core/common/src/traits/binary_transport.rs | 4 +-
core/common/src/traits/mod.rs | 2 -
core/common/src/types/cluster/metadata.rs | 95 +-
core/common/src/types/cluster/node.rs | 98 +-
core/common/src/types/cluster/role.rs | 27 +-
core/common/src/types/cluster/status.rs | 27 +-
.../src/types/cluster/transport_endpoints.rs | 69 --
core/common/src/types/command/mod.rs | 173 ----
core/common/src/types/configuration/transport.rs | 23 +-
core/common/src/types/consumer/consumer_kind.rs | 27 -
core/common/src/types/identifier/mod.rs | 76 +-
core/common/src/types/message/iggy_message.rs | 201 ++--
core/common/src/types/message/message_header.rs | 8 +-
.../src/types/message/message_header_view.rs | 25 +-
core/common/src/types/message/message_view.rs | 44 +-
core/common/src/types/message/messages_batch.rs | 24 +-
.../common/src/types/message/messages_batch_mut.rs | 6 +-
core/common/src/types/message/mod.rs | 5 +-
core/common/src/types/message/partitioning.rs | 71 +-
core/common/src/types/message/polled_messages.rs | 12 +-
core/common/src/types/message/polling_strategy.rs | 27 -
core/common/src/types/message/user_headers.rs | 176 +---
core/common/src/types/mod.rs | 1 -
.../src/types/permissions/permissions_global.rs | 264 +----
core/common/src/utils/crypto.rs | 4 +-
core/common/src/wire_conversions.rs | 785 +++++++++++++++
core/connectors/runtime/src/sink.rs | 2 +-
core/connectors/runtime/src/source.rs | 4 +-
core/connectors/sdk/src/lib.rs | 10 +-
core/connectors/sinks/http_sink/src/lib.rs | 3 +-
core/integration/Cargo.toml | 1 -
.../tests/cli/message/test_message_poll_command.rs | 4 +-
.../message/test_message_poll_to_file_command.rs | 8 +-
.../cli/message/test_message_reply_via_file.rs | 4 +-
.../tests/cli/message/test_message_send_command.rs | 8 +-
.../message/test_message_send_from_file_command.rs | 8 +-
.../tests/cli/user/test_user_create_command.rs | 12 +-
.../tests/cli/user/test_user_get_command.rs | 6 +-
.../cli/user/test_user_permissions_command.rs | 12 +-
.../server/scenarios/create_message_payload.rs | 6 +-
.../tests/server/scenarios/encryption_scenario.rs | 8 +-
.../server/scenarios/message_headers_scenario.rs | 6 +-
.../server/scenarios/message_size_scenario.rs | 6 +-
.../tests/server/scenarios/offset_scenario.rs | 8 +-
.../tests/server/scenarios/permissions_scenario.rs | 36 +-
.../tests/server/scenarios/timestamp_scenario.rs | 8 +-
core/integration/tests/state/file.rs | 35 +-
core/integration/tests/state/system.rs | 154 +--
core/metadata/Cargo.toml | 1 -
core/metadata/src/stm/consumer_group.rs | 115 +--
core/metadata/src/stm/mod.rs | 10 +-
core/metadata/src/stm/stream.rs | 107 +-
core/metadata/src/stm/user.rs | 84 +-
core/sdk/src/http/consumer_offsets.rs | 4 -
core/sdk/src/http/messages.rs | 7 +-
core/sdk/src/prelude.rs | 18 +-
core/sdk/src/quic/quic_client.rs | 8 +-
core/sdk/src/tcp/tcp_client.rs | 12 +-
core/sdk/src/websocket/websocket_client.rs | 8 +-
.../Cargo.toml => server-ng/.dockerignore} | 33 +-
core/server-ng/Cargo.toml | 183 ++++
core/server-ng/Dockerfile | 164 ++++
core/server-ng/build.rs | 87 ++
core/server-ng/config.toml | 590 +++++++++++
core/server-ng/server-ng.http | 376 +++++++
.../segments/mod.rs => server-ng/src/lib.rs} | 4 +-
.../partitions/mod.rs => server-ng/src/main.rs} | 11 +-
core/server/src/binary/dispatch.rs | 125 +--
.../create_consumer_group_handler.rs | 20 +-
.../delete_consumer_group_handler.rs | 17 +-
.../consumer_groups/join_consumer_group_handler.rs | 17 +-
.../leave_consumer_group_handler.rs | 17 +-
.../partitions/create_partitions_handler.rs | 22 +-
.../partitions/delete_partitions_handler.rs | 21 +-
.../create_personal_access_token_handler.rs | 19 +-
.../delete_personal_access_token_handler.rs | 10 +-
.../login_with_personal_access_token_handler.rs | 9 +-
.../handlers/streams/create_stream_handler.rs | 10 +-
.../handlers/streams/delete_stream_handler.rs | 8 +-
.../handlers/streams/purge_stream_handler.rs | 8 +-
.../handlers/streams/update_stream_handler.rs | 14 +-
.../binary/handlers/topics/create_topic_handler.rs | 31 +-
.../binary/handlers/topics/delete_topic_handler.rs | 15 +-
.../binary/handlers/topics/purge_topic_handler.rs | 15 +-
.../binary/handlers/topics/update_topic_handler.rs | 29 +-
.../handlers/users/change_password_handler.rs | 28 +-
.../binary/handlers/users/create_user_handler.rs | 34 +-
.../binary/handlers/users/delete_user_handler.rs | 9 +-
.../src/binary/handlers/users/get_user_handler.rs | 5 +-
.../binary/handlers/users/login_user_handler.rs | 25 +-
.../handlers/users/update_permissions_handler.rs | 22 +-
.../binary/handlers/users/update_user_handler.rs | 23 +-
core/server/src/http/consumer_groups.rs | 27 +-
core/server/src/http/consumer_offsets.rs | 38 +-
core/server/src/http/partitions.rs | 23 +-
core/server/src/http/personal_access_tokens.rs | 20 +-
core/server/src/http/segments.rs | 10 +-
core/server/src/http/streams.rs | 29 +-
core/server/src/http/system.rs | 10 +-
core/server/src/http/topics.rs | 42 +-
core/server/src/http/users.rs | 50 +-
core/server/src/quic/listener.rs | 4 +-
core/server/src/shard/execution.rs | 273 +++---
core/server/src/shard/system/messages.rs | 3 +-
core/server/src/shard/transmission/message.rs | 55 +-
core/server/src/state/command.rs | 342 ++++---
core/server/src/state/entry.rs | 70 +-
core/server/src/state/file.rs | 13 +-
core/server/src/state/models.rs | 511 +++++-----
core/server/src/state/system.rs | 193 ++--
core/server/src/tcp/connection_handler.rs | 4 +-
core/shard/src/lib.rs | 27 +
core/simulator/src/bus.rs | 42 +-
core/simulator/src/client.rs | 26 +-
core/simulator/src/lib.rs | 259 +++--
core/simulator/src/main.rs | 228 ++---
core/simulator/src/network.rs | 12 +
core/simulator/src/packet.rs | 27 +
core/simulator/src/replica.rs | 24 +-
core/simulator_ui/Cargo.toml | 2 -
core/simulator_ui/src/main.rs | 444 ++++++---
core/simulator_ui/src/vsr/types.rs | 10 +-
core/tools/src/data-seeder/seeder.rs | 4 +-
examples/rust/Cargo.toml | 2 +-
.../message-compression/consumer/main.rs | 12 +-
.../message-compression/producer/main.rs | 4 +-
.../message-headers/message-type/producer/main.rs | 4 +-
.../message-headers/typed-headers/producer/main.rs | 4 +-
examples/rust/src/multi-tenant/consumer/main.rs | 6 +-
examples/rust/src/multi-tenant/producer/main.rs | 4 +-
justfile | 3 +
scripts/bump-version.sh | 639 ++++++++++++
...-version-sync.sh => python-sdk-version-sync.sh} | 13 +-
scripts/ci/shellcheck.sh | 4 +-
scripts/extract-version.sh | 271 +++--
268 files changed, 8169 insertions(+), 12957 deletions(-)
diff --cc Cargo.lock
index 900d9451b,4be27b7fb..9d54c26fe
--- a/Cargo.lock
+++ b/Cargo.lock
@@@ -891,7 -729,7 +891,7 @@@ dependencies =
"futures-core",
"libc",
"portable-atomic",
- "rustc-hash 2.1.1",
- "rustc-hash",
++ "rustc-hash 2.1.2",
"tokio",
"tokio-stream",
"xattr",
@@@ -1611,1253 -1297,13 +1611,1253 @@@ dependencies =
]
[[package]]
-name = "bit_field"
-version = "0.10.3"
+name = "bevy_audio"
+version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
+checksum = "9d68da32468ce7f4bb2863b71326acfaaa88e9aef8da8306257cd487d40cede4"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_ecs",
+ "bevy_math",
+ "bevy_reflect",
+ "bevy_transform",
+ "coreaudio-sys",
+ "cpal",
+ "rodio",
+ "tracing",
+]
[[package]]
-name = "bitflags"
+name = "bevy_camera"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37ed9eed054e14341852236d06a7244597b1ace39ff9ae023fbd188ffde88619"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_color",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_reflect",
+ "bevy_transform",
+ "bevy_utils",
+ "bevy_window",
+ "derive_more",
+ "downcast-rs 2.0.2",
+ "serde",
+ "smallvec",
+ "thiserror 2.0.18",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_color"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2eb41e8310a85811d14a4e75cfc2d6c07ac70661d6a4883509fc960f622970a8"
+dependencies = [
+ "bevy_math",
+ "bevy_reflect",
+ "bytemuck",
+ "derive_more",
+ "encase",
+ "serde",
+ "thiserror 2.0.18",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_core_pipeline"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d0810e85c2436e50c67448d48a83bf0bb1b5849899619ae2c7ea817221e9172"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_derive",
+ "bevy_diagnostic",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_transform",
+ "bevy_utils",
+ "bevy_window",
+ "bitflags 2.11.0",
+ "nonmax",
+ "radsort",
+ "smallvec",
+ "thiserror 2.0.18",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_derive"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "318ee0532c3da93749859d18f89a889c638fbc56aabac4d866583df7b951d103"
+dependencies = [
+ "bevy_macro_utils",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bevy_dev_tools"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4f1464a3f5ef5c23d917987714ee89881f9f791e9ff97ecf6600ee846b9569e"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_diagnostic",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_input",
+ "bevy_math",
+ "bevy_picking",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_state",
+ "bevy_text",
+ "bevy_time",
+ "bevy_transform",
+ "bevy_ui",
+ "bevy_ui_render",
+ "bevy_window",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_diagnostic"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec8543a0f7afd56d3499ba80ffab6ef0bad12f93c2d2ca9aa7b1f1b8816c3980"
+dependencies = [
+ "atomic-waker",
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_platform",
+ "bevy_tasks",
+ "bevy_time",
+ "const-fnv1a-hash",
+ "log",
+ "serde",
+ "sysinfo 0.37.2",
+]
+
+[[package]]
+name = "bevy_ecs"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9cf7a3ee41342dd7b5a5d82e200d0e8efb933169247fce853b4ad633d51e87d"
+dependencies = [
+ "arrayvec",
+ "bevy_ecs_macros",
+ "bevy_platform",
+ "bevy_ptr",
+ "bevy_reflect",
+ "bevy_tasks",
+ "bevy_utils",
+ "bitflags 2.11.0",
+ "bumpalo",
+ "concurrent-queue",
+ "derive_more",
+ "fixedbitset",
+ "indexmap 2.13.0",
+ "log",
+ "nonmax",
+ "serde",
+ "slotmap",
+ "smallvec",
+ "thiserror 2.0.18",
+ "variadics_please",
+]
+
+[[package]]
+name = "bevy_ecs_macros"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "908baf585e2ea16bd53ef0da57b69580478af0059d2dbdb4369991ac9794b618"
+dependencies = [
+ "bevy_macro_utils",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bevy_encase_derive"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4fee46eeddcbc00a805ae00ffa973f224671fc5cf0fe1a796963804faeade90"
+dependencies = [
+ "bevy_macro_utils",
+ "encase_derive_impl",
+]
+
+[[package]]
+name = "bevy_feathers"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1cb29be8f8443c5cc44e1c4710bbe02877e73703c60228ca043f20529a5496c6"
+dependencies = [
+ "accesskit",
+ "bevy_a11y",
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_input_focus",
+ "bevy_log",
+ "bevy_math",
+ "bevy_picking",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_text",
+ "bevy_ui",
+ "bevy_ui_render",
+ "bevy_ui_widgets",
+ "bevy_window",
+ "smol_str",
+]
+
+[[package]]
+name = "bevy_gilrs"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "611827ab0ce43b88c0a695e6603901b5f34687efecaf526c861456c9d8e6fedb"
+dependencies = [
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_input",
+ "bevy_platform",
+ "bevy_time",
+ "gilrs",
+ "thiserror 2.0.18",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_gizmos"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6aaff0dd5f405c83d290c5cd591835f1ae8009894947ab19dadcb323062bd7e7"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_ecs",
+ "bevy_gizmos_macros",
+ "bevy_light",
+ "bevy_math",
+ "bevy_reflect",
+ "bevy_time",
+ "bevy_transform",
+ "bevy_utils",
+]
+
+[[package]]
+name = "bevy_gizmos_macros"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6960ea308d7e94adcac5c712553ff86614bba6b663511f3f3812f6bec028b51e"
+dependencies = [
+ "bevy_macro_utils",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bevy_gizmos_render"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a8d18c089102de4c5e9326023ad96ba618a6961029f8102a33640b966883237"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_core_pipeline",
+ "bevy_ecs",
+ "bevy_gizmos",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_pbr",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_sprite_render",
+ "bevy_transform",
+ "bevy_utils",
+ "bytemuck",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_gltf"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f37fb52655d0439656ca0a1db027d46926e463c81d893d4b1639668e5d7f1c1"
+dependencies = [
+ "async-lock",
+ "base64 0.22.1",
+ "bevy_animation",
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_light",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_pbr",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_scene",
+ "bevy_tasks",
+ "bevy_transform",
+ "fixedbitset",
+ "gltf",
+ "itertools 0.14.0",
+ "percent-encoding",
+ "serde",
+ "serde_json",
+ "smallvec",
+ "thiserror 2.0.18",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_image"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a71daf9b2afdd032c2b1122d1d501f99126218cb3e9983b3604ec381daa35f22"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_color",
+ "bevy_ecs",
+ "bevy_math",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_utils",
+ "bitflags 2.11.0",
+ "bytemuck",
+ "futures-lite",
+ "guillotiere",
+ "half",
+ "image",
+ "ktx2",
+ "rectangle-pack",
+ "ruzstd",
+ "serde",
+ "thiserror 2.0.18",
+ "tracing",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_input"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbc8ffbd02df34dfc52faf420a5263985973765e228043adf542fd0d790a6b21"
+dependencies = [
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_math",
+ "bevy_platform",
+ "bevy_reflect",
+ "derive_more",
+ "log",
+ "smol_str",
+ "thiserror 2.0.18",
+]
+
+[[package]]
+name = "bevy_input_focus"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d48a5bceccb9157549a39ab3de4017f5368b65db6471605e9a3f1c19d91bbc"
+dependencies = [
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_input",
+ "bevy_math",
+ "bevy_picking",
+ "bevy_reflect",
+ "bevy_window",
+ "log",
+ "thiserror 2.0.18",
+]
+
+[[package]]
+name = "bevy_internal"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a11df62e49897def470471551c02f13c6fb488e55dddb5ab7ef098132e07754"
+dependencies = [
+ "bevy_a11y",
+ "bevy_android",
+ "bevy_animation",
+ "bevy_anti_alias",
+ "bevy_app",
+ "bevy_asset",
+ "bevy_audio",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_core_pipeline",
+ "bevy_derive",
+ "bevy_dev_tools",
+ "bevy_diagnostic",
+ "bevy_ecs",
+ "bevy_feathers",
+ "bevy_gilrs",
+ "bevy_gizmos",
+ "bevy_gizmos_render",
+ "bevy_gltf",
+ "bevy_image",
+ "bevy_input",
+ "bevy_input_focus",
+ "bevy_light",
+ "bevy_log",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_pbr",
+ "bevy_picking",
+ "bevy_platform",
+ "bevy_post_process",
+ "bevy_ptr",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_scene",
+ "bevy_shader",
+ "bevy_sprite",
+ "bevy_sprite_render",
+ "bevy_state",
+ "bevy_tasks",
+ "bevy_text",
+ "bevy_time",
+ "bevy_transform",
+ "bevy_ui",
+ "bevy_ui_render",
+ "bevy_utils",
+ "bevy_window",
+ "bevy_winit",
+]
+
+[[package]]
+name = "bevy_light"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d9d2ac64390a9baacb3c0fa0f5456ac1553959d5a387874c102a09aab8b92cc"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_transform",
+ "bevy_utils",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_log"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2aac1187f83a1ab2eae887564f7fb14b4abb3fbe8b2267a6426663463923120"
+dependencies = [
+ "android_log-sys",
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_platform",
+ "bevy_utils",
+ "tracing",
+ "tracing-log",
+ "tracing-oslog",
+ "tracing-subscriber",
+ "tracing-wasm",
+]
+
+[[package]]
+name = "bevy_macro_utils"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b147843b81a7ec548876ff97fa7bfdc646ef2567cb465566259237b39664438"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+ "toml_edit 0.23.10+spec-1.0.0",
+]
+
+[[package]]
+name = "bevy_math"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e931fa969f89c83498b22c97432383afe90e90fd1a5e04fa07be8da4d3bcac84"
+dependencies = [
+ "approx",
+ "arrayvec",
+ "bevy_reflect",
+ "derive_more",
+ "glam",
+ "itertools 0.14.0",
+ "libm",
+ "rand 0.9.2",
+ "rand_distr",
+ "serde",
+ "thiserror 2.0.18",
+ "variadics_please",
+]
+
+[[package]]
+name = "bevy_mesh"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "288f590c8173d4cca3cae5f2ba579accd5ed1a35dd3fab338f427eb39d55f05e"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mikktspace",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_transform",
+ "bitflags 2.11.0",
+ "bytemuck",
+ "derive_more",
+ "hexasphere",
+ "thiserror 2.0.18",
+ "tracing",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_mikktspace"
+version = "0.17.0-dev"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ef8e4b7e61dfe7719bb03c884dc270cd46a82efb40f93e9933b990c5c190c59"
+
+[[package]]
+name = "bevy_pbr"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5ab6944ffc6fd71604c0fbca68cc3e2a3654edfcdbfd232f9d8b88e3d20fdc0"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_core_pipeline",
+ "bevy_derive",
+ "bevy_diagnostic",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_light",
+ "bevy_log",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_transform",
+ "bevy_utils",
+ "bitflags 2.11.0",
+ "bytemuck",
+ "derive_more",
+ "fixedbitset",
+ "nonmax",
+ "offset-allocator",
+ "smallvec",
+ "static_assertions",
+ "thiserror 2.0.18",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_picking"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7d524dbc8f2c9e73f7ab70c148c8f7886f3c24b8aa8c252a38ba68ed06cbf10"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_input",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_time",
+ "bevy_transform",
+ "bevy_window",
+ "crossbeam-channel",
+ "tracing",
+ "uuid",
+]
+
+[[package]]
+name = "bevy_platform"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec6b36504169b644acd26a5469fd8d371aa6f1d73ee5c01b1b1181ae1cefbf9b"
+dependencies = [
+ "critical-section",
+ "foldhash 0.2.0",
+ "futures-channel",
+ "hashbrown 0.16.1",
+ "js-sys",
+ "portable-atomic",
+ "portable-atomic-util",
+ "serde",
+ "spin 0.10.0",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-time",
+]
+
+[[package]]
+name = "bevy_post_process"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f77a4e894aea992e3d6938f1d5898a1cdbb87dba6eebfb95cb4038d0a2600e9"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_core_pipeline",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_transform",
+ "bevy_utils",
+ "bevy_window",
+ "bitflags 2.11.0",
+ "nonmax",
+ "radsort",
+ "smallvec",
+ "thiserror 2.0.18",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_prototype_lyon"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c172d3d743eab7ca2b50844e5a0bd9e8b0ecaace8acd9ccc7233b30446425f1"
+dependencies = [
+ "bevy",
+ "lyon_algorithms",
+ "lyon_tessellation",
+ "svgtypes",
+]
+
+[[package]]
+name = "bevy_ptr"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7a9329e8dc4e01ced480eeec4902e6d7cb56e56ec37f6fbc4323e5c937290a7"
+
+[[package]]
+name = "bevy_reflect"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1dfeb67a9fe4f59003a84f5f99ba6302141c70e926601cbc6abfd4a1eea9ca9"
+dependencies = [
+ "assert_type_match",
+ "bevy_platform",
+ "bevy_ptr",
+ "bevy_reflect_derive",
+ "bevy_utils",
+ "derive_more",
+ "disqualified",
+ "downcast-rs 2.0.2",
+ "erased-serde",
+ "foldhash 0.2.0",
+ "glam",
+ "indexmap 2.13.0",
+ "inventory",
+ "petgraph",
+ "serde",
+ "smallvec",
+ "smol_str",
+ "thiserror 2.0.18",
+ "uuid",
+ "variadics_please",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_reflect_derive"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "475f68c93e9cd5f17e9167635c8533a4f388f12d38245a202359e4c2721d87ba"
+dependencies = [
+ "bevy_macro_utils",
+ "indexmap 2.13.0",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+ "uuid",
+]
+
+[[package]]
+name = "bevy_render"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "243523e33fe5dfcebc4240b1eb2fc16e855c5d4c0ea6a8393910740956770f44"
+dependencies = [
+ "async-channel",
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_derive",
+ "bevy_diagnostic",
+ "bevy_ecs",
+ "bevy_encase_derive",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render_macros",
+ "bevy_shader",
+ "bevy_tasks",
+ "bevy_time",
+ "bevy_transform",
+ "bevy_utils",
+ "bevy_window",
+ "bitflags 2.11.0",
+ "bytemuck",
+ "derive_more",
+ "downcast-rs 2.0.2",
+ "encase",
+ "fixedbitset",
+ "glam",
+ "image",
+ "indexmap 2.13.0",
+ "js-sys",
+ "naga",
+ "nonmax",
+ "offset-allocator",
+ "send_wrapper",
+ "smallvec",
+ "thiserror 2.0.18",
+ "tracing",
+ "variadics_please",
+ "wasm-bindgen",
+ "web-sys",
+ "wgpu",
+]
+
+[[package]]
+name = "bevy_render_macros"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "66b6325e9c495a71270446784611e8d7f446f927eac8506c4c099fd10cb4c3ed"
+dependencies = [
+ "bevy_macro_utils",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bevy_scene"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34cc1047d85ec8048261b63ef675c12f1e6b5782dc0b422fbcee0c140d026bd4"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_transform",
+ "bevy_utils",
+ "derive_more",
+ "ron",
+ "serde",
+ "thiserror 2.0.18",
+ "uuid",
+]
+
+[[package]]
+name = "bevy_shader"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9eea95f0273c32be13d6a0b799a93bc256ad7830759ede595c404d5234302da2"
+dependencies = [
+ "bevy_asset",
+ "bevy_platform",
+ "bevy_reflect",
+ "naga",
+ "naga_oil",
+ "serde",
+ "thiserror 2.0.18",
+ "tracing",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_sprite"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96ec5bc0cbdee551b610a46f41d30374bbe42b8951ffc676253c6243ab2b9395"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_picking",
+ "bevy_reflect",
+ "bevy_text",
+ "bevy_transform",
+ "bevy_window",
+ "radsort",
+ "tracing",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_sprite_render"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b82cb08905e7ddcea2694a95f757ae7f1fd01e6a7304076bad595d2158e4bfe0"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_core_pipeline",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_sprite",
+ "bevy_text",
+ "bevy_transform",
+ "bevy_utils",
+ "bitflags 2.11.0",
+ "bytemuck",
+ "derive_more",
+ "fixedbitset",
+ "nonmax",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_state"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ae0682968e97d29c1eccc8c6bb6283f2678d362779bc03f1bb990967059473b"
+dependencies = [
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_state_macros",
+ "bevy_utils",
+ "log",
+ "variadics_please",
+]
+
+[[package]]
+name = "bevy_state_macros"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73d32f90f9cfcef5a44401db7ce206770daaa1707b0fb95eb7a96a6933f54f1b"
+dependencies = [
+ "bevy_macro_utils",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bevy_tasks"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "384eb04d80aa38664d69988fd30cbbe03e937ecb65c66aa6abe60ce0bca826aa"
+dependencies = [
+ "async-channel",
+ "async-executor",
+ "async-task",
+ "atomic-waker",
+ "bevy_platform",
+ "concurrent-queue",
+ "crossbeam-queue",
+ "derive_more",
+ "futures-lite",
+ "heapless 0.9.2",
+ "pin-project",
+]
+
+[[package]]
+name = "bevy_text"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdc5233291dfc22e584de2535f2e37ae9766d37cb5a01652de2133ba202dcb9b"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_color",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_log",
+ "bevy_math",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_utils",
+ "cosmic-text",
+ "serde",
+ "smallvec",
+ "sys-locale",
+ "thiserror 2.0.18",
+ "tracing",
+ "wgpu-types",
+]
+
+[[package]]
+name = "bevy_time"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5ef9af4e523195e561074cf60fbfad0f4cb8d1db504855fee3c4ce8896c7244"
+dependencies = [
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_platform",
+ "bevy_reflect",
+ "crossbeam-channel",
+ "log",
+ "serde",
+]
+
+[[package]]
+name = "bevy_transform"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c3bb3de7842fef699344beb03f22bdbff16599d788fe0f47fbb3b1e6fa320eb"
+dependencies = [
+ "bevy_app",
+ "bevy_ecs",
+ "bevy_log",
+ "bevy_math",
+ "bevy_reflect",
+ "bevy_tasks",
+ "bevy_utils",
+ "derive_more",
+ "serde",
+ "thiserror 2.0.18",
+]
+
+[[package]]
+name = "bevy_ui"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1691a411014085e0d35f8bb8208e5f973edd7ace061a4b1c41c83de21579dc70"
+dependencies = [
+ "accesskit",
+ "bevy_a11y",
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_input",
+ "bevy_input_focus",
+ "bevy_math",
+ "bevy_picking",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_sprite",
+ "bevy_text",
+ "bevy_transform",
+ "bevy_utils",
+ "bevy_window",
+ "derive_more",
+ "smallvec",
+ "taffy",
+ "thiserror 2.0.18",
+ "tracing",
+ "uuid",
+]
+
+[[package]]
+name = "bevy_ui_render"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2c35402d8a052f512e3fec1f36b26e83eee713fcca57f965c244ee795e1fcb0"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_camera",
+ "bevy_color",
+ "bevy_core_pipeline",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_math",
+ "bevy_mesh",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_render",
+ "bevy_shader",
+ "bevy_sprite",
+ "bevy_sprite_render",
+ "bevy_text",
+ "bevy_transform",
+ "bevy_ui",
+ "bevy_utils",
+ "bytemuck",
+ "derive_more",
+ "tracing",
+]
+
+[[package]]
+name = "bevy_ui_widgets"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6a63cb818b0de41bdb14990e0ce1aaaa347f871750ab280f80c427e83d72712"
+dependencies = [
+ "accesskit",
+ "bevy_a11y",
+ "bevy_app",
+ "bevy_camera",
+ "bevy_ecs",
+ "bevy_input",
+ "bevy_input_focus",
+ "bevy_log",
+ "bevy_math",
+ "bevy_picking",
+ "bevy_reflect",
+ "bevy_ui",
+]
+
+[[package]]
+name = "bevy_utils"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2111910cd7a4b1e6ce07eaaeb6f68a2c0ea0ca609ed0d0d506e3eb161101435b"
+dependencies = [
+ "bevy_platform",
+ "disqualified",
+ "thread_local",
+]
+
+[[package]]
+name = "bevy_window"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6df06e6993a0896bae2fe7644ae6def29a1a92b45dfb1bcebbd92af782be3638"
+dependencies = [
+ "bevy_app",
+ "bevy_asset",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_input",
+ "bevy_math",
+ "bevy_platform",
+ "bevy_reflect",
+ "log",
+ "raw-window-handle",
+ "serde",
+]
+
+[[package]]
+name = "bevy_winit"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2de1c13d32ab8528435b58eca7ab874a1068184c6d6f266ee11433ae99d4069"
+dependencies = [
+ "accesskit",
+ "accesskit_winit",
+ "approx",
+ "bevy_a11y",
+ "bevy_android",
+ "bevy_app",
+ "bevy_asset",
+ "bevy_derive",
+ "bevy_ecs",
+ "bevy_image",
+ "bevy_input",
+ "bevy_input_focus",
+ "bevy_log",
+ "bevy_math",
+ "bevy_platform",
+ "bevy_reflect",
+ "bevy_tasks",
+ "bevy_window",
+ "bytemuck",
+ "cfg-if",
+ "js-sys",
+ "tracing",
+ "wasm-bindgen",
+ "web-sys",
+ "wgpu-types",
+ "winit",
+]
+
+[[package]]
+name = "bigdecimal"
+version = "0.4.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d6867f1565b3aad85681f1015055b087fcfd840d6aeee6eee7f2da317603695"
+dependencies = [
+ "autocfg",
+ "libm",
+ "num-bigint",
+ "num-integer",
+ "num-traits",
+ "serde",
+]
+
+[[package]]
+name = "bimap"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7"
+
+[[package]]
+name = "bincode"
+version = "1.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "bindgen"
+version = "0.71.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3"
+dependencies = [
+ "bitflags 2.11.0",
+ "cexpr",
+ "clang-sys",
+ "itertools 0.13.0",
+ "log",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "regex",
- "rustc-hash 2.1.1",
++ "rustc-hash 2.1.2",
+ "shlex",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bindgen"
+version = "0.72.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
+dependencies = [
+ "bitflags 2.11.0",
+ "cexpr",
+ "clang-sys",
+ "itertools 0.13.0",
+ "proc-macro2",
+ "quote",
+ "regex",
- "rustc-hash 2.1.1",
++ "rustc-hash 2.1.2",
+ "shlex",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
+dependencies = [
+ "bit-vec 0.8.0",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd"
+dependencies = [
+ "bit-vec 0.9.1",
+]
+
+[[package]]
+name = "bit-vec"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
+
+[[package]]
+name = "bit-vec"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "bit_field"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
+
+[[package]]
+name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
@@@ -2913,15 -1358,9 +2913,15 @@@ dependencies =
"cc",
"cfg-if",
"constant_time_eq",
- "cpufeatures 0.2.17",
+ "cpufeatures 0.3.0",
]
+[[package]]
+name = "block"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
+
[[package]]
name = "block-buffer"
version = "0.10.4"
@@@ -3727,7 -2107,7 +3727,7 @@@ dependencies =
"futures-util",
"libc",
"quinn-proto",
- "rustc-hash 2.1.1",
- "rustc-hash",
++ "rustc-hash 2.1.2",
"rustls",
"synchrony",
"thiserror 2.0.18",
@@@ -9629,200 -7212,12 +9631,200 @@@ dependencies =
]
[[package]]
-name = "num-complex"
-version = "0.4.6"
+name = "num-complex"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-conv"
- version = "0.2.0"
++version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
++checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967"
+
+[[package]]
+name = "num-derive"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "num-integer"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-iter"
+version = "0.1.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-modular"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "17bb261bf36fa7d83f4c294f834e91256769097b3cb505d44831e0a179ac647f"
+
+[[package]]
+name = "num-order"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "537b596b97c40fcf8056d153049eb22f481c17ebce72a513ec9286e4986d1bb6"
+dependencies = [
+ "num-modular",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
+dependencies = [
+ "num-bigint",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
+dependencies = [
+ "autocfg",
+ "libm",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "num_enum"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26"
+dependencies = [
+ "num_enum_derive",
+ "rustversion",
+]
+
+[[package]]
+name = "num_enum_derive"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8"
+dependencies = [
+ "proc-macro-crate 3.5.0",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "num_threads"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "objc"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
+dependencies = [
+ "malloc_buf",
+]
+
+[[package]]
+name = "objc-sys"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
+
+[[package]]
+name = "objc2"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
+dependencies = [
+ "objc-sys",
+ "objc2-encode",
+]
+
+[[package]]
+name = "objc2"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f"
+dependencies = [
+ "objc2-encode",
+]
+
+[[package]]
+name = "objc2-app-kit"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"
+dependencies = [
+ "bitflags 2.11.0",
+ "block2 0.5.1",
+ "libc",
+ "objc2 0.5.2",
+ "objc2-core-data",
+ "objc2-core-image",
+ "objc2-foundation",
+ "objc2-quartz-core",
+]
+
+[[package]]
+name = "objc2-cloud-kit"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
+dependencies = [
+ "bitflags 2.11.0",
+ "block2 0.5.1",
+ "objc2 0.5.2",
+ "objc2-core-location",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-contacts"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
+checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
dependencies = [
- "num-traits",
+ "block2 0.5.1",
+ "objc2 0.5.2",
+ "objc2-foundation",
]
[[package]]
@@@ -11246,7 -8491,7 +11248,7 @@@ dependencies =
"pin-project-lite",
"quinn-proto",
"quinn-udp",
- "rustc-hash 2.1.1",
- "rustc-hash",
++ "rustc-hash 2.1.2",
"rustls",
"socket2 0.6.3",
"thiserror 2.0.18",
@@@ -11268,7 -8513,7 +11270,7 @@@ dependencies =
"lru-slab",
"rand 0.9.2",
"ring",
- "rustc-hash 2.1.1",
- "rustc-hash",
++ "rustc-hash 2.1.2",
"rustls",
"rustls-pki-types",
"rustls-platform-verifier",
@@@ -12137,19 -9273,14 +12139,20 @@@ dependencies =
"rkyv",
"serde",
"serde_json",
+ "wasm-bindgen",
]
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+
[[package]]
name = "rustc-hash"
- version = "2.1.1"
+ version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+ checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
[[package]]
name = "rustc_version"
@@@ -12813,7 -9916,79 +12816,79 @@@ dependencies =
"sysinfo 0.38.4",
"tempfile",
"thiserror 2.0.18",
- "toml 1.1.0+spec-1.1.0",
+ "toml 1.1.2+spec-1.1.0",
+ "tower-http",
+ "tracing",
+ "tracing-appender",
+ "tracing-opentelemetry",
+ "tracing-subscriber",
+ "ulid",
+ "uuid",
+ "vergen-git2",
+ ]
+
+ [[package]]
+ name = "server-ng"
+ version = "0.7.3-edge.1"
+ dependencies = [
+ "ahash 0.8.12",
+ "anyhow",
+ "argon2",
+ "async-channel",
+ "async_zip",
+ "axum",
+ "axum-server",
+ "bytes",
+ "chrono",
+ "clap",
+ "compio",
+ "configs",
+ "ctrlc",
+ "cyper",
+ "cyper-axum",
+ "dashmap",
+ "dotenvy",
+ "err_trail",
+ "error_set",
+ "figlet-rs",
+ "flume 0.12.0",
+ "fs2",
+ "futures",
+ "hash32 1.0.0",
+ "human-repr",
+ "hwlocality",
+ "iggy_binary_protocol",
+ "iggy_common",
+ "jsonwebtoken",
+ "left-right",
+ "metadata",
+ "mimalloc",
+ "mime_guess",
- "nix",
++ "nix 0.31.2",
+ "opentelemetry",
+ "opentelemetry-appender-tracing",
+ "opentelemetry-otlp",
+ "opentelemetry-semantic-conventions",
+ "opentelemetry_sdk",
+ "papaya",
+ "prometheus-client",
+ "rand 0.10.0",
+ "ringbuffer",
+ "rmp-serde",
+ "rolling-file",
+ "rust-embed",
+ "rustls",
+ "rustls-pemfile",
+ "secrecy",
+ "send_wrapper",
+ "serde",
+ "slab",
+ "socket2 0.6.3",
+ "strum 0.28.0",
+ "sysinfo 0.38.4",
+ "tempfile",
+ "thiserror 2.0.18",
+ "toml 1.1.2+spec-1.1.0",
"tower-http",
"tracing",
"tracing-appender",
@@@ -12998,19 -10163,6 +13073,17 @@@ dependencies =
"tracing",
]
+[[package]]
+name = "simulator-ui"
+version = "0.1.0"
+dependencies = [
+ "bevy",
+ "bevy_prototype_lyon",
- "getrandom 0.3.4",
+ "rand 0.9.2",
+ "rand_xoshiro 0.7.0",
- "strum 0.28.0",
+ "strum_macros 0.28.0",
+]
+
[[package]]
name = "siphasher"
version = "1.0.2"
@@@ -13170,7 -10268,7 +13243,7 @@@ dependencies =
"data-encoding",
"debugid",
"if_chain",
- "rustc-hash 2.1.1",
- "rustc-hash",
++ "rustc-hash 2.1.2",
"serde",
"serde_json",
"unicode-id-start",
@@@ -13684,20 -10738,11 +13757,20 @@@ dependencies =
"syn 2.0.117",
]
+[[package]]
+name = "sys-locale"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "sys_traits"
- version = "0.1.26"
+ version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "fe719c6bb50991671073b1469be68ccbcb5a2a2730873eab49b88c35a908037e"
+ checksum = "5a79feaa49de4a6c8191bdbd5fb3eada50671e9367d874d1c12e3d36db131414"
dependencies = [
"sys_traits_macros",
]
@@@ -14209,20 -11233,11 +14282,20 @@@ dependencies =
"serde",
]
+[[package]]
+name = "toml_datetime"
+version = "0.7.5+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
+dependencies = [
+ "serde_core",
+]
+
[[package]]
name = "toml_datetime"
- version = "1.1.0+spec-1.1.0"
+ version = "1.1.1+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "97251a7c317e03ad83774a8752a7e81fb6067740609f75ea2b585b569a59198f"
+ checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
dependencies = [
"serde_core",
]
@@@ -14252,28 -11267,16 +14325,28 @@@ dependencies =
"winnow 0.7.15",
]
+[[package]]
+name = "toml_edit"
+version = "0.23.10+spec-1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269"
+dependencies = [
+ "indexmap 2.13.0",
+ "toml_datetime 0.7.5+spec-1.1.0",
+ "toml_parser",
+ "winnow 0.7.15",
+]
+
[[package]]
name = "toml_edit"
- version = "0.25.8+spec-1.1.0"
+ version = "0.25.10+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "16bff38f1d86c47f9ff0647e6838d7bb362522bdf44006c7068c2b1e606f1f3c"
+ checksum = "a82418ca169e235e6c399a84e395ab6debeb3bc90edc959bf0f48647c6a32d1b"
dependencies = [
"indexmap 2.13.0",
- "toml_datetime 1.1.0+spec-1.1.0",
+ "toml_datetime 1.1.1+spec-1.1.0",
"toml_parser",
- "winnow 1.0.0",
+ "winnow 1.0.1",
]
[[package]]
@@@ -16668,17 -13149,11 +16737,17 @@@ dependencies =
"synstructure",
]
+[[package]]
+name = "zeno"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
+
[[package]]
name = "zerocopy"
- version = "0.8.47"
+ version = "0.8.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87"
+ checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
dependencies = [
"zerocopy-derive",
]
diff --cc Cargo.toml
index 3b3663603,877491457..5cac4e6c9
--- a/Cargo.toml
+++ b/Cargo.toml
@@@ -55,9 -55,9 +55,10 @@@ members =
"core/partitions",
"core/sdk",
"core/server",
+ "core/server-ng",
"core/shard",
"core/simulator",
+ "core/simulator_ui",
"core/tools",
"examples/rust",
]
diff --cc core/simulator_ui/Cargo.toml
index a22a50c17,000000000..5851fcb10
mode 100644,000000..100644
--- a/core/simulator_ui/Cargo.toml
+++ b/core/simulator_ui/Cargo.toml
@@@ -1,37 -1,0 +1,35 @@@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[package]
+name = "simulator-ui"
+version = "0.1.0"
+edition = "2024"
+publish = false
+
+[dependencies]
+bevy = { version = "0.18", features = ["webgl2"] }
+bevy_prototype_lyon = "0.16"
+rand = "0.9"
+rand_xoshiro = "0.7"
- strum = { workspace = true }
+strum_macros = { workspace = true }
+
+[[bin]]
+name = "simulator-ui"
+path = "src/main.rs"
+
+[target.'cfg(target_arch = "wasm32")'.dependencies]
- getrandom = { version = "0.3", features = ["wasm_js"] }
diff --cc core/simulator_ui/src/main.rs
index a48e318e1,000000000..574a4ef7c
mode 100644,000000..100644
--- a/core/simulator_ui/src/main.rs
+++ b/core/simulator_ui/src/main.rs
@@@ -1,2865 -1,0 +1,3003 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+mod vsr;
+
+use bevy::asset::AssetPlugin;
+use bevy::prelude::*;
+use bevy_prototype_lyon::prelude::*;
+use std::f32::consts::PI;
+
+// -- Apache Iggy brand palette (matches iggy.apache.org dark theme) ---------
+
- const BG_DARK: Color = Color::srgb_u8(0x07, 0x0c, 0x17); // website main bg
- const BG_PANEL: Color = Color::srgb_u8(0x0c, 0x12, 0x20); // card/panel bg
- const NEON_CYAN: Color = Color::srgb_u8(0x67, 0xe8, 0xf9); // entity cyan
- const NEON_MAGENTA: Color = Color::srgb_u8(0xfa, 0x5e, 0x8a); // gradient pink
- const NEON_YELLOW: Color = Color::srgb_u8(0xfe, 0xbc, 0x2e); // macOS yellow
- const IGGY_ORANGE: Color = Color::srgb_u8(0xff, 0x91, 0x03); // brand primary #ff9103
- const COOL_WHITE: Color = Color::srgb_u8(0xff, 0xfa, 0xeb); // website cream text
- const DIM_GRAY: Color = Color::srgb_u8(0xaa, 0xaf, 0xb6); // website muted text
- const GRID_LINE: Color = Color::srgb_u8(0x11, 0x1d, 0x35); // dark overlay blue
- const HUD_EDGE: Color = Color::srgb_u8(0x3d, 0x44, 0x50); // border/line color
- const HUD_ALERT: Color = Color::srgb_u8(0xff, 0x5f, 0x57); // macOS red
++const BG_DARK: Color = Color::srgb_u8(0x07, 0x0c, 0x17); // website main bg
++const BG_PANEL: Color = Color::srgb_u8(0x0c, 0x12, 0x20); // card/panel bg
++const NEON_CYAN: Color = Color::srgb_u8(0x67, 0xe8, 0xf9); // entity cyan
++const NEON_MAGENTA: Color = Color::srgb_u8(0xfa, 0x5e, 0x8a); // gradient pink
++const NEON_YELLOW: Color = Color::srgb_u8(0xfe, 0xbc, 0x2e); // macOS yellow
++const IGGY_ORANGE: Color = Color::srgb_u8(0xff, 0x91, 0x03); // brand primary #ff9103
++const COOL_WHITE: Color = Color::srgb_u8(0xff, 0xfa, 0xeb); // website cream text
++const DIM_GRAY: Color = Color::srgb_u8(0xaa, 0xaf, 0xb6); // website muted text
++const GRID_LINE: Color = Color::srgb_u8(0x11, 0x1d, 0x35); // dark overlay blue
++const HUD_EDGE: Color = Color::srgb_u8(0x3d, 0x44, 0x50); // border/line color
++const HUD_ALERT: Color = Color::srgb_u8(0xff, 0x5f, 0x57); // macOS red
+
+// -- Layout constants -------------------------------------------------------
+
+const REPLICA_COUNT: u8 = 3;
+const CIRCLE_RADIUS: f32 = 300.0;
+const WORLD_CENTER_Y: f32 = 90.0;
+const IGGY_SPRITE_SIZE: Vec2 = Vec2::new(210.0, 176.0);
+const MSG_DURATION: f32 = 0.5;
+const TRAIL_LIFETIME: f32 = 0.25;
+const SCAN_LINE_COUNT: usize = 4;
+const AMBIENT_PARTICLE_COUNT: usize = 60;
+const ORBIT_DOTS_PER_REPLICA: usize = 5;
+const COMMIT_RING_LIFETIME: f32 = 0.7;
+const SCREEN_FLASH_DURATION: f32 = 0.25;
+const SPEED_LINE_LIFETIME: f32 = 0.15;
+
+// -- Resources --------------------------------------------------------------
+
+#[derive(Resource)]
+struct SimState {
+ simulator: vsr::VsrSimulator,
+ playing: bool,
+ speed: f32,
+ tick_accumulator: f32,
+ total_commits: u64,
+ ops_per_second: f64,
+ ops_window_start: f64,
+ ops_window_count: u64,
+ frame_count: u64,
+}
+
+impl Default for SimState {
+ fn default() -> Self {
+ Self {
+ simulator: vsr::VsrSimulator::new(REPLICA_COUNT, 42),
+ playing: true,
+ speed: 1.0,
+ tick_accumulator: 0.0,
+ total_commits: 0,
+ ops_per_second: 0.0,
+ ops_window_start: 0.0,
+ ops_window_count: 0,
+ frame_count: 0,
+ }
+ }
+}
+
+#[derive(Resource)]
+struct ReplicaPositions(Vec<Vec2>);
+
+impl Default for ReplicaPositions {
+ fn default() -> Self {
+ let mut positions = Vec::with_capacity(REPLICA_COUNT as usize);
+ for i in 0..REPLICA_COUNT {
+ let angle = 2.0 * PI * (i as f32) / (REPLICA_COUNT as f32) - PI / 2.0;
+ positions.push(Vec2::new(
+ CIRCLE_RADIUS * angle.cos(),
+ CIRCLE_RADIUS * angle.sin() + WORLD_CENTER_Y,
+ ));
+ }
+ Self(positions)
+ }
+}
+
+#[derive(Resource)]
+struct ReplicaFxState {
+ kill: [f32; REPLICA_COUNT as usize],
+ revive: [f32; REPLICA_COUNT as usize],
+ healthy: [f32; REPLICA_COUNT as usize],
+ last_alive: [bool; REPLICA_COUNT as usize],
+ last_status: [vsr::Status; REPLICA_COUNT as usize],
+ callout_timer: [f32; REPLICA_COUNT as usize],
+ callout_text: [String; REPLICA_COUNT as usize],
+ callout_color: [Color; REPLICA_COUNT as usize],
+}
+
+impl Default for ReplicaFxState {
+ fn default() -> Self {
+ Self {
+ kill: [0.0; REPLICA_COUNT as usize],
+ revive: [0.0; REPLICA_COUNT as usize],
+ healthy: [0.0; REPLICA_COUNT as usize],
+ last_alive: [true; REPLICA_COUNT as usize],
+ last_status: [vsr::Status::Normal; REPLICA_COUNT as usize],
+ callout_timer: [0.0; REPLICA_COUNT as usize],
+ callout_text: std::array::from_fn(|_| String::new()),
+ callout_color: [COOL_WHITE; REPLICA_COUNT as usize],
+ }
+ }
+}
+
+#[derive(Resource)]
+struct AppFxState {
+ pulse: [f32; 4],
+}
+
+impl Default for AppFxState {
+ fn default() -> Self {
+ Self { pulse: [0.0; 4] }
+ }
+}
+
+const EVENT_LOG_MAX: usize = 200;
+
+#[derive(Clone)]
+struct EventLogEntry {
+ tick: u64,
+ icon: &'static str,
+ headline: String,
+ detail: String,
+ color: Color,
+}
+
+#[derive(Resource)]
+struct EventLog {
+ entries: Vec<EventLogEntry>,
+ visible: bool,
+ show_details: bool,
+}
+
+impl Default for EventLog {
+ fn default() -> Self {
+ Self {
+ entries: Vec::with_capacity(EVENT_LOG_MAX),
+ visible: false,
+ show_details: false,
+ }
+ }
+}
+
+impl EventLog {
+ fn push(&mut self, entry: EventLogEntry) {
+ if self.entries.len() >= EVENT_LOG_MAX {
+ self.entries.remove(0);
+ }
+ self.entries.push(entry);
+ }
+}
+
+fn dog_name(id: u8) -> &'static str {
+ match id {
+ 0 => "Iggy",
+ 1 => "Zippy",
+ 2 => "Dash",
+ 3 => "Bolt",
+ 4 => "Flash",
+ _ => "Pup",
+ }
+}
+
+fn narrate_event(event: &vsr::SimEvent) -> Option<EventLogEntry> {
+ match event {
- vsr::SimEvent::ClientRequest { tick, replica_id, .. } => {
++ vsr::SimEvent::ClientRequest {
++ tick, replica_id, ..
++ } => {
+ let name = dog_name(*replica_id);
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: "[REQ]",
+ headline: format!("Ball thrown to {name}!"),
+ detail: format!(
+ "A client tossed a new request to {name} (R{replica_id}). \
+ As lead dog, {name} will replicate it to the pack before confirming."
+ ),
+ color: IGGY_ORANGE,
+ })
+ }
- vsr::SimEvent::PrepareQueued { tick, replica_id, op, pipeline_depth, .. } => {
++ vsr::SimEvent::PrepareQueued {
++ tick,
++ replica_id,
++ op,
++ pipeline_depth,
++ ..
++ } => {
+ let name = dog_name(*replica_id);
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: "[QUE]",
+ headline: format!("{name} queued op #{op}"),
+ detail: format!(
+ "{name} added operation #{op} to the pipeline ({pipeline_depth}/8 slots used). \
+ Now broadcasting Prepare to the pack -- every dog must log this before it counts."
+ ),
+ color: Color::srgb_u8(95, 135, 253),
+ })
+ }
- vsr::SimEvent::PrepareAcked { tick, replica_id, op, ack_from, ack_count, quorum, quorum_reached, .. } => {
++ vsr::SimEvent::PrepareAcked {
++ tick,
++ replica_id,
++ op,
++ ack_from,
++ ack_count,
++ quorum,
++ quorum_reached,
++ ..
++ } => {
+ let lead = dog_name(*replica_id);
+ let acker = dog_name(*ack_from);
+ let status = if *quorum_reached {
+ format!("That's {ack_count}/{quorum} -- quorum reached! {lead} can now commit.")
+ } else {
- format!("That's {ack_count}/{quorum} acks. Need {} more for quorum.", quorum - ack_count)
++ format!(
++ "That's {ack_count}/{quorum} acks. Need {} more for quorum.",
++ quorum - ack_count
++ )
+ };
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: if *quorum_reached { "[OK!]" } else { "[ACK]" },
- headline: format!("{acker} acked op #{op}{}", if *quorum_reached { " -- QUORUM!" } else { "" }),
++ headline: format!(
++ "{acker} acked op #{op}{}",
++ if *quorum_reached { " -- QUORUM!" } else { "" }
++ ),
+ detail: format!(
+ "{acker} (R{ack_from}) confirmed it logged operation #{op}. {status}"
+ ),
- color: if *quorum_reached { IGGY_ORANGE } else { Color::srgb_u8(20, 184, 166) },
++ color: if *quorum_reached {
++ IGGY_ORANGE
++ } else {
++ Color::srgb_u8(20, 184, 166)
++ },
+ })
+ }
- vsr::SimEvent::OperationCommitted { tick, replica_id, op, .. } => {
++ vsr::SimEvent::OperationCommitted {
++ tick,
++ replica_id,
++ op,
++ ..
++ } => {
+ let name = dog_name(*replica_id);
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: "[WIN]",
+ headline: format!("{name} committed op #{op}!"),
+ detail: format!(
+ "Operation #{op} is officially committed on {name} (R{replica_id}). \
+ The pack agreed -- this data is now durable and safe. Good boy!"
+ ),
+ color: IGGY_ORANGE,
+ })
+ }
+ vsr::SimEvent::MessageSent { tick, message, .. } => {
+ let from = dog_name(message.from);
+ let to = dog_name(message.to);
+ let (icon, headline, detail) = match message.msg_type {
+ vsr::MessageType::Prepare => (
+ "[PRE]",
+ format!("{from} -> {to}: Prepare"),
+ format!(
+ "{from} sent a Prepare for op #{} (view {}) to {to}. \
+ Asking {to} to log this operation and ack back.",
+ message.op, message.view
+ ),
+ ),
+ vsr::MessageType::PrepareOk => (
+ "[POK]",
+ format!("{from} -> {to}: PrepareOk"),
+ format!(
+ "{from} confirmed to {to}: \"I logged op #{}!\" \
+ One step closer to quorum.",
+ message.op
+ ),
+ ),
+ vsr::MessageType::StartViewChange => (
+ "[SVC]",
+ format!("{from} howls: StartViewChange!"),
+ format!(
+ "{from} suspects the lead dog is down! Broadcasting view change \
+ to view {} -- the pack needs a new leader.",
+ message.view
+ ),
+ ),
+ vsr::MessageType::DoViewChange => (
+ "[DVC]",
+ format!("{from} -> {to}: DoViewChange"),
+ format!(
+ "{from} is voting for {to} to become the new lead dog in view {}. \
+ Sending its log state so the new leader has all committed data.",
+ message.view
+ ),
+ ),
+ vsr::MessageType::StartView => (
+ "[NEW]",
+ format!("{from} announces: I'm lead dog!"),
+ format!(
+ "{from} won the election for view {}! Broadcasting StartView to the pack -- \
+ everyone sync up and follow the new leader.",
+ message.view
+ ),
+ ),
+ vsr::MessageType::ClientReply => (
+ "[RPL]",
+ format!("{from} returned the ball!"),
+ format!(
+ "{from} sent a reply to the client. The request for op #{} \
+ was committed and acknowledged. Fetch complete!",
+ message.op
+ ),
+ ),
+ vsr::MessageType::ClientRequest => (
+ "[REQ]",
+ format!("Ball thrown to {to}"),
+ format!("New client request heading to {to}."),
+ ),
+ vsr::MessageType::Commit => (
+ "[CMT]",
+ format!("{from} -> {to}: Commit"),
+ format!("{from} notified {to} that op #{} is committed.", message.op),
+ ),
+ };
+ Some(EventLogEntry {
+ tick: *tick,
+ icon,
+ headline,
+ detail,
+ color: message.msg_type.color(),
+ })
+ }
- vsr::SimEvent::MessageDropped { tick, message_id, .. } => {
- Some(EventLogEntry {
- tick: *tick,
- icon: "[DRP]",
- headline: format!("Message #{message_id} lost in the wind!"),
- detail: "A message was dropped by the network -- it never arrived. \
++ vsr::SimEvent::MessageDropped {
++ tick, message_id, ..
++ } => Some(EventLogEntry {
++ tick: *tick,
++ icon: "[DRP]",
++ headline: format!("Message #{message_id} lost in the wind!"),
++ detail: "A message was dropped by the network -- it never arrived. \
+ This can happen due to partitions or packet loss. The sender won't \
- know until a timeout fires.".to_string(),
- color: NEON_MAGENTA,
- })
- }
- vsr::SimEvent::ViewChangeStarted { tick, replica_id, old_view, new_view, reason, .. } => {
++ know until a timeout fires."
++ .to_string(),
++ color: NEON_MAGENTA,
++ }),
++ vsr::SimEvent::ViewChangeStarted {
++ tick,
++ replica_id,
++ old_view,
++ new_view,
++ reason,
++ ..
++ } => {
+ let name = dog_name(*replica_id);
+ let reason_text = match reason {
- vsr::ViewChangeReason::HeartbeatTimeout =>
- format!("{name} hasn't heard from the lead dog in too long (heartbeat timeout)."),
- vsr::ViewChangeReason::ViewChangeTimeout =>
- "The view change itself timed out -- the pack couldn't agree fast enough.".to_string(),
- vsr::ViewChangeReason::ReceivedStartViewChange =>
- format!("{name} heard another dog howling for a view change and joined in."),
- vsr::ViewChangeReason::ReceivedDoViewChange =>
- format!("{name} received a DoViewChange vote, triggering its own view change."),
++ vsr::ViewChangeReason::HeartbeatTimeout => format!(
++ "{name} hasn't heard from the lead dog in too long (heartbeat timeout)."
++ ),
++ vsr::ViewChangeReason::ViewChangeTimeout => {
++ "The view change itself timed out -- the pack couldn't agree fast enough."
++ .to_string()
++ }
++ vsr::ViewChangeReason::ReceivedStartViewChange => {
++ format!("{name} heard another dog howling for a view change and joined in.")
++ }
++ vsr::ViewChangeReason::ReceivedDoViewChange => {
++ format!("{name} received a DoViewChange vote, triggering its own view change.")
++ }
+ };
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: "[VCH]",
+ headline: format!("{name} started view change! (v{old_view} -> v{new_view})"),
+ detail: format!(
+ "{reason_text} The pack is reshuffling -- \
+ the dog at position (view {new_view} mod {REPLICA_COUNT}) = R{} \
+ will become the new lead dog if quorum agrees.",
+ new_view % REPLICA_COUNT as u32
+ ),
+ color: NEON_MAGENTA,
+ })
+ }
- vsr::SimEvent::PrimaryElected { tick, replica_id, view, .. } => {
++ vsr::SimEvent::PrimaryElected {
++ tick,
++ replica_id,
++ view,
++ ..
++ } => {
+ let name = dog_name(*replica_id);
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: "[LDR]",
+ headline: format!("{name} is the new lead dog! (view {view})"),
+ detail: format!(
+ "{name} (R{replica_id}) collected enough DoViewChange votes and is now \
+ the lead dog for view {view}. The pack will follow {name}'s lead \
+ for all new operations. Broadcasting StartView to synchronize everyone."
+ ),
+ color: NEON_YELLOW,
+ })
+ }
- vsr::SimEvent::ReplicaStateChanged { tick, replica_id, old_status, new_status, role, .. } => {
++ vsr::SimEvent::ReplicaStateChanged {
++ tick,
++ replica_id,
++ old_status,
++ new_status,
++ role,
++ ..
++ } => {
+ let name = dog_name(*replica_id);
+ let role_str = match role {
+ vsr::Role::Primary => "lead dog",
+ vsr::Role::Backup => "pack dog",
+ };
+ let transition = match (old_status, new_status) {
- (vsr::Status::Normal, vsr::Status::ViewChange) =>
- format!("{name} was running fine but now senses trouble -- howling for a new leader!"),
- (vsr::Status::ViewChange, vsr::Status::Normal) =>
- format!("{name} finished the view change and is back to running! The pack is stable again."),
- (vsr::Status::Recovering, vsr::Status::Normal) =>
- format!("{name} finished recovering and rejoined the race! Back on all four paws."),
- (vsr::Status::Normal, vsr::Status::Recovering) =>
- format!("{name} stumbled and is now recovering -- needs to catch up with the pack."),
- _ =>
- format!("{name} changed from {old_status:?} to {new_status:?}."),
++ (vsr::Status::Normal, vsr::Status::ViewChange) => format!(
++ "{name} was running fine but now senses trouble -- howling for a new leader!"
++ ),
++ (vsr::Status::ViewChange, vsr::Status::Normal) => format!(
++ "{name} finished the view change and is back to running! The pack is stable again."
++ ),
++ (vsr::Status::Recovering, vsr::Status::Normal) => format!(
++ "{name} finished recovering and rejoined the race! Back on all four paws."
++ ),
++ (vsr::Status::Normal, vsr::Status::Recovering) => format!(
++ "{name} stumbled and is now recovering -- needs to catch up with the pack."
++ ),
++ _ => format!("{name} changed from {old_status:?} to {new_status:?}."),
+ };
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: match new_status {
+ vsr::Status::Normal => "[RUN]",
+ vsr::Status::ViewChange => "[HWL]",
+ vsr::Status::Recovering => "[LMP]",
+ },
+ headline: format!("{name} ({role_str}): {old_status:?} -> {new_status:?}"),
+ detail: transition,
+ color: match new_status {
+ vsr::Status::Normal => NEON_CYAN,
+ vsr::Status::ViewChange => NEON_MAGENTA,
+ vsr::Status::Recovering => NEON_YELLOW,
+ },
+ })
+ }
+ vsr::SimEvent::LinkPartitioned { tick, from, to, .. } => {
+ let a = dog_name(*from);
+ let b = dog_name(*to);
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: "[FNC]",
+ headline: format!("Fence between {a} and {b}!"),
+ detail: format!(
+ "A network partition cut the link between {a} (R{from}) and {b} (R{to}). \
+ They can't hear each other anymore. If one side loses quorum, \
+ it won't be able to commit new operations."
+ ),
+ color: NEON_MAGENTA,
+ })
+ }
+ vsr::SimEvent::LinkHealed { tick, from, to, .. } => {
+ let a = dog_name(*from);
+ let b = dog_name(*to);
+ Some(EventLogEntry {
+ tick: *tick,
+ icon: "[HEL]",
+ headline: format!("Path clear between {a} and {b}!"),
+ detail: format!(
+ "The partition between {a} (R{from}) and {b} (R{to}) healed. \
+ Messages can flow again -- the pack can reunite."
+ ),
+ color: NEON_CYAN,
+ })
+ }
+ vsr::SimEvent::Tick { .. } | vsr::SimEvent::MessageDelivered { .. } => None,
+ }
+}
+
+#[derive(Component)]
+struct ReplicaGlow {
+ id: u8,
+}
+
+#[derive(Component)]
+struct ReplicaNeonOutline {
+ id: u8,
+}
+
+#[derive(Component)]
+struct ReplicaBody {
+ id: u8,
+}
+
+#[derive(Component)]
+struct ReplicaShadow {
+ id: u8,
+}
+
+#[derive(Component)]
+struct ReplicaIdText {
+ id: u8,
+}
+
+#[derive(Component)]
+struct ReplicaRoleText {
+ id: u8,
+}
+
+#[derive(Component)]
+struct ReplicaCalloutText {
+ id: u8,
+}
+
+#[derive(Component)]
+struct ReplicaSleepText {
+ id: u8,
+ layer: u8,
+}
+
+#[derive(Component)]
+struct AppCard {
+ id: usize,
+ anchor: Vec2,
+ accent: Color,
+}
+
+#[derive(Component)]
+struct AppCardLabel {
+ id: usize,
+ anchor: Vec2,
+}
+
+#[derive(Component)]
+struct AppLink {
+ id: usize,
+ anchor: Vec2,
+ target_replica: u8,
+ accent: Color,
+ inbound: bool,
+}
+
+#[derive(Component, Clone, Copy)]
+struct AppIcon {
+ id: usize,
+ anchor: Vec2,
+ accent: Color,
+ kind: AppKind,
+}
+
+#[derive(Component)]
+struct AppFlowParticle {
+ replica_id: u8,
+ from: Vec2,
+ to: Vec2,
+ control: Vec2,
+ progress: f32,
+ speed: f32,
+ color: Color,
+}
+
+#[derive(Clone, Copy)]
+enum AppKind {
+ Producer,
+ Consumer,
+}
+
+#[derive(Component)]
+struct LinkLine {
+ from_id: u8,
+ to_id: u8,
+}
+
+#[derive(Component)]
+struct MessageParticle {
+ from: Vec2,
+ to: Vec2,
+ control: Vec2,
+ progress: f32,
+ duration: f32,
+ msg_type: vsr::MessageType,
+}
+
+#[derive(Component)]
+struct MessageGlow;
+
+#[derive(Component)]
+struct TrailDot {
+ lifetime: f32,
+ max_lifetime: f32,
+ color: Color,
+}
+
+#[derive(Component)]
+struct ScanLine {
+ speed: f32,
+}
+
+#[derive(Component)]
+struct HudTickText;
+
+#[derive(Component)]
+struct HudOpsText;
+
+#[derive(Component)]
+struct HudCommitsText;
+
+#[derive(Component)]
+struct HudStateText;
+
+#[derive(Component)]
+struct HudSpeedText;
+
+#[derive(Component)]
+struct PauseOverlay;
+
+#[derive(Component)]
+struct PauseMainText;
+
+#[derive(Component)]
+struct PauseSubtext;
+
+#[derive(Component)]
+struct GlowFlash {
+ id: u8,
+ timer: f32,
+ flash_color: Color,
+}
+
+#[derive(Component)]
+struct CommitRing {
+ center: Vec2,
+ lifetime: f32,
+ max_lifetime: f32,
+ color: Color,
+ max_radius: f32,
+}
+
+#[derive(Component)]
+struct AmbientParticle {
+ velocity: Vec2,
+ drift_phase: f32,
+ drift_speed: f32,
+ base_alpha: f32,
+}
+
+#[derive(Component)]
+struct EnergyOrbit {
+ replica_id: u8,
+ orbit_index: usize,
+ angle: f32,
+ radius: f32,
+ speed: f32,
+}
+
+#[derive(Resource)]
+struct ScreenFlash {
+ timer: f32,
+ color: Color,
+ intensity: f32,
+}
+
+impl Default for ScreenFlash {
+ fn default() -> Self {
+ Self {
+ timer: 0.0,
+ color: NEON_CYAN,
+ intensity: 0.0,
+ }
+ }
+}
+
+#[derive(Component)]
+struct ScreenFlashOverlay;
+
+#[derive(Component)]
+struct EventLogPanel;
+
+#[derive(Component)]
+struct EventLogContent;
+
+#[derive(Component)]
+struct EventLogToggleHint;
+
+#[derive(Component)]
+struct SpeedLine {
+ lifetime: f32,
+ max_lifetime: f32,
+ color: Color,
+}
+
+#[derive(Component)]
+struct TrackRing;
+
+#[derive(Resource)]
+struct TrackPulse {
+ energy: f32,
+}
+
+impl Default for TrackPulse {
+ fn default() -> Self {
+ Self { energy: 0.0 }
+ }
+}
+
+// -- Shape builder helpers --------------------------------------------------
+
+fn circle_shape(radius: f32) -> shapes::Circle {
+ shapes::Circle {
+ radius,
+ center: Vec2::ZERO,
+ }
+}
+
+fn rectangle_shape(width: f32, height: f32) -> shapes::Rectangle {
+ shapes::Rectangle {
+ extents: Vec2::new(width, height),
+ origin: shapes::RectangleOrigin::Center,
+ radii: None,
+ }
+}
+
+fn iggy_sprite_rect() -> Rect {
+ Rect::new(140.0, 0.0, 920.0, 652.0)
+}
+
+fn app_icon_path(kind: AppKind) -> ShapePath {
+ let mut path = ShapePath::new();
+
+ match kind {
+ AppKind::Producer => {
+ path = path
+ .move_to(Vec2::new(-24.0, 18.0))
+ .line_to(Vec2::new(18.0, 18.0))
+ .line_to(Vec2::new(18.0, -14.0))
+ .line_to(Vec2::new(-24.0, -14.0))
+ .close()
+ .move_to(Vec2::new(-18.0, 10.0))
+ .line_to(Vec2::new(8.0, 10.0))
+ .move_to(Vec2::new(-18.0, 3.0))
+ .line_to(Vec2::new(2.0, 3.0))
+ .move_to(Vec2::new(-18.0, -4.0))
+ .line_to(Vec2::new(6.0, -4.0))
+ .move_to(Vec2::new(24.0, 6.0))
+ .line_to(Vec2::new(34.0, 6.0))
+ .move_to(Vec2::new(24.0, 0.0))
+ .line_to(Vec2::new(34.0, 0.0))
+ .move_to(Vec2::new(24.0, -6.0))
+ .line_to(Vec2::new(34.0, -6.0));
+ }
+ AppKind::Consumer => {
+ path = path
+ .move_to(Vec2::new(-18.0, 18.0))
+ .line_to(Vec2::new(24.0, 18.0))
+ .line_to(Vec2::new(24.0, -14.0))
+ .line_to(Vec2::new(-18.0, -14.0))
+ .close()
+ .move_to(Vec2::new(-12.0, 8.0))
+ .line_to(Vec2::new(12.0, 8.0))
+ .move_to(Vec2::new(-12.0, 0.0))
+ .line_to(Vec2::new(12.0, 0.0))
+ .move_to(Vec2::new(-12.0, -8.0))
+ .line_to(Vec2::new(12.0, -8.0))
+ .move_to(Vec2::new(-28.0, 6.0))
+ .line_to(Vec2::new(-38.0, 6.0))
+ .move_to(Vec2::new(-28.0, 0.0))
+ .line_to(Vec2::new(-38.0, 0.0))
+ .move_to(Vec2::new(-28.0, -6.0))
+ .line_to(Vec2::new(-38.0, -6.0));
+ }
+ }
+
+ path
+}
+
+fn app_link_path(from: Vec2, to: Vec2, inbound: bool) -> ShapePath {
+ let dir = to - from;
+ let normal = Vec2::new(-dir.y, dir.x).normalize_or_zero();
+ let bend = if inbound { 70.0 } else { -70.0 };
+ let unit = dir.normalize_or_zero();
+ let start = from + unit * 42.0;
+ let end = to - unit * 96.0;
+ let control = (start + end) * 0.5 + normal * bend;
+
+ ShapePath::new()
+ .move_to(start)
+ .quadratic_bezier_to(control, end)
+}
+
+fn replica_link_path(from: Vec2, to: Vec2, bend: f32) -> ShapePath {
+ let dir = to - from;
+ let unit = dir.normalize_or_zero();
+ let normal = Vec2::new(-dir.y, dir.x).normalize_or_zero();
+ let start = from + unit * 92.0;
+ let end = to - unit * 92.0;
+ let control = (start + end) * 0.5 + normal * bend;
+
+ ShapePath::new()
+ .move_to(start)
+ .quadratic_bezier_to(control, end)
+}
+
+fn build_fill(geom: &impl Geometry<tess::path::path::Builder>, fill_color: Color) -> Shape {
+ ShapeBuilder::with(geom)
+ .fill(Fill::color(fill_color))
+ .build()
+}
+
+fn build_stroke(
+ geom: &impl Geometry<tess::path::path::Builder>,
+ stroke_color: Color,
+ stroke_width: f32,
+) -> Shape {
+ ShapeBuilder::with(geom)
+ .stroke(Stroke::new(stroke_color, stroke_width))
+ .build()
+}
+
+fn build_fill_stroke(
+ geom: &impl Geometry<tess::path::path::Builder>,
+ fill_color: Color,
+ stroke_color: Color,
+ stroke_width: f32,
+) -> Shape {
+ ShapeBuilder::with(geom)
+ .fill(Fill::color(fill_color))
+ .stroke(Stroke::new(stroke_color, stroke_width))
+ .build()
+}
+
+fn build_path_stroke(path: &ShapePath, stroke_color: Color, stroke_width: f32) -> Shape {
+ ShapeBuilder::with(path)
+ .stroke(Stroke::new(stroke_color, stroke_width))
+ .build()
+}
+
+// -- Helpers ----------------------------------------------------------------
+
+fn bezier_pos(from: Vec2, to: Vec2, control: Vec2, t: f32) -> Vec2 {
+ let inv = 1.0 - t;
+ inv * inv * from + 2.0 * inv * t * control + t * t * to
+}
+
+fn perpendicular_control(from: Vec2, to: Vec2, offset: f32) -> Vec2 {
+ let mid = (from + to) * 0.5;
+ let dir = to - from;
+ let perp = Vec2::new(-dir.y, dir.x).normalize_or_zero();
+ mid + perp * offset
+}
+
+fn status_color(status: vsr::Status, alive: bool) -> Color {
+ if !alive {
+ return NEON_MAGENTA;
+ }
+ match status {
+ vsr::Status::Normal => NEON_CYAN,
+ vsr::Status::ViewChange => NEON_YELLOW,
+ vsr::Status::Recovering => NEON_MAGENTA,
+ }
+}
+
+fn role_label(role: vsr::Role, status: vsr::Status) -> &'static str {
+ match (role, status) {
+ (vsr::Role::Primary, vsr::Status::Normal) => "LEAD DOG / running",
+ (vsr::Role::Primary, vsr::Status::ViewChange) => "LEAD DOG / howling",
+ (vsr::Role::Primary, vsr::Status::Recovering) => "LEAD DOG / limping",
+ (vsr::Role::Backup, vsr::Status::Normal) => "PACK DOG / running",
+ (vsr::Role::Backup, vsr::Status::ViewChange) => "PACK DOG / howling",
+ (vsr::Role::Backup, vsr::Status::Recovering) => "PACK DOG / limping",
+ }
+}
+
+fn trigger_replica_callout(
+ replica_fx: &mut ReplicaFxState,
+ id: u8,
+ label: &str,
+ color: Color,
+ duration: f32,
+) {
+ let idx = id as usize;
+ replica_fx.callout_timer[idx] = duration;
+ replica_fx.callout_text[idx] = label.to_string();
+ replica_fx.callout_color[idx] = color;
+}
+
+// -- Entry point ------------------------------------------------------------
+
+fn main() {
+ App::new()
- .add_plugins(DefaultPlugins
- .set(WindowPlugin {
- primary_window: Some(Window {
- title: "VSR Simulator".to_string(),
- resolution: (1400, 900).into(),
- canvas: Some("#bevy-canvas".to_string()),
++ .add_plugins(
++ DefaultPlugins
++ .set(WindowPlugin {
++ primary_window: Some(Window {
++ title: "VSR Simulator".to_string(),
++ resolution: (1400, 900).into(),
++ canvas: Some("#bevy-canvas".to_string()),
++ ..default()
++ }),
++ ..default()
++ })
++ .set(AssetPlugin {
++ file_path: "../../assets".to_string(),
+ ..default()
+ }),
- ..default()
- })
- .set(AssetPlugin {
- file_path: "../../assets".to_string(),
- ..default()
- })
+ )
+ .add_plugins(ShapePlugin)
+ .insert_resource(ClearColor(BG_DARK))
+ .insert_resource(SimState::default())
+ .insert_resource(ReplicaPositions::default())
+ .insert_resource(ReplicaFxState::default())
+ .insert_resource(AppFxState::default())
+ .insert_resource(ScreenFlash::default())
+ .insert_resource(TrackPulse::default())
+ .insert_resource(EventLog::default())
+ .add_systems(Startup, setup_camera)
+ .add_systems(Startup, (setup_world, setup_hud).after(setup_camera))
+ .add_systems(
+ Update,
+ (
+ keyboard_input_system,
+ simulation_tick_system,
+ update_replica_visuals,
+ update_app_visuals,
+ update_app_flow_particles,
+ update_message_particles,
+ update_trail_dots,
+ update_link_lines,
+ update_hud_text,
+ update_pause_overlay,
+ update_scan_lines,
+ update_commit_rings,
+ update_ambient_particles,
+ update_energy_orbits,
+ update_screen_flash,
+ update_speed_lines,
+ update_track_ring,
+ update_event_log_panel,
+ ),
+ )
+ .run();
+}
+
+// -- Startup: camera --------------------------------------------------------
+
+fn setup_camera(mut commands: Commands) {
+ commands.spawn(Camera2d);
+}
+
+// -- Startup: world grid + track ring + greyhounds + links ------------------
+
+fn setup_world(
+ mut commands: Commands,
+ positions: Res<ReplicaPositions>,
+ asset_server: Res<AssetServer>,
+) {
+ let mascot_handle: Handle<Image> = asset_server.load("iggy.png");
+
+ // Diagonal grid (tactical arena feel)
+ for offset in [-420.0, -280.0, -140.0, 0.0, 140.0, 280.0, 420.0] {
+ let rising = shapes::Line(
+ Vec2::new(-700.0, -520.0 + offset),
+ Vec2::new(700.0, 880.0 + offset),
+ );
+ commands.spawn((
+ build_stroke(&rising, GRID_LINE.with_alpha(0.22), 0.75),
+ Transform::from_xyz(0.0, -90.0, -0.19),
+ ));
+ let falling = shapes::Line(
+ Vec2::new(-700.0, 880.0 - offset),
+ Vec2::new(700.0, -520.0 - offset),
+ );
+ commands.spawn((
+ build_stroke(&falling, GRID_LINE.with_alpha(0.16), 0.75),
+ Transform::from_xyz(0.0, -90.0, -0.19),
+ ));
+ }
+
+ // Framing diamonds
+ for (size, alpha, z) in [(640.0, 0.10, -0.14), (760.0, 0.04, -0.13)] {
+ commands.spawn((
- build_stroke(&rectangle_shape(size, size), GRID_LINE.with_alpha(alpha), 1.0),
++ build_stroke(
++ &rectangle_shape(size, size),
++ GRID_LINE.with_alpha(alpha),
++ 1.0,
++ ),
+ Transform {
+ translation: Vec3::new(0.0, WORLD_CENTER_Y, z),
+ rotation: Quat::from_rotation_z(PI / 4.0),
+ ..default()
+ },
+ ));
+ }
+
+ // Scan lines (faint horizontal, scrolling down)
+ for i in 0..SCAN_LINE_COUNT {
+ let y = -500.0 + (i as f32) * (1000.0 / SCAN_LINE_COUNT as f32);
+ let line = shapes::Line(Vec2::new(-700.0, 0.0), Vec2::new(700.0, 0.0));
+ commands.spawn((
- ScanLine { speed: 30.0 + (i as f32) * 15.0 },
++ ScanLine {
++ speed: 30.0 + (i as f32) * 15.0,
++ },
+ build_stroke(&line, NEON_CYAN.with_alpha(0.03), 1.0),
+ Transform::from_xyz(0.0, y, -0.05),
+ ));
+ }
+
+ // Track ring
+ commands.spawn((
+ TrackRing,
- build_stroke(&circle_shape(CIRCLE_RADIUS), GRID_LINE.with_alpha(0.35), 0.9),
++ build_stroke(
++ &circle_shape(CIRCLE_RADIUS),
++ GRID_LINE.with_alpha(0.35),
++ 0.9,
++ ),
+ Transform::from_xyz(0.0, WORLD_CENTER_Y, 0.0),
+ ));
+ commands.spawn((
- build_stroke(&circle_shape(CIRCLE_RADIUS - 18.0), GRID_LINE.with_alpha(0.12), 0.5),
++ build_stroke(
++ &circle_shape(CIRCLE_RADIUS - 18.0),
++ GRID_LINE.with_alpha(0.12),
++ 0.5,
++ ),
+ Transform::from_xyz(0.0, WORLD_CENTER_Y, -0.01),
+ ));
+ commands.spawn((
- build_stroke(&circle_shape(CIRCLE_RADIUS + 18.0), GRID_LINE.with_alpha(0.12), 0.5),
++ build_stroke(
++ &circle_shape(CIRCLE_RADIUS + 18.0),
++ GRID_LINE.with_alpha(0.12),
++ 0.5,
++ ),
+ Transform::from_xyz(0.0, WORLD_CENTER_Y, -0.01),
+ ));
+
+ // Ambient floating particles
+ for i in 0..AMBIENT_PARTICLE_COUNT {
+ let phase = i as f32 / AMBIENT_PARTICLE_COUNT as f32;
+ let x = (phase * 17.3 + 0.5).fract() * 1600.0 - 800.0;
+ let y = (phase * 23.7 + 0.2).fract() * 1100.0 - 550.0;
+ let size = 0.8 + (phase * 7.1).fract() * 1.8;
+ let alpha = 0.04 + (phase * 13.3).fract() * 0.10;
+ let color = match i % 5 {
+ 0 => NEON_CYAN,
+ 1 => IGGY_ORANGE,
+ _ => COOL_WHITE,
+ };
+
+ commands.spawn((
+ AmbientParticle {
+ velocity: Vec2::new(
+ ((phase * 31.1).fract() - 0.5) * 12.0,
+ 8.0 + (phase * 11.7).fract() * 18.0,
+ ),
+ drift_phase: phase * PI * 2.0,
+ drift_speed: 0.4 + (phase * 5.3).fract() * 0.8,
+ base_alpha: alpha,
+ },
+ build_fill(&circle_shape(size), color.with_alpha(alpha)),
+ Transform::from_xyz(x, y, -0.08),
+ ));
+ }
+
+ // Energy orbit dots around each replica
+ for i in 0..REPLICA_COUNT {
+ let pos = positions.0[i as usize];
+ for j in 0..ORBIT_DOTS_PER_REPLICA {
+ let angle = (j as f32 / ORBIT_DOTS_PER_REPLICA as f32) * PI * 2.0;
+ let radius = 96.0 + (j as f32) * 3.0;
+ let speed = 1.2 + (j as f32) * 0.3;
+
+ commands.spawn((
+ EnergyOrbit {
+ replica_id: i,
+ orbit_index: j,
+ angle,
+ radius,
+ speed,
+ },
+ build_fill(&circle_shape(2.2), NEON_CYAN.with_alpha(0.0)),
+ Transform::from_xyz(pos.x, pos.y, 0.9),
+ ));
+ }
+ }
+
+ // Screen flash overlay (full-screen quad, initially transparent)
+ commands.spawn((
+ ScreenFlashOverlay,
+ Sprite::from_color(NEON_CYAN.with_alpha(0.0), Vec2::new(1600.0, 1100.0)),
+ Transform::from_xyz(0.0, 0.0, 90.0),
+ ));
+
+ // Spawn branded iggy replicas
+ for i in 0..REPLICA_COUNT {
+ let pos = positions.0[i as usize];
+ let is_primary = i == 0;
+ let sc = if is_primary { IGGY_ORANGE } else { NEON_CYAN };
+ let facing_right = pos.x < 0.0;
+
+ commands.spawn((
+ ReplicaShadow { id: i },
+ Sprite::from_color(BG_DARK.with_alpha(0.45), Vec2::new(118.0, 24.0)),
+ Transform::from_xyz(pos.x, pos.y - 84.0, 0.35),
+ ));
+
+ commands.spawn((
+ ReplicaGlow { id: i },
+ build_fill(&circle_shape(74.0), sc.with_alpha(0.12)),
+ Transform::from_xyz(pos.x, pos.y - 6.0, 0.5),
+ ));
+
+ commands.spawn((
+ ReplicaNeonOutline { id: i },
+ build_stroke(&circle_shape(82.0), sc.with_alpha(0.35), 2.0),
+ Transform::from_xyz(pos.x, pos.y - 2.0, 0.8),
+ ));
+
+ commands.spawn((
+ ReplicaBody { id: i },
+ Sprite {
+ image: mascot_handle.clone(),
+ rect: Some(iggy_sprite_rect()),
+ custom_size: Some(IGGY_SPRITE_SIZE),
+ flip_x: !facing_right,
+ ..default()
+ },
+ Transform::from_xyz(pos.x, pos.y + 8.0, 1.6),
+ ));
+
+ for (layer, glyph, size) in [(0u8, "z", 34.0), (1u8, "z", 28.0), (2u8, "z", 22.0)] {
+ commands.spawn((
+ ReplicaSleepText { id: i, layer },
+ Text2d::new(glyph),
+ TextFont {
+ font_size: size,
+ ..default()
+ },
+ TextColor(COOL_WHITE.with_alpha(0.9)),
+ Transform::from_xyz(pos.x + 60.0, pos.y + 88.0, 1.8),
+ Visibility::Hidden,
+ ));
+ }
+
+ // ID text below mascot (z=3)
+ commands.spawn((
+ ReplicaIdText { id: i },
+ Text2d::new(format!("R{i}")),
+ TextFont {
+ font_size: 28.0,
+ ..default()
+ },
+ TextColor(COOL_WHITE),
+ Transform::from_xyz(pos.x, pos.y - 112.0, 3.0),
+ ));
+
+ // Role + status info text below ID (z=3)
+ let label = if is_primary {
+ "LEAD DOG / running"
+ } else {
+ "PACK DOG / running"
+ };
+ let role_color = if is_primary { IGGY_ORANGE } else { DIM_GRAY };
+ commands.spawn((
+ ReplicaRoleText { id: i },
+ Text2d::new(label),
+ TextFont {
+ font_size: 11.0,
+ ..default()
+ },
+ TextColor(role_color),
+ Transform::from_xyz(pos.x, pos.y - 130.0, 3.0),
+ ));
+
+ commands.spawn((
+ ReplicaCalloutText { id: i },
+ Text2d::new(""),
+ TextFont {
+ font_size: 17.0,
+ ..default()
+ },
+ TextColor(COOL_WHITE.with_alpha(0.0)),
+ Transform::from_xyz(pos.x, pos.y + 118.0, 3.2),
+ Visibility::Hidden,
+ ));
+ }
+
+ // Link lines between every pair
+ for i in 0..REPLICA_COUNT {
+ for j in (i + 1)..REPLICA_COUNT {
+ let a = positions.0[i as usize];
+ let b = positions.0[j as usize];
+ let bend = if (i + j) % 2 == 0 { 56.0 } else { -56.0 };
+ let lane = replica_link_path(a, b, bend);
+
+ commands.spawn((
+ LinkLine {
+ from_id: i,
+ to_id: j,
+ },
+ build_path_stroke(&lane, GRID_LINE.with_alpha(0.65), 1.4),
+ Transform::from_xyz(0.0, 0.0, 0.05),
+ ));
+ }
+ }
+
+ let apps = [
+ (
+ 0usize,
+ "BALL THROWER",
+ AppKind::Producer,
+ Vec2::new(-560.0, 330.0),
+ 0u8,
+ IGGY_ORANGE,
+ true,
+ ),
+ (
+ 1usize,
+ "BALL FETCHER",
+ AppKind::Consumer,
+ Vec2::new(560.0, 330.0),
+ 1u8,
+ NEON_CYAN,
+ false,
+ ),
+ (
+ 2usize,
+ "TREAT DISPENSER",
+ AppKind::Producer,
+ Vec2::new(-560.0, 70.0),
+ 2u8,
+ NEON_YELLOW,
+ true,
+ ),
+ (
+ 3usize,
+ "TREAT GOBBLER",
+ AppKind::Consumer,
+ Vec2::new(560.0, 70.0),
+ 0u8,
+ COOL_WHITE,
+ false,
+ ),
+ ];
+
+ for (id, title, kind, anchor, target_replica, accent, inbound) in apps {
+ let target = positions.0[target_replica as usize];
+ let lane = app_link_path(anchor, target, inbound);
+ commands.spawn((
+ AppLink {
+ id,
+ anchor,
+ target_replica,
+ accent,
+ inbound,
+ },
+ build_path_stroke(&lane, accent.with_alpha(0.18), 1.5),
+ Transform::from_xyz(0.0, 0.0, 0.03),
+ ));
+
+ commands.spawn((
+ AppCard { id, anchor, accent },
+ build_fill(&circle_shape(50.0), accent.with_alpha(0.10)),
+ Transform::from_xyz(anchor.x, anchor.y, 1.2),
+ ));
+
+ commands.spawn((
+ AppIcon {
+ id,
+ anchor,
+ accent,
+ kind,
+ },
+ build_path_stroke(&app_icon_path(kind), accent.with_alpha(0.95), 2.4),
+ Transform::from_xyz(anchor.x, anchor.y + 4.0, 1.35),
+ ));
+
+ commands.spawn((
+ AppCardLabel { id, anchor },
+ Text2d::new(title),
+ TextFont {
+ font_size: 13.0,
+ ..default()
+ },
+ TextColor(COOL_WHITE),
+ Transform::from_xyz(anchor.x, anchor.y - 64.0, 1.3),
+ ));
+ }
+}
+
+// -- Startup: HUD overlay ---------------------------------------------------
+
+fn setup_hud(mut commands: Commands, asset_server: Res<AssetServer>) {
- let sygnet_handle: Handle<Image> = asset_server.load("logo/4x/iggy-apache-sygnet-color-darkbg@4x.png");
- let wordmark_handle: Handle<Image> = asset_server.load("logo/4x/iggy-apache-logo-wo-sygnet-light@4x.png");
++ let sygnet_handle: Handle<Image> =
++ asset_server.load("logo/4x/iggy-apache-sygnet-color-darkbg@4x.png");
++ let wordmark_handle: Handle<Image> =
++ asset_server.load("logo/4x/iggy-apache-logo-wo-sygnet-light@4x.png");
+
+ commands
+ .spawn(Node {
+ width: Val::Percent(100.0),
+ height: Val::Percent(100.0),
+ ..default()
+ })
+ .with_children(|root| {
+ // ==================== TOP BAR ====================
+ root.spawn((
+ Node {
+ position_type: PositionType::Absolute,
+ left: Val::Px(0.0),
+ right: Val::Px(0.0),
+ top: Val::Px(0.0),
+ height: Val::Px(56.0),
+ padding: UiRect::axes(Val::Px(20.0), Val::Px(8.0)),
+ justify_content: JustifyContent::SpaceBetween,
+ align_items: AlignItems::Center,
+ ..default()
+ },
+ BackgroundColor(Color::srgba_u8(0x07, 0x0c, 0x17, 0xe8)),
+ ))
+ .with_children(|bar| {
+ // Left: title + stats row
+ bar.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ align_items: AlignItems::Center,
+ column_gap: Val::Px(24.0),
+ ..default()
+ })
+ .with_children(|left| {
+ left.spawn((
+ Text::new("iggy::pack"),
- TextFont { font_size: 16.0, ..default() },
++ TextFont {
++ font_size: 16.0,
++ ..default()
++ },
+ TextColor(IGGY_ORANGE),
+ ));
+ // Treats
+ left.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ align_items: AlignItems::Baseline,
+ column_gap: Val::Px(6.0),
+ ..default()
+ })
+ .with_children(|stat| {
+ stat.spawn((
+ Text::new("TREATS"),
- TextFont { font_size: 9.0, ..default() },
++ TextFont {
++ font_size: 9.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
+ ));
+ stat.spawn((
+ HudCommitsText,
+ Text::new("0"),
- TextFont { font_size: 20.0, ..default() },
++ TextFont {
++ font_size: 20.0,
++ ..default()
++ },
+ TextColor(NEON_CYAN),
+ ));
+ });
+ // Laps/sec
+ left.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ align_items: AlignItems::Baseline,
+ column_gap: Val::Px(6.0),
+ ..default()
+ })
+ .with_children(|stat| {
+ stat.spawn((
+ Text::new("LAPS/S"),
- TextFont { font_size: 9.0, ..default() },
++ TextFont {
++ font_size: 9.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
+ ));
+ stat.spawn((
+ HudOpsText,
+ Text::new("0"),
- TextFont { font_size: 20.0, ..default() },
++ TextFont {
++ font_size: 20.0,
++ ..default()
++ },
+ TextColor(IGGY_ORANGE),
+ ));
+ });
+ });
+
+ // Center: sygnet + wordmark
+ bar.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ align_items: AlignItems::Center,
+ column_gap: Val::Px(6.0),
+ ..default()
+ })
+ .with_children(|logo| {
+ logo.spawn((
+ ImageNode::new(sygnet_handle),
+ Node {
+ width: Val::Px(38.0),
+ height: Val::Px(29.0),
+ ..default()
+ },
+ ));
+ logo.spawn((
+ ImageNode::new(wordmark_handle),
+ Node {
+ width: Val::Px(78.0),
+ height: Val::Px(25.0),
+ ..default()
+ },
+ ));
+ });
+
+ // Right: state + tick
+ bar.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ align_items: AlignItems::Center,
+ column_gap: Val::Px(16.0),
+ ..default()
+ })
+ .with_children(|right| {
+ right.spawn((
+ HudTickText,
+ Text::new("T 0"),
- TextFont { font_size: 18.0, ..default() },
++ TextFont {
++ font_size: 18.0,
++ ..default()
++ },
+ TextColor(COOL_WHITE),
+ ));
- right.spawn(Node {
- flex_direction: FlexDirection::Column,
- align_items: AlignItems::End,
- ..default()
- })
- .with_children(|col| {
- col.spawn((
- HudStateText,
- Text::new("RACING"),
- TextFont { font_size: 13.0, ..default() },
- TextColor(NEON_CYAN),
- ));
- col.spawn((
- HudSpeedText,
- Text::new("x1.0"),
- TextFont { font_size: 10.0, ..default() },
- TextColor(DIM_GRAY),
- ));
- });
++ right
++ .spawn(Node {
++ flex_direction: FlexDirection::Column,
++ align_items: AlignItems::End,
++ ..default()
++ })
++ .with_children(|col| {
++ col.spawn((
++ HudStateText,
++ Text::new("RACING"),
++ TextFont {
++ font_size: 13.0,
++ ..default()
++ },
++ TextColor(NEON_CYAN),
++ ));
++ col.spawn((
++ HudSpeedText,
++ Text::new("x1.0"),
++ TextFont {
++ font_size: 10.0,
++ ..default()
++ },
++ TextColor(DIM_GRAY),
++ ));
++ });
+ });
+ });
+
+ // ==================== BOTTOM BAR ====================
+ root.spawn((
+ Node {
+ position_type: PositionType::Absolute,
+ left: Val::Px(0.0),
+ right: Val::Px(0.0),
+ bottom: Val::Px(0.0),
+ padding: UiRect::axes(Val::Px(20.0), Val::Px(10.0)),
+ justify_content: JustifyContent::SpaceBetween,
+ align_items: AlignItems::Center,
+ border: UiRect::top(Val::Px(1.0)),
+ ..default()
+ },
+ BackgroundColor(Color::srgba_u8(0x07, 0x0c, 0x17, 0xe8)),
+ BorderColor::all(HUD_EDGE),
+ ))
+ .with_children(|bar| {
+ // Left: title + subtitle
+ bar.spawn(Node {
+ flex_direction: FlexDirection::Column,
+ row_gap: Val::Px(2.0),
+ ..default()
+ })
+ .with_children(|col| {
+ col.spawn((
+ Text::new("APACHE IGGY SIMULATOR"),
- TextFont { font_size: 14.0, ..default() },
++ TextFont {
++ font_size: 14.0,
++ ..default()
++ },
+ TextColor(COOL_WHITE),
+ ));
+ col.spawn((
+ Text::new("Italian greyhounds racing to consensus"),
- TextFont { font_size: 10.0, ..default() },
++ TextFont {
++ font_size: 10.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
+ ));
+ });
+
+ // Center: keybinds
+ bar.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ column_gap: Val::Px(8.0),
+ ..default()
+ })
+ .with_children(|keys| {
+ for (key, action, color) in [
+ ("SPACE", "race/rest", NEON_CYAN),
+ ("R", "throw ball", IGGY_ORANGE),
+ ("K", "trip dog", HUD_ALERT),
+ ("H", "heal pack", NEON_CYAN),
+ ("E", "event log", NEON_YELLOW),
+ ("UP/DN", "speed", DIM_GRAY),
+ ] {
+ keys.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ align_items: AlignItems::Center,
+ column_gap: Val::Px(4.0),
+ ..default()
+ })
+ .with_children(|pair| {
+ pair.spawn((
+ Node {
+ padding: UiRect::axes(Val::Px(5.0), Val::Px(2.0)),
+ border: UiRect::all(Val::Px(1.0)),
+ ..default()
+ },
+ BackgroundColor(BG_PANEL),
+ BorderColor::all(color.with_alpha(0.4)),
+ ))
+ .with_children(|badge| {
+ badge.spawn((
+ Text::new(key),
- TextFont { font_size: 10.0, ..default() },
++ TextFont {
++ font_size: 10.0,
++ ..default()
++ },
+ TextColor(color),
+ ));
+ });
+ pair.spawn((
+ Text::new(action),
- TextFont { font_size: 9.0, ..default() },
++ TextFont {
++ font_size: 9.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
+ ));
+ });
+ }
+ });
+
+ // Right: chips
+ bar.spawn(Node {
+ flex_direction: FlexDirection::Row,
+ column_gap: Val::Px(8.0),
+ ..default()
+ })
+ .with_children(|chips| {
- for (label, color) in [
- ("3 GREYHOUNDS", IGGY_ORANGE),
- ("FAULT READY", HUD_ALERT),
- ] {
- chips.spawn((
- Node {
- padding: UiRect::axes(Val::Px(8.0), Val::Px(4.0)),
- border: UiRect::all(Val::Px(1.0)),
- ..default()
- },
- BackgroundColor(BG_PANEL.with_alpha(0.9)),
- BorderColor::all(color.with_alpha(0.4)),
- ))
- .with_children(|chip| {
- chip.spawn((
- Text::new(label),
- TextFont { font_size: 10.0, ..default() },
- TextColor(color),
- ));
- });
++ for (label, color) in
++ [("3 GREYHOUNDS", IGGY_ORANGE), ("FAULT READY", HUD_ALERT)]
++ {
++ chips
++ .spawn((
++ Node {
++ padding: UiRect::axes(Val::Px(8.0), Val::Px(4.0)),
++ border: UiRect::all(Val::Px(1.0)),
++ ..default()
++ },
++ BackgroundColor(BG_PANEL.with_alpha(0.9)),
++ BorderColor::all(color.with_alpha(0.4)),
++ ))
++ .with_children(|chip| {
++ chip.spawn((
++ Text::new(label),
++ TextFont {
++ font_size: 10.0,
++ ..default()
++ },
++ TextColor(color),
++ ));
++ });
+ }
+ });
+ });
+
+ // ==================== PAUSED OVERLAY ====================
+ root.spawn((
+ PauseOverlay,
+ Node {
+ position_type: PositionType::Absolute,
+ width: Val::Percent(100.0),
+ height: Val::Percent(100.0),
+ justify_content: JustifyContent::Center,
+ align_items: AlignItems::Center,
+ flex_direction: FlexDirection::Column,
+ row_gap: Val::Px(8.0),
+ ..default()
+ },
+ Visibility::Hidden,
+ ))
+ .with_children(|col| {
+ col.spawn((
+ PauseMainText,
+ Text::new("RESTING"),
- TextFont { font_size: 52.0, ..default() },
++ TextFont {
++ font_size: 52.0,
++ ..default()
++ },
+ TextColor(NEON_YELLOW),
+ ));
+ col.spawn((
+ PauseSubtext,
+ Text::new("press SPACE to unleash"),
- TextFont { font_size: 16.0, ..default() },
++ TextFont {
++ font_size: 16.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
+ ));
+ });
+
+ // ==================== EVENT LOG PANEL ====================
+ // Sits between top bar (56px) and bottom bar (~48px)
+ root.spawn((
+ EventLogPanel,
+ Node {
+ position_type: PositionType::Absolute,
+ right: Val::Px(0.0),
+ top: Val::Px(58.0),
+ bottom: Val::Px(50.0),
+ width: Val::Px(360.0),
+ flex_direction: FlexDirection::Column,
+ padding: UiRect::all(Val::Px(12.0)),
+ border: UiRect::left(Val::Px(2.0)),
+ overflow: Overflow::clip_y(),
+ ..default()
+ },
+ BackgroundColor(Color::srgba_u8(0x07, 0x0c, 0x17, 0xf2)),
+ BorderColor::all(IGGY_ORANGE.with_alpha(0.3)),
+ Visibility::Hidden,
+ ))
+ .with_children(|panel| {
+ panel.spawn((
+ Text::new("PACK ACTIVITY LOG"),
- TextFont { font_size: 13.0, ..default() },
++ TextFont {
++ font_size: 13.0,
++ ..default()
++ },
+ TextColor(IGGY_ORANGE),
- Node { margin: UiRect::bottom(Val::Px(4.0)), ..default() },
++ Node {
++ margin: UiRect::bottom(Val::Px(4.0)),
++ ..default()
++ },
+ ));
+ panel.spawn((
+ Text::new("[D] toggle details [E] close"),
- TextFont { font_size: 9.0, ..default() },
++ TextFont {
++ font_size: 9.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
- Node { margin: UiRect::bottom(Val::Px(8.0)), ..default() },
++ Node {
++ margin: UiRect::bottom(Val::Px(8.0)),
++ ..default()
++ },
+ ));
+ panel.spawn((
+ Node {
+ width: Val::Percent(100.0),
+ height: Val::Px(1.0),
+ margin: UiRect::bottom(Val::Px(6.0)),
+ ..default()
+ },
+ BackgroundColor(IGGY_ORANGE.with_alpha(0.25)),
+ ));
+ panel.spawn((
+ EventLogContent,
+ Node {
+ flex_direction: FlexDirection::ColumnReverse,
+ flex_grow: 1.0,
+ overflow: Overflow::clip_y(),
+ row_gap: Val::Px(2.0),
+ ..default()
+ },
+ ));
+ });
+
+ // Event log toggle hint (hidden when log is open)
+ root.spawn((
+ EventLogToggleHint,
+ Node {
+ position_type: PositionType::Absolute,
+ right: Val::Px(16.0),
+ bottom: Val::Px(54.0),
+ ..default()
+ },
+ ))
+ .with_children(|hint| {
+ hint.spawn((
+ Text::new("[E] event log"),
- TextFont { font_size: 10.0, ..default() },
++ TextFont {
++ font_size: 10.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
+ ));
+ });
+ });
+}
+
+// -- Update: keyboard input -------------------------------------------------
+
- fn keyboard_input_system(keys: Res<ButtonInput<KeyCode>>, mut sim: ResMut<SimState>, mut event_log: ResMut<EventLog>) {
++fn keyboard_input_system(
++ keys: Res<ButtonInput<KeyCode>>,
++ mut sim: ResMut<SimState>,
++ mut event_log: ResMut<EventLog>,
++) {
+ if keys.just_pressed(KeyCode::Space) {
+ sim.playing = !sim.playing;
+ }
+
+ if keys.just_pressed(KeyCode::ArrowRight) && !sim.playing {
+ sim.simulator.step();
+ }
+
+ if keys.just_pressed(KeyCode::ArrowUp) {
+ sim.speed = (sim.speed * 1.5).min(16.0);
+ }
+ if keys.just_pressed(KeyCode::ArrowDown) {
+ sim.speed = (sim.speed / 1.5).max(0.1);
+ }
+
+ if keys.just_pressed(KeyCode::KeyR) {
+ sim.simulator.inject_client_request();
+ }
+
+ if keys.just_pressed(KeyCode::KeyK) {
+ let states = sim.simulator.replica_states();
+ for s in &states {
+ if s.alive {
+ sim.simulator.kill_replica(s.id);
+ break;
+ }
+ }
+ }
+
+ if keys.just_pressed(KeyCode::KeyH) {
+ for i in 0..REPLICA_COUNT {
+ sim.simulator.restart_replica(i);
+ }
+ for i in 0..REPLICA_COUNT {
+ for j in (i + 1)..REPLICA_COUNT {
+ sim.simulator.heal_link(i, j);
+ }
+ }
+ }
+
+ if keys.just_pressed(KeyCode::KeyE) {
+ event_log.visible = !event_log.visible;
+ }
+ if keys.just_pressed(KeyCode::KeyD) {
+ event_log.show_details = !event_log.show_details;
+ }
+}
+
+// -- Update: simulation tick -- spawn message particles + glow flashes ------
+
+#[allow(clippy::too_many_arguments)]
+fn simulation_tick_system(
+ mut commands: Commands,
+ time: Res<Time>,
+ mut sim: ResMut<SimState>,
+ positions: Res<ReplicaPositions>,
+ mut replica_fx: ResMut<ReplicaFxState>,
+ mut app_fx: ResMut<AppFxState>,
+ mut screen_flash: ResMut<ScreenFlash>,
+ mut track_pulse: ResMut<TrackPulse>,
+ mut event_log: ResMut<EventLog>,
+) {
+ let elapsed = time.elapsed_secs_f64();
+ if elapsed - sim.ops_window_start >= 1.0 {
+ sim.ops_per_second = sim.ops_window_count as f64 / (elapsed - sim.ops_window_start);
+ sim.ops_window_start = elapsed;
+ sim.ops_window_count = 0;
+ }
+
+ if !sim.playing {
+ return;
+ }
+
+ let dt = time.delta_secs();
+ sim.tick_accumulator += dt * sim.speed * 60.0;
+
+ let ticks_to_run = sim.tick_accumulator as u32;
+ sim.tick_accumulator -= ticks_to_run as f32;
+
+ for _ in 0..ticks_to_run.min(10) {
+ let events = sim.simulator.step();
+
+ for event in &events {
+ if let Some(entry) = narrate_event(event) {
+ event_log.push(entry);
+ }
+ match event {
+ vsr::SimEvent::MessageSent { message, .. } => {
+ if message.msg_type == vsr::MessageType::ClientReply {
+ app_fx.pulse[1] = 0.7;
+ }
+
+ let from_idx = message.from as usize;
+ let to_idx = message.to as usize;
+
+ if from_idx >= REPLICA_COUNT as usize || to_idx >= REPLICA_COUNT as usize {
+ continue;
+ }
+
+ let from_pos = positions.0[from_idx];
+ let to_pos = positions.0[to_idx];
+ let control = perpendicular_control(from_pos, to_pos, 40.0);
+ let msg_color = message.msg_type.color();
+
+ // Inner particle: neon-colored filled circle
+ let shape = build_fill_stroke(
+ &circle_shape(4.0),
+ msg_color,
+ msg_color.with_alpha(0.3),
+ 1.0,
+ );
+ commands.spawn((
+ MessageParticle {
+ from: from_pos,
+ to: to_pos,
+ control,
+ progress: 0.0,
+ duration: MSG_DURATION,
+ msg_type: message.msg_type,
+ },
+ shape,
+ Transform::from_xyz(from_pos.x, from_pos.y, 5.0),
+ ));
+
+ // Outer glow circle: larger, faint
+ let glow_shape = build_fill(&circle_shape(8.0), msg_color.with_alpha(0.2));
+ commands.spawn((
+ MessageGlow,
+ MessageParticle {
+ from: from_pos,
+ to: to_pos,
+ control,
+ progress: 0.0,
+ duration: MSG_DURATION,
+ msg_type: message.msg_type,
+ },
+ glow_shape,
+ Transform::from_xyz(from_pos.x, from_pos.y, 4.9),
+ ));
+ }
+ vsr::SimEvent::OperationCommitted { replica_id, .. } => {
+ sim.total_commits += 1;
+ sim.ops_window_count += 1;
+ replica_fx.healthy[*replica_id as usize] = 0.45;
+ trigger_replica_callout(
+ &mut replica_fx,
+ *replica_id,
+ "GOOD BOY!",
+ IGGY_ORANGE,
+ 0.9,
+ );
+ app_fx.pulse[2] = 0.55;
+ track_pulse.energy = (track_pulse.energy + 0.4).min(1.0);
+ commands.spawn(GlowFlash {
+ id: *replica_id,
+ timer: 0.3,
+ flash_color: IGGY_ORANGE,
+ });
+
+ // Commit ring explosion!
+ let center = positions.0[*replica_id as usize];
+ for ring_i in 0..3u8 {
+ let delay_factor = ring_i as f32 * 0.08;
+ commands.spawn((
+ CommitRing {
+ center,
+ lifetime: COMMIT_RING_LIFETIME + delay_factor,
+ max_lifetime: COMMIT_RING_LIFETIME + delay_factor,
- color: if ring_i == 0 {
- IGGY_ORANGE
- } else {
- NEON_CYAN
- },
++ color: if ring_i == 0 { IGGY_ORANGE } else { NEON_CYAN },
+ max_radius: 120.0 + ring_i as f32 * 40.0,
+ },
+ build_stroke(
+ &circle_shape(1.0),
+ IGGY_ORANGE.with_alpha(0.6),
+ 2.5 - ring_i as f32 * 0.5,
+ ),
+ Transform::from_xyz(center.x, center.y, 4.5 - ring_i as f32 * 0.1),
+ ));
+ }
+ }
+ vsr::SimEvent::ViewChangeStarted { replica_id, .. } => {
+ trigger_replica_callout(
+ &mut replica_fx,
+ *replica_id,
+ "PACK SHUFFLE!",
+ NEON_MAGENTA,
+ 1.15,
+ );
+ app_fx.pulse[3] = 0.8;
+ // Screen-wide magenta flash for dramatic effect
+ screen_flash.timer = SCREEN_FLASH_DURATION;
+ screen_flash.color = NEON_MAGENTA;
+ screen_flash.intensity = 0.12;
+ for rid in 0..REPLICA_COUNT {
+ commands.spawn(GlowFlash {
+ id: rid,
+ timer: 0.3,
+ flash_color: NEON_MAGENTA,
+ });
+ // Shockwave ring from the triggering replica
+ if rid == *replica_id {
+ let center = positions.0[rid as usize];
+ commands.spawn((
+ CommitRing {
+ center,
+ lifetime: 0.9,
+ max_lifetime: 0.9,
+ color: NEON_MAGENTA,
+ max_radius: 200.0,
+ },
- build_stroke(
- &circle_shape(1.0),
- NEON_MAGENTA.with_alpha(0.5),
- 3.0,
- ),
++ build_stroke(&circle_shape(1.0), NEON_MAGENTA.with_alpha(0.5), 3.0),
+ Transform::from_xyz(center.x, center.y, 4.5),
+ ));
+ }
+ }
+ }
+ vsr::SimEvent::ClientRequest { .. } => {
+ sim.ops_window_count += 1;
+ app_fx.pulse[0] = 0.7;
+ }
+ vsr::SimEvent::PrimaryElected { replica_id, .. } => {
+ trigger_replica_callout(
+ &mut replica_fx,
+ *replica_id,
+ "NEW LEAD DOG!",
+ NEON_YELLOW,
+ 1.2,
+ );
+ // Golden flash for new leader
+ screen_flash.timer = SCREEN_FLASH_DURATION * 0.7;
+ screen_flash.color = NEON_YELLOW;
+ screen_flash.intensity = 0.08;
+ // Victory ring
+ let center = positions.0[*replica_id as usize];
+ for ring_i in 0..2u8 {
+ commands.spawn((
+ CommitRing {
+ center,
+ lifetime: 0.8,
+ max_lifetime: 0.8,
+ color: NEON_YELLOW,
+ max_radius: 150.0 + ring_i as f32 * 50.0,
+ },
- build_stroke(
- &circle_shape(1.0),
- NEON_YELLOW.with_alpha(0.45),
- 2.5,
- ),
++ build_stroke(&circle_shape(1.0), NEON_YELLOW.with_alpha(0.45), 2.5),
+ Transform::from_xyz(center.x, center.y, 4.4),
+ ));
+ }
+ }
+ vsr::SimEvent::ReplicaStateChanged {
+ replica_id,
+ new_status,
+ ..
+ } => {
+ let (label, color, duration) = match new_status {
+ vsr::Status::Normal => ("RUNNING!", NEON_CYAN, 0.85),
+ vsr::Status::ViewChange => ("HOWLING!", NEON_MAGENTA, 1.1),
+ vsr::Status::Recovering => ("LIMPING...", NEON_YELLOW, 1.1),
+ };
+ trigger_replica_callout(&mut replica_fx, *replica_id, label, color, duration);
+ }
+ _ => {}
+ }
+ }
+ }
+}
+
+// -- Update: replica visuals (neon glow breathing, bobbing, status text) -----
+
+#[allow(clippy::type_complexity, clippy::too_many_arguments)]
+fn update_replica_visuals(
+ time: Res<Time>,
+ sim: Res<SimState>,
+ positions: Res<ReplicaPositions>,
+ mut replica_fx: ResMut<ReplicaFxState>,
+ mut commands: Commands,
+ mut flash_q: Query<(Entity, &mut GlowFlash)>,
+ mut visuals: ParamSet<(
+ Query<(&ReplicaShadow, &mut Sprite, &mut Transform)>,
+ Query<(&ReplicaGlow, &mut Shape, &mut Transform), Without<ReplicaNeonOutline>>,
+ Query<(&ReplicaNeonOutline, &mut Shape, &mut Transform), Without<ReplicaGlow>>,
+ Query<(&ReplicaBody, &mut Sprite, &mut Transform)>,
+ Query<(
+ &ReplicaSleepText,
+ &mut Transform,
+ &mut TextColor,
+ &mut Visibility,
+ )>,
+ Query<(&ReplicaIdText, &mut TextColor), Without<ReplicaRoleText>>,
+ Query<(&ReplicaRoleText, &mut Text2d, &mut TextColor), Without<ReplicaIdText>>,
+ Query<
+ (
+ &ReplicaCalloutText,
+ &mut Text2d,
+ &mut Transform,
+ &mut TextColor,
+ &mut Visibility,
+ ),
+ (Without<ReplicaIdText>, Without<ReplicaRoleText>),
+ >,
+ )>,
+) {
+ let states = sim.simulator.replica_states();
+ let t = time.elapsed_secs();
+ let dt = time.delta_secs();
+
+ for i in 0..REPLICA_COUNT as usize {
+ replica_fx.kill[i] = (replica_fx.kill[i] - dt * 1.4).max(0.0);
+ replica_fx.revive[i] = (replica_fx.revive[i] - dt * 1.1).max(0.0);
+ replica_fx.healthy[i] = (replica_fx.healthy[i] - dt * 0.9).max(0.0);
+ replica_fx.callout_timer[i] = (replica_fx.callout_timer[i] - dt).max(0.0);
+ }
+
+ // Process glow flash timers
+ let mut flash_overrides: [Option<Color>; REPLICA_COUNT as usize] =
+ [None; REPLICA_COUNT as usize];
+ for (entity, mut flash) in flash_q.iter_mut() {
+ flash.timer -= dt;
+ if flash.timer <= 0.0 {
+ commands.entity(entity).despawn();
+ } else {
+ let idx = flash.id as usize;
+ if idx < REPLICA_COUNT as usize {
+ flash_overrides[idx] = Some(flash.flash_color);
+ }
+ }
+ }
+
+ for state in &states {
+ let id = state.id;
+ let idx = id as usize;
+ let sc = status_color(state.status, state.alive);
+ let base_pos = positions.0[idx];
+ let is_primary = state.role == vsr::Role::Primary;
+ let facing_right = base_pos.x < 0.0;
+
+ if replica_fx.last_alive[idx] != state.alive {
+ if state.alive {
+ replica_fx.revive[idx] = 1.0;
+ replica_fx.healthy[idx] = 0.6;
+ trigger_replica_callout(&mut replica_fx, id, "BACK ON TRACK!", IGGY_ORANGE, 1.3);
+ } else {
+ replica_fx.kill[idx] = 1.0;
+ trigger_replica_callout(&mut replica_fx, id, "GREYHOUND DOWN", NEON_MAGENTA, 1.4);
+ }
+ replica_fx.last_alive[idx] = state.alive;
+ }
+ if replica_fx.last_status[idx] != state.status {
+ if state.status == vsr::Status::Normal {
+ replica_fx.healthy[idx] = 0.5;
+ trigger_replica_callout(&mut replica_fx, id, "RUNNING!", NEON_CYAN, 0.8);
+ } else if state.status == vsr::Status::Recovering {
+ replica_fx.revive[idx] = 0.8;
+ trigger_replica_callout(&mut replica_fx, id, "LIMPING...", NEON_YELLOW, 1.1);
+ } else if state.status == vsr::Status::ViewChange {
+ trigger_replica_callout(&mut replica_fx, id, "HOWLING!", NEON_MAGENTA, 1.1);
+ }
+ replica_fx.last_status[idx] = state.status;
+ }
+
+ let dir: f32 = if facing_right { 1.0 } else { -1.0 };
+
+ // Game-like idle motion - greyhound vibes
+ let busy = state.pipeline_depth as f32 / 8.0; // 0..1 how loaded
+ let hover = (t * (1.3 + busy * 0.8) + id as f32 * 1.7).sin() * (7.0 + busy * 4.0);
+ let sway = (t * (0.9 + busy * 1.2) + id as f32 * 0.8).sin() * (0.06 + busy * 0.04);
- let breathe = 1.0 + (t * (1.8 + busy * 1.5) + id as f32 * 0.9).sin() * (0.035 + busy * 0.025);
++ let breathe =
++ 1.0 + (t * (1.8 + busy * 1.5) + id as f32 * 0.9).sin() * (0.035 + busy * 0.025);
+ // Running lean: greyhound tilts forward when busy
+ let run_lean = busy * 0.08 * dir;
+ // Stretch horizontally when running (greyhound elongation)
+ let run_stretch_x = 1.0 + busy * 0.06;
+ let run_squash_y = 1.0 - busy * 0.03;
+
+ // Determine effective glow color (flash overrides normal)
+ let glow_color = flash_overrides[idx].unwrap_or(sc);
+ let flash_energy = if flash_overrides[idx].is_some() {
+ 1.0
+ } else {
+ 0.0
+ };
+ let glow_alpha =
+ 0.12 + ((t * 2.0 + id as f32 * 1.5).sin() * 0.5 + 0.5) * 0.08 + flash_energy * 0.18;
+ let body_alpha = if state.alive { 1.0 } else { 0.24 };
+ let impact_scale = 1.0 + flash_energy * 0.08;
+ let kill_energy = replica_fx.kill[idx];
+ let revive_energy = replica_fx.revive[idx];
+ let healthy_energy = replica_fx.healthy[idx];
+ let fx_lift = revive_energy * 18.0 - kill_energy * 12.0;
+ for (shadow, mut sprite, mut transform) in visuals.p0().iter_mut() {
+ if shadow.id == id {
+ sprite.color = BG_DARK.with_alpha(0.22 + glow_alpha * 0.45 + kill_energy * 0.12);
+ transform.translation.x = base_pos.x;
+ transform.translation.y = base_pos.y - 88.0 + hover * 0.15 - fx_lift * 0.2;
+ transform.scale = Vec3::new(
+ 1.0 + flash_energy * 0.12 + kill_energy * 0.18,
+ 0.9 - hover * 0.003 - revive_energy * 0.08,
+ 1.0,
+ );
+ }
+ }
+
+ // Outer glow (z=0.5)
+ for (glow, mut shape, mut transform) in visuals.p1().iter_mut() {
+ if glow.id == id {
+ let pulse_color = if kill_energy > 0.0 {
+ NEON_MAGENTA
+ } else if revive_energy > 0.0 || healthy_energy > 0.0 {
+ IGGY_ORANGE
+ } else {
+ glow_color
+ };
+ shape.fill = Some(Fill::color(pulse_color.with_alpha(
+ (glow_alpha + revive_energy * 0.18 + healthy_energy * 0.12) * body_alpha,
+ )));
+ transform.translation.x = base_pos.x;
+ transform.translation.y = base_pos.y - 10.0 + hover * 0.45 + fx_lift * 0.35;
+ transform.scale = Vec3::splat(
+ 1.0 + ((t * 1.4 + id as f32).sin() * 0.03)
+ + flash_energy * 0.14
+ + revive_energy * 0.12
+ + healthy_energy * 0.08,
+ );
+ }
+ }
+
+ // Neon outline (z=0.8)
+ for (outline, mut shape, mut transform) in visuals.p2().iter_mut() {
+ if outline.id == id {
+ shape.stroke = Some(Stroke::new(
+ (if kill_energy > 0.0 {
+ NEON_MAGENTA
+ } else if revive_energy > 0.0 {
+ IGGY_ORANGE
+ } else {
+ glow_color
+ })
+ .with_alpha((0.30 + flash_energy * 0.25 + healthy_energy * 0.18) * body_alpha),
+ 2.0 + flash_energy + revive_energy * 1.2,
+ ));
+ transform.translation.x = base_pos.x;
+ transform.translation.y = base_pos.y - 4.0 + hover * 0.35 + fx_lift * 0.25;
+ transform.rotation = Quat::from_rotation_z(-sway * 0.45 + kill_energy * 0.08);
+ }
+ }
+
+ // Mascot body sprite
+ for (body, mut shape, mut transform) in visuals.p3().iter_mut() {
+ if body.id == id {
+ shape.color = if !state.alive {
+ Color::srgba(0.55, 0.52, 0.60, 0.33)
+ } else if revive_energy > 0.0 {
+ Color::srgba(1.0, 0.96, 0.9, body_alpha)
+ } else if is_primary {
+ Color::srgba(1.0, 0.97, 0.94, body_alpha)
+ } else {
+ Color::srgba(0.94, 0.98, 1.0, body_alpha)
+ };
+ shape.flip_x = !facing_right;
+ transform.translation.x = base_pos.x;
+ transform.translation.y = base_pos.y + 12.0 + hover + fx_lift - kill_energy * 14.0;
+ transform.rotation = Quat::from_rotation_z(
+ sway + run_lean + flash_energy * 0.04 * dir - kill_energy * 0.24 * dir,
+ );
+ transform.scale = Vec3::new(
- dir * breathe * impact_scale * run_stretch_x
++ dir * breathe
++ * impact_scale
++ * run_stretch_x
+ * (1.0 + revive_energy * 0.1 - kill_energy * 0.16),
- (breathe / impact_scale) * run_squash_y
++ (breathe / impact_scale)
++ * run_squash_y
+ * (1.0 - kill_energy * 0.34 + healthy_energy * 0.08),
+ 1.0,
+ );
+ }
+ }
+
+ for (sleep, mut transform, mut color, mut visibility) in visuals.p4().iter_mut() {
+ if sleep.id == id {
+ *visibility = if state.alive {
+ Visibility::Hidden
+ } else {
+ Visibility::Inherited
+ };
+ let phase = (t * 0.85 + sleep.layer as f32 * 0.55 + id as f32 * 0.4).fract();
+ let rise = phase * 34.0;
+ let drift = (phase * PI * 2.0).sin() * 7.0;
+ transform.translation.x =
+ base_pos.x + (70.0 + sleep.layer as f32 * 12.0) * dir + drift * dir;
+ transform.translation.y = base_pos.y + 68.0 + rise + sleep.layer as f32 * 8.0;
+ transform.scale = Vec3::splat(0.7 + phase * 0.55);
+ *color =
+ TextColor(COOL_WHITE.with_alpha((1.0 - phase) * 0.8 * kill_energy.max(0.65)));
+ }
+ }
+
+ // ID text color: magenta if dead
+ for (id_txt, mut color) in visuals.p5().iter_mut() {
+ if id_txt.id == id {
+ *color = TextColor(if state.alive {
+ COOL_WHITE
+ } else {
+ NEON_MAGENTA
+ });
+ }
+ }
+
+ // Role text
+ for (role_txt, mut text, mut color) in visuals.p6().iter_mut() {
+ if role_txt.id == id {
+ let label = if !state.alive {
+ "NAPPING"
+ } else {
+ role_label(state.role, state.status)
+ };
+ **text = label.to_string();
+ let status_pulse = ((t * 4.2 + id as f32 * 0.7).sin() * 0.5) + 0.5;
+ *color = TextColor(if !state.alive {
+ NEON_MAGENTA.with_alpha(0.88 + status_pulse * 0.12)
+ } else if state.status == vsr::Status::ViewChange {
+ NEON_MAGENTA.with_alpha(0.84 + status_pulse * 0.16)
+ } else if state.status == vsr::Status::Recovering {
+ NEON_YELLOW.with_alpha(0.84 + status_pulse * 0.16)
+ } else if is_primary {
+ IGGY_ORANGE
+ } else {
+ DIM_GRAY
+ });
+ }
+ }
+
+ for (callout, mut text, mut transform, mut color, mut visibility) in visuals.p7().iter_mut()
+ {
+ if callout.id != id {
+ continue;
+ }
+
+ let timer = replica_fx.callout_timer[idx];
+ let persistent = if !state.alive {
+ Some(("NAPPING", NEON_MAGENTA))
+ } else {
+ match state.status {
+ vsr::Status::Normal => None,
+ vsr::Status::ViewChange => Some(("HOWLING!", NEON_MAGENTA)),
+ vsr::Status::Recovering => Some(("LIMPING...", NEON_YELLOW)),
+ }
+ };
+
+ if timer <= 0.0 && persistent.is_none() {
+ *visibility = Visibility::Hidden;
+ continue;
+ }
+
+ *visibility = Visibility::Inherited;
+ let (label, base_color, energy) = if let Some((label, color_hint)) = persistent {
+ (label, color_hint, 0.78)
+ } else {
+ (
+ replica_fx.callout_text[idx].as_str(),
+ replica_fx.callout_color[idx],
+ timer.clamp(0.0, 1.0),
+ )
+ };
+ let pulse = ((t * 6.0 + id as f32 * 1.3).sin() * 0.5) + 0.5;
+ let rise = (1.0 - energy) * 18.0;
+ **text = label.to_string();
+ transform.translation = Vec3::new(base_pos.x, base_pos.y + 118.0 + rise, 3.2);
+ transform.scale = Vec3::splat(0.92 + energy * 0.22 + pulse * 0.04);
+ *color =
+ TextColor(base_color.with_alpha((0.55 + energy * 0.35 + pulse * 0.1).min(1.0)));
+ }
+ }
+}
+
+// -- Update: move message particles along bezier, spawn trail dots ----------
+
+fn update_message_particles(
+ mut commands: Commands,
+ time: Res<Time>,
+ mut sim: ResMut<SimState>,
+ mut query: Query<(Entity, &mut MessageParticle, &mut Transform)>,
+) {
+ let dt = time.delta_secs();
+ sim.frame_count = sim.frame_count.wrapping_add(1);
+ let spawn_trail = sim.frame_count.is_multiple_of(3);
+
+ for (entity, mut particle, mut transform) in query.iter_mut() {
+ particle.progress += dt / particle.duration;
+
+ if particle.progress >= 1.0 {
+ commands.entity(entity).despawn();
+ continue;
+ }
+
+ let pos = bezier_pos(
+ particle.from,
+ particle.to,
+ particle.control,
+ particle.progress,
+ );
+ transform.translation.x = pos.x;
+ transform.translation.y = pos.y;
+
+ // Spawn trail dot (tiny fading circle)
+ if spawn_trail {
+ let trail_color = particle.msg_type.color();
+ spawn_trail_dot(&mut commands, pos, trail_color);
+
+ // Speed lines perpendicular to travel direction
+ if particle.progress > 0.1 && particle.progress < 0.9 {
+ let dir = (particle.to - particle.from).normalize_or_zero();
+ let perp = Vec2::new(-dir.y, dir.x);
+ let offset = perp * ((sim.frame_count as f32 * 0.7).sin() * 6.0);
+ let line_len = 8.0 + particle.progress * 12.0;
+ let line = shapes::Line(
+ pos + offset - dir * line_len * 0.5,
+ pos + offset + dir * line_len * 0.5,
+ );
+ commands.spawn((
+ SpeedLine {
+ lifetime: SPEED_LINE_LIFETIME,
+ max_lifetime: SPEED_LINE_LIFETIME,
+ color: trail_color,
+ },
+ build_stroke(&line, trail_color.with_alpha(0.25), 0.8),
+ Transform::from_xyz(0.0, 0.0, 4.2),
+ ));
+ }
+ }
+ }
+}
+
+/// Spawn a tiny trail dot at `pos`.
+fn spawn_trail_dot(commands: &mut Commands, pos: Vec2, color: Color) {
+ let alpha = 0.35;
+ let c = color.with_alpha(alpha);
+
+ commands.spawn((
+ TrailDot {
+ lifetime: TRAIL_LIFETIME,
+ max_lifetime: TRAIL_LIFETIME,
+ color,
+ },
+ build_fill(&circle_shape(1.5), c),
+ Transform::from_xyz(pos.x, pos.y, 4.0),
+ ));
+}
+
+// -- Update: fade and despawn trail dots ------------------------------------
+
+fn update_trail_dots(
+ mut commands: Commands,
+ time: Res<Time>,
+ mut query: Query<(Entity, &mut TrailDot, &mut Shape)>,
+) {
+ let dt = time.delta_secs();
+
+ for (entity, mut dot, mut shape) in query.iter_mut() {
+ dot.lifetime -= dt;
+ if dot.lifetime <= 0.0 {
+ commands.entity(entity).despawn();
+ continue;
+ }
+ let alpha = (dot.lifetime / dot.max_lifetime) * 0.35;
+ shape.fill = Some(Fill::color(dot.color.with_alpha(alpha)));
+ }
+}
+
+// -- Update: link lines -----------------------------------------------------
+
+fn update_link_lines(
+ time: Res<Time>,
+ sim: Res<SimState>,
+ mut query: Query<(&LinkLine, &mut Shape)>,
+) {
+ let t = time.elapsed_secs();
+ for (link, mut shape) in query.iter_mut() {
+ let is_partitioned = sim
+ .simulator
+ .network
+ .is_partitioned(link.from_id, link.to_id);
+ let from_alive = sim
+ .simulator
+ .replicas
+ .get(link.from_id as usize)
+ .is_some_and(|r| r.alive);
+ let to_alive = sim
+ .simulator
+ .replicas
+ .get(link.to_id as usize)
+ .is_some_and(|r| r.alive);
+ let pulse = ((t * 1.7 + (link.from_id + link.to_id) as f32 * 0.9).sin() * 0.5) + 0.5;
+
+ if is_partitioned || !from_alive || !to_alive {
+ shape.stroke = Some(Stroke::new(
+ NEON_MAGENTA.with_alpha(0.28 + pulse * 0.22),
+ 1.8 + pulse * 0.5,
+ ));
+ } else {
+ shape.stroke = Some(Stroke::new(
+ NEON_CYAN.with_alpha(0.12 + pulse * 0.14),
+ 1.3 + pulse * 0.35,
+ ));
+ }
+ }
+}
+
+#[allow(clippy::type_complexity)]
+fn update_app_visuals(
+ time: Res<Time>,
+ positions: Res<ReplicaPositions>,
+ sim: Res<SimState>,
+ mut app_fx: ResMut<AppFxState>,
+ mut visuals: ParamSet<(
+ Query<(&AppCard, &mut Shape, &mut Transform)>,
+ Query<(&AppLink, &mut Shape)>,
+ Query<(&AppCardLabel, &mut Transform, &mut TextColor)>,
+ Query<(&AppIcon, &mut Shape, &mut Transform)>,
+ )>,
+) {
+ let dt = time.delta_secs();
+ let t = time.elapsed_secs();
+
+ for pulse in &mut app_fx.pulse {
+ *pulse = (*pulse - dt * 1.15).max(0.0);
+ }
+
+ for (card, mut shape, mut transform) in visuals.p0().iter_mut() {
+ let pulse = app_fx.pulse[card.id];
+ let hover = (t * 1.05 + card.id as f32 * 0.9).sin() * 5.0;
+ shape.fill = Some(Fill::color(card.accent.with_alpha(0.08 + pulse * 0.12)));
+ shape.stroke = Some(Stroke::new(
+ card.accent.with_alpha(0.18 + pulse * 0.45),
+ 1.0 + pulse * 1.5,
+ ));
+ transform.translation = Vec3::new(card.anchor.x, card.anchor.y + hover + pulse * 10.0, 1.2);
+ transform.rotation = Quat::from_rotation_z((t * 0.35 + card.id as f32).sin() * 0.015);
+ transform.scale = Vec3::splat(1.0 + pulse * 0.06);
+ }
+
+ for (label, mut transform, mut color) in visuals.p2().iter_mut() {
+ let pulse = app_fx.pulse[label.id];
+ let hover = (t * 1.05 + label.id as f32 * 0.9).sin() * 5.0;
+ transform.translation = Vec3::new(
+ label.anchor.x,
+ label.anchor.y - 64.0 + hover + pulse * 10.0,
+ 1.3,
+ );
+ *color = TextColor(COOL_WHITE.with_alpha(0.9 + pulse * 0.1));
+ }
+
+ for (icon, mut shape, mut transform) in visuals.p3().iter_mut() {
+ let pulse = app_fx.pulse[icon.id];
+ let hover = (t * 1.05 + icon.id as f32 * 0.9).sin() * 5.0;
+ let tilt = match icon.kind {
+ AppKind::Producer => -0.03,
+ AppKind::Consumer => 0.03,
+ };
+ shape.stroke = Some(Stroke::new(
+ icon.accent.with_alpha(0.8 + pulse * 0.2),
+ 2.4 + pulse * 0.8,
+ ));
+ transform.translation = Vec3::new(
+ icon.anchor.x,
+ icon.anchor.y + 4.0 + hover + pulse * 9.0,
+ 1.35,
+ );
+ transform.rotation = Quat::from_rotation_z(tilt + (t * 0.7 + icon.id as f32).sin() * 0.025);
+ transform.scale = Vec3::splat(1.0 + pulse * 0.08);
+ }
+
+ for (link, mut shape) in visuals.p1().iter_mut() {
+ let pulse = app_fx.pulse[link.id];
+ let target = positions.0[link.target_replica as usize];
+ let target_alive = sim
+ .simulator
+ .replicas
+ .get(link.target_replica as usize)
+ .is_some_and(|r| r.alive);
+ let distance_bias = ((target.y - WORLD_CENTER_Y).abs() / 400.0).min(0.2);
+ shape.stroke = Some(Stroke::new(
+ if target_alive {
+ link.accent.with_alpha(0.10 + pulse * 0.26 + distance_bias)
+ } else {
+ NEON_MAGENTA.with_alpha(0.05 + pulse * 0.08)
+ },
+ if target_alive {
+ 0.9 + pulse * 0.8
+ } else {
+ 0.45 + pulse * 0.2
+ },
+ ));
+ }
+}
+
+fn update_app_flow_particles(
+ mut commands: Commands,
+ time: Res<Time>,
+ positions: Res<ReplicaPositions>,
+ sim: Res<SimState>,
+ links: Query<&AppLink>,
+ mut particles: Query<(Entity, &mut AppFlowParticle, &mut Transform, &mut Shape)>,
+) {
+ let dt = time.delta_secs();
+
+ if sim.frame_count.is_multiple_of(36) {
+ for link in links.iter() {
+ let target_alive = sim
+ .simulator
+ .replicas
+ .get(link.target_replica as usize)
+ .is_some_and(|r| r.alive);
+ if !target_alive {
+ continue;
+ }
+
+ let target = positions.0[link.target_replica as usize];
+ let (from, to) = if link.inbound {
+ (link.anchor, target)
+ } else {
+ (target, link.anchor)
+ };
+ let dir = to - from;
+ let normal = Vec2::new(-dir.y, dir.x).normalize_or_zero();
+ let control = (from + to) * 0.5 + normal * if link.inbound { 70.0 } else { -70.0 };
+
+ commands.spawn((
+ AppFlowParticle {
+ replica_id: link.target_replica,
+ from,
+ to,
+ control,
+ progress: 0.0,
+ speed: 0.26 + link.id as f32 * 0.025,
+ color: link.accent,
+ },
+ build_fill(&circle_shape(3.2), link.accent.with_alpha(0.85)),
+ Transform::from_xyz(from.x, from.y, 1.1),
+ ));
+ }
+ }
+
+ for (entity, mut particle, mut transform, mut shape) in particles.iter_mut() {
+ let target_alive = sim
+ .simulator
+ .replicas
+ .get(particle.replica_id as usize)
+ .is_some_and(|r| r.alive);
+ if !target_alive {
+ commands.entity(entity).despawn();
+ continue;
+ }
+
+ particle.progress += dt * particle.speed;
+ if particle.progress >= 1.0 {
+ commands.entity(entity).despawn();
+ continue;
+ }
+
+ let pos = bezier_pos(
+ particle.from,
+ particle.to,
+ particle.control,
+ particle.progress,
+ );
+ transform.translation.x = pos.x;
+ transform.translation.y = pos.y;
+ let alpha = (1.0 - (particle.progress - 0.5).abs() * 1.4).clamp(0.18, 0.92);
+ shape.fill = Some(Fill::color(particle.color.with_alpha(alpha)));
+ }
+}
+
+// -- Update: HUD text -------------------------------------------------------
+
+#[allow(clippy::type_complexity)]
+fn update_hud_text(
+ sim: Res<SimState>,
+ mut hud: ParamSet<(
+ Query<&mut Text, With<HudTickText>>,
+ Query<&mut Text, (With<HudOpsText>, Without<HudTickText>)>,
+ Query<
+ &mut Text,
+ (
+ With<HudCommitsText>,
+ Without<HudTickText>,
+ Without<HudOpsText>,
+ ),
+ >,
+ Query<
+ (&mut Text, &mut TextColor),
+ (
+ With<HudStateText>,
+ Without<HudTickText>,
+ Without<HudOpsText>,
+ Without<HudCommitsText>,
+ ),
+ >,
+ Query<
+ &mut Text,
+ (
+ With<HudSpeedText>,
+ Without<HudTickText>,
+ Without<HudOpsText>,
+ Without<HudCommitsText>,
+ Without<HudStateText>,
+ ),
+ >,
+ )>,
+) {
+ for mut text in hud.p0().iter_mut() {
+ **text = format!("T {}", sim.simulator.tick);
+ }
+
+ for mut text in hud.p1().iter_mut() {
+ **text = format!("{:.0}", sim.ops_per_second);
+ }
+
+ for mut text in hud.p2().iter_mut() {
+ **text = format!("{}", sim.total_commits);
+ }
+
+ for (mut text, mut color) in hud.p3().iter_mut() {
+ if sim.playing {
+ **text = "RACING".to_string();
+ *color = TextColor(NEON_CYAN);
+ } else {
+ **text = "RESTING".to_string();
+ *color = TextColor(NEON_YELLOW);
+ }
+ }
+
+ for mut text in hud.p4().iter_mut() {
+ **text = format!("x{:.1}", sim.speed);
+ }
+}
+
+// -- Update: pause overlay with pulsing alpha -------------------------------
+
+#[allow(clippy::type_complexity)]
+fn update_pause_overlay(
+ sim: Res<SimState>,
+ time: Res<Time>,
+ mut pause: ParamSet<(
+ Query<&mut Visibility, (With<PauseOverlay>, Without<PauseMainText>)>,
+ Query<
+ &mut TextColor,
+ (
+ With<PauseMainText>,
+ Without<PauseOverlay>,
+ Without<PauseSubtext>,
+ ),
+ >,
+ Query<&mut Visibility, (With<PauseSubtext>, Without<PauseOverlay>)>,
+ )>,
+) {
+ let target_vis = if sim.playing {
+ Visibility::Hidden
+ } else {
+ Visibility::Inherited
+ };
+
+ for mut vis in pause.p0().iter_mut() {
+ *vis = target_vis;
+ }
+
+ if !sim.playing {
+ let pulse = ((time.elapsed_secs() * 3.0).sin() * 0.5 + 0.5) * 0.6 + 0.4;
+ for mut color in pause.p1().iter_mut() {
+ *color = TextColor(NEON_YELLOW.with_alpha(pulse));
+ }
+ }
+
+ for mut vis in pause.p2().iter_mut() {
+ *vis = target_vis;
+ }
+}
+
+// -- Update: scan lines scroll down -----------------------------------------
+
+fn update_scan_lines(time: Res<Time>, mut query: Query<(&ScanLine, &mut Transform)>) {
+ let dt = time.delta_secs();
+
+ for (scan, mut transform) in query.iter_mut() {
+ transform.translation.y -= scan.speed * dt;
+ if transform.translation.y < -500.0 {
+ transform.translation.y = 500.0;
+ }
+ }
+}
+
+// -- Update: expanding commit rings -----------------------------------------
+
+fn update_commit_rings(
+ mut commands: Commands,
+ time: Res<Time>,
+ mut query: Query<(Entity, &mut CommitRing, &mut Shape, &mut Transform)>,
+) {
+ let dt = time.delta_secs();
+
+ for (entity, mut ring, mut shape, mut transform) in query.iter_mut() {
+ ring.lifetime -= dt;
+ if ring.lifetime <= 0.0 {
+ commands.entity(entity).despawn();
+ continue;
+ }
+
+ let progress = 1.0 - (ring.lifetime / ring.max_lifetime);
+ let eased = 1.0 - (1.0 - progress).powi(3); // ease-out cubic
+ let current_radius = ring.max_radius * eased;
+ let alpha = (1.0 - progress) * 0.6;
+ let width = (1.0 - progress) * 3.0 + 0.5;
+
+ shape.stroke = Some(Stroke::new(ring.color.with_alpha(alpha), width));
+ transform.translation.x = ring.center.x;
+ transform.translation.y = ring.center.y;
+ transform.scale = Vec3::splat(current_radius.max(1.0));
+ }
+}
+
+// -- Update: ambient floating particles -------------------------------------
+
+fn update_ambient_particles(
+ time: Res<Time>,
+ sim: Res<SimState>,
+ mut query: Query<(&mut AmbientParticle, &mut Transform, &mut Shape)>,
+) {
+ let dt = time.delta_secs();
+ let t = time.elapsed_secs();
+ let activity_boost = if sim.playing { 1.0 } else { 0.3 };
+
+ for (particle, mut transform, mut shape) in query.iter_mut() {
+ // Gentle upward drift with sinusoidal wandering
+ let drift_x = (t * particle.drift_speed + particle.drift_phase).sin() * 18.0;
+ transform.translation.x += (particle.velocity.x + drift_x * 0.3) * dt * activity_boost;
+ transform.translation.y += particle.velocity.y * dt * activity_boost;
+
+ // Wrap around screen edges
+ if transform.translation.y > 600.0 {
+ transform.translation.y = -600.0;
+ }
+ if transform.translation.x > 900.0 {
+ transform.translation.x = -900.0;
+ } else if transform.translation.x < -900.0 {
+ transform.translation.x = 900.0;
+ }
+
+ // Twinkle effect
+ let twinkle = ((t * 2.5 + particle.drift_phase * 3.7).sin() * 0.5 + 0.5) * 0.7 + 0.3;
+ let alpha = particle.base_alpha * twinkle * activity_boost;
+ if let Some(ref mut fill) = shape.fill {
+ *fill = Fill::color(COOL_WHITE.with_alpha(alpha));
+ }
+ }
+}
+
+// -- Update: energy orbit dots around active replicas -----------------------
+
+fn update_energy_orbits(
+ time: Res<Time>,
+ sim: Res<SimState>,
+ positions: Res<ReplicaPositions>,
+ mut query: Query<(&mut EnergyOrbit, &mut Transform, &mut Shape)>,
+) {
+ let dt = time.delta_secs();
+ let states = sim.simulator.replica_states();
+
+ for (mut orbit, mut transform, mut shape) in query.iter_mut() {
+ let state = states.iter().find(|s| s.id == orbit.replica_id);
+ let (alive, is_primary, status) = state
+ .map(|s| (s.alive, s.role == vsr::Role::Primary, s.status))
+ .unwrap_or((false, false, vsr::Status::Normal));
+
+ // Only orbit active replicas
+ if !alive {
+ shape.fill = Some(Fill::color(NEON_MAGENTA.with_alpha(0.0)));
+ continue;
+ }
+
+ let speed_mult = if is_primary { 1.4 } else { 1.0 };
+ orbit.angle += dt * orbit.speed * speed_mult;
+
+ let center = positions.0[orbit.replica_id as usize];
+ let x = center.x + orbit.angle.cos() * orbit.radius;
+ let y = center.y + orbit.angle.sin() * orbit.radius;
+ transform.translation.x = x;
+ transform.translation.y = y;
+
+ let color = match status {
+ vsr::Status::Normal => {
+ if is_primary {
+ IGGY_ORANGE
+ } else {
+ NEON_CYAN
+ }
+ }
+ vsr::Status::ViewChange => NEON_MAGENTA,
+ vsr::Status::Recovering => NEON_YELLOW,
+ };
+
+ // Pulsing alpha based on orbit position
+ let pulse =
+ ((orbit.angle * 2.0 + orbit.orbit_index as f32 * 1.2).sin() * 0.5 + 0.5) * 0.4 + 0.2;
+ shape.fill = Some(Fill::color(color.with_alpha(pulse)));
+ }
+}
+
+// -- Update: screen flash overlay -------------------------------------------
+
+fn update_screen_flash(
+ time: Res<Time>,
+ mut flash: ResMut<ScreenFlash>,
+ mut query: Query<&mut Sprite, With<ScreenFlashOverlay>>,
+) {
+ let dt = time.delta_secs();
+
+ if flash.timer > 0.0 {
+ flash.timer -= dt;
+ let progress = (flash.timer / SCREEN_FLASH_DURATION).max(0.0);
+ let alpha = progress * flash.intensity;
+
+ for mut sprite in query.iter_mut() {
+ sprite.color = flash.color.with_alpha(alpha);
+ }
+ } else {
+ for mut sprite in query.iter_mut() {
+ sprite.color = NEON_CYAN.with_alpha(0.0);
+ }
+ }
+}
+
+// -- Update: speed lines fade out ------------------------------------------
+
+fn update_speed_lines(
+ mut commands: Commands,
+ time: Res<Time>,
+ mut query: Query<(Entity, &mut SpeedLine, &mut Shape)>,
+) {
+ let dt = time.delta_secs();
+
+ for (entity, mut line, mut shape) in query.iter_mut() {
+ line.lifetime -= dt;
+ if line.lifetime <= 0.0 {
+ commands.entity(entity).despawn();
+ continue;
+ }
+ let alpha = (line.lifetime / line.max_lifetime) * 0.25;
+ shape.stroke = Some(Stroke::new(line.color.with_alpha(alpha), 0.6));
+ }
+}
+
+// -- Update: track ring pulses with activity --------------------------------
+
+fn update_track_ring(
+ time: Res<Time>,
+ mut track_pulse: ResMut<TrackPulse>,
+ mut query: Query<&mut Shape, With<TrackRing>>,
+) {
+ let dt = time.delta_secs();
+ let t = time.elapsed_secs();
+
+ track_pulse.energy = (track_pulse.energy - dt * 0.6).max(0.0);
+
+ let base_alpha = 0.25 + track_pulse.energy * 0.35;
+ let breathe = (t * 0.8).sin() * 0.08;
+ let width = 0.9 + track_pulse.energy * 1.5 + breathe.abs() * 0.3;
+ let color = if track_pulse.energy > 0.2 {
+ IGGY_ORANGE
+ } else {
+ NEON_CYAN
+ };
+
+ for mut shape in query.iter_mut() {
- shape.stroke = Some(Stroke::new(
- color.with_alpha(base_alpha + breathe),
- width,
- ));
++ shape.stroke = Some(Stroke::new(color.with_alpha(base_alpha + breathe), width));
+ }
+}
+
+// -- Update: event log panel ------------------------------------------------
+
+#[allow(clippy::type_complexity)]
+fn update_event_log_panel(
+ mut commands: Commands,
+ event_log: Res<EventLog>,
+ mut panel_q: Query<&mut Visibility, (With<EventLogPanel>, Without<EventLogToggleHint>)>,
+ mut hint_q: Query<&mut Visibility, (With<EventLogToggleHint>, Without<EventLogPanel>)>,
+ content_q: Query<(Entity, Option<&Children>), With<EventLogContent>>,
+) {
+ let target_vis = if event_log.visible {
+ Visibility::Inherited
+ } else {
+ Visibility::Hidden
+ };
+ for mut vis in panel_q.iter_mut() {
+ *vis = target_vis;
+ }
+ // Hide the hint when log is open
+ for mut vis in hint_q.iter_mut() {
+ *vis = if event_log.visible {
+ Visibility::Hidden
+ } else {
+ Visibility::Inherited
+ };
+ }
+
+ if !event_log.visible {
+ return;
+ }
+
+ // Rebuild log content (show last ~40 entries)
+ for (content_entity, children) in content_q.iter() {
+ // Despawn old children
+ if let Some(children) = children {
+ for child in children.iter() {
+ commands.entity(child).despawn();
+ }
+ }
+
+ let max_visible = if event_log.show_details { 30 } else { 60 };
+ let start = event_log.entries.len().saturating_sub(max_visible);
+ let visible_entries = &event_log.entries[start..];
+
+ commands.entity(content_entity).with_children(|parent| {
+ for entry in visible_entries.iter().rev() {
+ parent
+ .spawn((
+ Node {
+ flex_direction: FlexDirection::Column,
+ padding: UiRect::axes(Val::Px(6.0), Val::Px(5.0)),
+ border: UiRect::left(Val::Px(3.0)),
+ margin: UiRect::bottom(Val::Px(3.0)),
+ ..default()
+ },
+ BackgroundColor(Color::srgba_u8(0x0c, 0x12, 0x20, 0xcc)),
+ BorderColor::all(entry.color.with_alpha(0.5)),
+ ))
+ .with_children(|card| {
+ card.spawn((
- Text::new(format!(
- "T{} {} {}",
- entry.tick, entry.icon, entry.headline
- )),
- TextFont { font_size: 12.0, ..default() },
++ Text::new(format!("T{} {} {}", entry.tick, entry.icon, entry.headline)),
++ TextFont {
++ font_size: 12.0,
++ ..default()
++ },
+ TextColor(entry.color),
+ ));
+ if event_log.show_details {
+ card.spawn((
+ Text::new(&entry.detail),
- TextFont { font_size: 10.0, ..default() },
++ TextFont {
++ font_size: 10.0,
++ ..default()
++ },
+ TextColor(DIM_GRAY),
+ Node {
+ margin: UiRect::top(Val::Px(2.0)),
+ ..default()
+ },
+ ));
+ }
+ });
+ }
+ });
+ }
+}
diff --cc core/simulator_ui/src/vsr/types.rs
index a29f09801,000000000..90d346a2c
mode 100644,000000..100644
--- a/core/simulator_ui/src/vsr/types.rs
+++ b/core/simulator_ui/src/vsr/types.rs
@@@ -1,114 -1,0 +1,114 @@@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Core types mirroring `consensus::observability` for WASM-compatible visualization.
+
+use strum_macros::{AsRefStr, Display, EnumIter};
+
+/// Replica status in the VSR protocol.
+/// Mirrors `consensus::observability::Status`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, AsRefStr, EnumIter)]
+#[strum(serialize_all = "snake_case")]
+pub enum Status {
+ Normal,
+ ViewChange,
+ Recovering,
+}
+
+/// Role of a replica in the current view.
+/// Mirrors `consensus::observability::ReplicaRole`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, AsRefStr, EnumIter)]
+#[strum(serialize_all = "snake_case")]
+pub enum Role {
+ Primary,
+ Backup,
+}
+
+/// Type of VSR protocol message.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, AsRefStr, EnumIter)]
+#[strum(serialize_all = "snake_case")]
+pub enum MessageType {
+ ClientRequest,
+ Prepare,
+ PrepareOk,
+ Commit,
+ StartViewChange,
+ DoViewChange,
+ StartView,
+ ClientReply,
+}
+
+impl MessageType {
+ /// Brand color for this message type as (r, g, b).
+ pub fn color_rgb(self) -> (u8, u8, u8) {
+ match self {
+ Self::ClientRequest => (0xff, 0xfa, 0xeb), // cream
+ Self::Prepare => (0x5f, 0x87, 0xfd), // blue
+ Self::PrepareOk => (0x14, 0xb8, 0xa6), // teal
- Self::Commit => (0xff, 0x91, 0x03), // orange
- Self::StartViewChange => (0xfa, 0x5e, 0x8a), // pink
- Self::DoViewChange => (0xa8, 0x55, 0xf7), // purple
- Self::StartView => (0x63, 0x66, 0xf1), // indigo
- Self::ClientReply => (0xff, 0xa7, 0x03), // orange
++ Self::Commit => (0xff, 0x91, 0x03), // orange
++ Self::StartViewChange => (0xfa, 0x5e, 0x8a), // pink
++ Self::DoViewChange => (0xa8, 0x55, 0xf7), // purple
++ Self::StartView => (0x63, 0x66, 0xf1), // indigo
++ Self::ClientReply => (0xff, 0xa7, 0x03), // orange
+ }
+ }
+
+ /// Bevy Color for this message type.
+ #[allow(dead_code)]
+ pub fn color(self) -> bevy::color::Color {
+ let (r, g, b) = self.color_rgb();
+ bevy::color::Color::srgb_u8(r, g, b)
+ }
+}
+
+/// A message in the VSR protocol.
+#[derive(Debug, Clone)]
+pub struct VsrMessage {
+ pub msg_type: MessageType,
+ pub from: u8,
+ pub to: u8,
+ pub view: u32,
+ pub op: u64,
+ pub commit: u64,
+ pub id: u64,
+}
+
+/// Reason for initiating a view change.
+/// Mirrors `consensus::observability::ViewChangeReason`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, AsRefStr, EnumIter)]
+#[strum(serialize_all = "snake_case")]
+pub enum ViewChangeReason {
+ HeartbeatTimeout,
+ ViewChangeTimeout,
+ ReceivedStartViewChange,
+ ReceivedDoViewChange,
+}
+
+/// Snapshot of a single replica's state for the UI.
+#[allow(dead_code)]
+#[derive(Debug, Clone)]
+pub struct ReplicaState {
+ pub id: u8,
+ pub status: Status,
+ pub role: Role,
+ pub view: u32,
+ pub log_view: u32,
+ pub commit: u64,
+ pub op: u64,
+ pub pipeline_depth: usize,
+ pub alive: bool,
+}