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.

chore(build): retire the single-file engine target, which nothing consumed

esenginefb9e9fd377c5
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec2873e06..c81a34c3f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,6 @@ set(CMAKE_CXX_EXTENSIONS OFF)
option(ES_BUILD_WEB "Build for Web/Emscripten" OFF)
option(ES_BUILD_WXGAME "Build for WeChat MiniGame" OFF)
option(ES_BUILD_TESTS "Build tests" ON)
-option(ES_BUILD_SINGLE_FILE "Build single-file SDK (WASM inlined)" OFF)
option(ES_ENABLE_SPINE "Enable Spine animation support" ON)
option(ES_ENABLE_BOX2D "Enable Box2D physics support" OFF)
option(ES_ENABLE_TILEMAP "Enable Tilemap support" ON)
@@ -285,87 +284,6 @@ if(ES_BUILD_WEB OR ES_BUILD_WXGAME)
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdk"
)
- # Single-file SDK (WASM inlined as Base64, for playable ads)
- if(ES_BUILD_SINGLE_FILE)
- add_executable(esengine_single ${SDK_BINDING_SOURCES})
- target_link_libraries(esengine_single PRIVATE esengine)
- es_apply_single_file_settings(esengine_single)
-
- set_target_properties(esengine_single PROPERTIES
- OUTPUT_NAME "esengine.single"
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdk"
- )
-
- # Generate playable ad HTML template
- file(WRITE "${CMAKE_BINARY_DIR}/sdk/playable.html.in" [=[
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="UTF-8">
-<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
-<meta name="ad.size" content="width=320,height=480">
-<title>Playable</title>
-<style>
-*{margin:0;padding:0;box-sizing:border-box}
-html,body{width:100%;height:100%;overflow:hidden;background:#1a1a1a}
-#canvas{display:block;width:100%;height:100%;touch-action:none}
-</style>
-</head>
-<body>
-<canvas id="canvas"></canvas>
-<script>
-// ESEngine Single-File SDK will be inlined here
-// SDK_PLACEHOLDER
-</script>
-<script>
-(function(){
- function resizeCanvas(){
- var c=document.getElementById('canvas');
- var dpr=window.devicePixelRatio||1;
- c.width=window.innerWidth*dpr;
- c.height=window.innerHeight*dpr;
- }
- window.addEventListener('resize',resizeCanvas);
- resizeCanvas();
-
- ESEngineModule({
- canvas:document.getElementById('canvas'),
- print:function(t){console.log(t)},
- printErr:function(t){console.error(t)}
- }).then(function(Module){
- var Registry=new Module.Registry();
- Module.initRenderer();
-
- // Create camera
- var cam=Registry.create();
- Registry.addCamera(cam,{projectionType:1,fov:60,orthoSize:400,nearPlane:0.1,farPlane:1000,aspectRatio:1,isActive:true,priority:0});
- Registry.addLocalTransform(cam,{position:{x:0,y:0,z:10},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}});
-
- // Create sprite
- var spr=Registry.create();
- Registry.addSprite(spr,{texture:0,color:{x:1,y:0.5,z:0.2,w:1},size:{x:100,y:100},uvOffset:{x:0,y:0},uvScale:{x:1,y:1},layer:0,flipX:false,flipY:false});
- Registry.addLocalTransform(spr,{position:{x:0,y:0,z:0},rotation:{w:1,x:0,y:0,z:0},scale:{x:1,y:1,z:1}});
-
- var start=performance.now();
- function loop(){
- var t=(performance.now()-start)/1000;
- var tr=Registry.getLocalTransform(spr);
- tr.position.x=Math.sin(t)*100;
- tr.position.y=Math.cos(t)*100;
- var vp=window.innerWidth*(window.devicePixelRatio||1);
- var vh=window.innerHeight*(window.devicePixelRatio||1);
- Module.renderFrame(Registry,vp,vh);
- requestAnimationFrame(loop);
- }
- loop();
- });
-})();
-</script>
-</body>
-</html>
-]=])
- endif()
-
# Core-only SDK (no Spine, for modular builds)
if(NOT ES_ENABLE_SPINE)
set_target_properties(esengine_sdk PROPERTIES
diff --git a/build-tools/build.config.js b/build-tools/build.config.js
index 0c52e8db7..ae6b0582c 100644
--- a/build-tools/build.config.js
+++ b/build-tools/build.config.js
@@ -17,7 +17,6 @@ export default {
optimization: {
web: { cmakeOpt: '-O2', wasmOpt: '-O2' },
wechat: { cmakeOpt: '-O2', wasmOpt: '-O2' },
- playable: { cmakeOpt: '-Oz', wasmOpt: '-Oz' },
},
wasm: {
@@ -42,14 +41,6 @@ export default {
'sdk/esengine.wxgame.wasm': 'wasm/wechat/esengine.wxgame.wasm',
},
},
- playable: {
- buildDir: 'build-playable',
- cmakeFlags: ['-DES_BUILD_WEB=ON', '-DES_BUILD_TESTS=OFF', '-DES_BUILD_SINGLE_FILE=ON'],
- targets: ['esengine_single'],
- outputs: {
- 'sdk/esengine.single.js': 'wasm/playable/esengine.single.js',
- },
- },
physics: {
buildDir: 'build-physics',
cmakeFlags: ['-DES_BUILD_WEB=ON', '-DES_BUILD_TESTS=OFF', '-DES_ENABLE_BOX2D=ON', '-DES_PHYSICS_ESM=ON'],
@@ -188,7 +179,6 @@ export default {
// wasm-wechat first) — web-aligned filenames (physics.js, spine42.js, …)
// would otherwise overwrite the web modules in desktop/public/wasm.
'build/wasm/wechat': 'desktop/public/wasm-wechat',
- 'build/wasm/playable': 'desktop/public/wasm',
},
sdk: {
'build/sdk/esm': 'desktop/public/sdk/esm',
diff --git a/build-tools/cli.js b/build-tools/cli.js
index b11a63e32..7a5b9d511 100644
--- a/build-tools/cli.js
+++ b/build-tools/cli.js
@@ -28,7 +28,7 @@ program
program
.command('build')
.description('Build ESEngine')
- .option('-t, --target <target>', 'Build target (web, wechat, playable, spine, spine38, spine41, physics, physics-wechat, spine-wechat, basis, basis-wechat, sdk, all)', 'web')
+ .option('-t, --target <target>', 'Build target (web, wechat, spine, spine38, spine41, physics, physics-wechat, spine-wechat, basis, basis-wechat, sdk, all)', 'web')
.option('-d, --debug', 'Debug build', false)
.option('-r, --release', 'Release build (default)', true)
.option('-c, --clean', 'Clean before build', false)
@@ -52,7 +52,7 @@ program
const isDebug = options.debug && !options.release;
const targets = options.target === 'all'
- ? ['web', 'wechat', 'playable', 'spine', 'spine38', 'spine41', 'physics', 'physics-wechat', 'spine-wechat', 'basis', 'basis-wechat', 'videodec', 'videodec-wechat']
+ ? ['web', 'wechat', 'spine', 'spine38', 'spine41', 'physics', 'physics-wechat', 'spine-wechat', 'basis', 'basis-wechat', 'videodec', 'videodec-wechat']
: [options.target];
if (options.clean) {
diff --git a/cmake/Emscripten.cmake b/cmake/Emscripten.cmake
index df39b7f07..f87c013b4 100644
--- a/cmake/Emscripten.cmake
+++ b/cmake/Emscripten.cmake
@@ -246,29 +246,6 @@ set(ES_EMSCRIPTEN_SDK_LINK_FLAGS
--closure=0
)
-# Single-file SDK link flags (WASM inlined as Base64, for playable ads)
-# Uses IIFE pattern instead of ES6 modules for maximum compatibility
-set(ES_EMSCRIPTEN_SINGLE_FILE_FLAGS
- --bind
- -sWASM=1
- -sSINGLE_FILE=1
- -sUSE_WEBGL2=1
- -sFULL_ES3=1
- -sALLOW_MEMORY_GROWTH=1
- -sNO_EXIT_RUNTIME=1
- -sENVIRONMENT=web
- -sMODULARIZE=1
- "-sEXPORT_NAME='ESEngineModule'"
- -sFORCE_FILESYSTEM=1
- "-sEXPORTED_FUNCTIONS=['_malloc','_free']"
- # 'GL' is required for the WebGL2 context binding (module.GL.registerContext),
- # same as the web/wechat SDK builds — the playable host registers its canvas GL.
- "-sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','HEAPF32','HEAPU8','HEAPU32','GL','FS']"
- -Oz
- -flto
- -Wl,--gc-sections
-)
-
function(es_apply_sdk_settings TARGET_NAME)
if(ES_BUILD_WEB OR ES_BUILD_WXGAME)
target_compile_options(${TARGET_NAME} PRIVATE ${ES_EMSCRIPTEN_COMPILE_FLAGS} -flto -fno-exceptions)
@@ -281,17 +258,6 @@ function(es_apply_sdk_settings TARGET_NAME)
endif()
endfunction()
-function(es_apply_single_file_settings TARGET_NAME)
- if(ES_BUILD_WEB OR ES_BUILD_WXGAME)
- target_compile_options(${TARGET_NAME} PRIVATE ${ES_EMSCRIPTEN_COMPILE_FLAGS} -flto -fno-exceptions)
-
- string(REPLACE ";" " " LINK_FLAGS_STR "${ES_EMSCRIPTEN_SINGLE_FILE_FLAGS}")
- set_target_properties(${TARGET_NAME} PROPERTIES
- SUFFIX ".js"
- LINK_FLAGS "${LINK_FLAGS_STR}"
- )
- endif()
-endfunction()
function(es_apply_wxgame_sdk_settings TARGET_NAME)
if(ES_BUILD_WXGAME)
diff --git a/package.json b/package.json
index befc54142..a31a2d03c 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,6 @@
"build": "node build-tools/cli.js build",
"build:web": "node build-tools/cli.js build -t web",
"build:wechat": "node build-tools/cli.js build -t wechat",
- "build:playable": "node build-tools/cli.js build -t playable",
"build:sdk": "node build-tools/cli.js sdk",
"build:all": "node build-tools/cli.js build -t all",
"dev": "node build-tools/cli.js watch",