@downdraft/engine 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/core/src/platform/runtime.ts +9 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# `@downdraft/engine`
|
|
2
|
+
|
|
3
|
+
Downdraft engine — a native-runtime game engine (winit + wgpu, no Electron, no browser shell). The JS host is interchangeable: Bun, Node, and Deno all run the same engine through a shared FFI/device layer.
|
|
4
|
+
|
|
5
|
+
Everything the engine ships is exposed as **subpath exports** of this one package:
|
|
6
|
+
|
|
7
|
+
- `@downdraft/engine` — core index (ECS, render loop, HostAPI types)
|
|
8
|
+
- `@downdraft/engine/app/renderer` — `startGame()` / `bootstrapGame()` game bootstrap
|
|
9
|
+
- `@downdraft/engine/libraries/<name>` — engine building blocks (physics, audio, models, water, weather, navmesh, gpu-kernels, …)
|
|
10
|
+
- `@downdraft/engine/modules/<name>` — opt-in feature modules with lifecycle + typed DI (movement-2d/3d, terrain, sailing, camera-controls, devtools, …)
|
|
11
|
+
- `@downdraft/engine/platform/…` — runtime adapters (native surface, FFI, SAB channels)
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
bun add @downdraft/engine @downdraft/platform-native @downdraft/cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`@downdraft/platform-native` supplies the native window/GPU device layer (prebuilt binaries per OS/arch arrive via optional dependencies).
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { startGame } from "@downdraft/engine/app/renderer";
|
|
25
|
+
|
|
26
|
+
startGame({
|
|
27
|
+
renderer: (canvas) => new WebGPURenderer(canvas),
|
|
28
|
+
sim: (seed) => new SimWebWorker(seed?.libraryBuffers),
|
|
29
|
+
simConfig: { seed: 12345 },
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See the [Downdraft engine repository](https://github.com/knackstedt/downdraft) for architecture docs and examples.
|
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
/** True when running under Bun (typeof Bun !== "undefined"). */
|
|
12
12
|
export const isBun: boolean = typeof (globalThis as any).Bun !== "undefined";
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* True inside a `bun build --compile` binary. In compiled executables
|
|
16
|
+
* `Bun.main` is `/$bunfs/root/<entry>` instead of a real filesystem path —
|
|
17
|
+
* this is a global and stays correct even in bundles where a packager has
|
|
18
|
+
* rewritten a module's own `import.meta.url` to the staged asset tree.
|
|
19
|
+
*/
|
|
20
|
+
export const isCompiledBinary: boolean =
|
|
21
|
+
isBun && /^\/\$bunfs\//.test((globalThis as any).Bun?.main ?? "");
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
24
|
* Dev mode. Resolved from (in priority order):
|
|
16
25
|
* 1. DOWNDRAFT_DEV=1 env var
|