Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

refactor(gameplay): delete dead Script.hpp, fix stale play-realm comment

esengine22be0d0a2bc3
diff --git a/sdk/src/playRealmRuntime.ts b/sdk/src/playRealmRuntime.ts
index 86dea43fa..73b7796f3 100644
--- a/sdk/src/playRealmRuntime.ts
+++ b/sdk/src/playRealmRuntime.ts
@@ -10,8 +10,10 @@
* base64/embedded asset packing.
*
* Builtin components/systems run as-is. Project-defined components/systems
- * (a bundle loaded with esengine external + an import map) are a layered
- * follow-up — this entry only owns the runtime + snapshot + asset fetch.
+ * are already registered by the time this runs: the host imports the project
+ * bundle (esengine external + import map → the shared instance) BEFORE booting,
+ * so its defineComponent/defineSystem populate the registry this drains. This
+ * entry only owns the runtime + snapshot + asset fetch.
*/
import type { App } from './app';
import type { ESEngineModule } from './wasm';
diff --git a/src/esengine/ecs/components/Script.hpp b/src/esengine/ecs/components/Script.hpp
deleted file mode 100644
index 222639fe4..000000000
--- a/src/esengine/ecs/components/Script.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-/**
- * @file Script.hpp
- * @brief Script component for attaching JavaScript behaviors to entities
- *
- * @author ESEngine Team
- * @date 2026
- *
- * @copyright Copyright (c) 2026 ESEngine Team
- * Licensed under the PolyForm Noncommercial License 1.0.0.
- */
-
-#pragma once
-
-#include "../../core/Types.hpp"
-#include <string>
-#include <any>
-#include <unordered_map>
-
-namespace esengine::ecs {
-
-/**
- * @brief Component for attaching JavaScript scripts to entities
- *
- * @details Scripts can be loaded from files or provided as inline source code.
- * Each script should export a class with lifecycle methods:
- * - constructor(entity, registry): Initialize script instance
- * - onInit(): Called once when script is loaded
- * - onUpdate(deltaTime): Called every frame
- * - onDestroy(): Called when entity is destroyed
- */
-struct ScriptComponent {
- std::string scriptPath; ///< Path to JavaScript file (if loading from file)
- std::string scriptSource; ///< Inline JavaScript source code
- bool enabled = true; ///< Whether the script should execute
- bool isLoaded = false; ///< Whether the script has been loaded
- std::string lastError; ///< Last error message (if any)
-
- /**
- * @brief Persistent variables that survive between frames
- * @details These are stored in C++ and restored to the JavaScript context each frame
- */
- std::unordered_map<std::string, std::any> persistentVariables;
-};
-
-} // namespace esengine::ecs