时空数据库 ThreeJS 支持
SpacetimeDB ThreeJS Support

原始链接: https://discourse.threejs.org/t/spacetimedb-threejs-support-and-free-tier/90052

## 时空数据库 2.0 与 Three.js:实时 3D 的新方法 时空数据库 2.0 提供了一种构建实时和多人 Three.js 应用的新方法。它不再采用传统的 API 轮询,而是将游戏逻辑置于数据库*内部*,并通过 WebSocket 将状态变更流式传输到客户端。开发者使用表格定义世界状态(玩家、实体),使用带有 reducer 的 mutations 进行修改,并使用 views 获取派生数据。 这使得服务器能够充当权威的世界模拟器,让 Three.js 客户端专注于渲染和插值。常见的游戏事件,如移动或生成,可以直接转化为场景更新。虽然它本身不是游戏引擎,但时空数据库为低延迟、同步的 3D 体验提供了强大的基础——包括多人游戏、协作工具和虚拟世界。 它提供慷慨的免费层级和可负担的付费选项。其主要优势在于专注于实时状态复制,这是传统数据库中经常缺乏的功能。开发者仍然需要自行实现延迟掩码和网络代码。

## SpacetimeDB 与 ThreeJS 用于游戏开发 SpacetimeDB 2.0 提供了一种新颖的游戏服务器架构方法,允许开发者在*数据库内*运行游戏逻辑。世界状态被建模为数据库表,而移动和伤害等动作则被处理为“reducers”。 该系统与 Three.js 等客户端集成良好,利用 WebSockets 实现高效的实时更新——客户端仅接收必要的更改(“diffs”),而不是不断轮询,从而保持服务器的权威性。 一个关键的讨论点在于处理大型临时游戏状态(如地形),这些状态不需要持久化。虽然 SpacetimeDB 擅长处理持久数据,但建议利用自定义服务器设置和 CDN 来处理此类易失信息。 SpacetimeDB 提供慷慨的免费套餐,付费计划从每月 25 美元起。
相关文章

原文

SpacetimeDB 2.0 just dropped, and it looks like a really interesting fit for real‑time and multiplayer Three.js projects.

In 2.0, your game logic runs directly “inside” the database, and it streams state changes out to connected clients, which can include a Three.js front end. You define tables for your world state (players, entities, transforms, systems), reducers for mutations (movement, damage, spawning, etc.), and views for derived, read‑only data. The Three.js client can then subscribe to those tables/views over WebSockets and receive fine‑grained diffs, instead of constantly polling an API.

For us as Three.js devs, this means the server can act as the authoritative world simulator, while our client code focuses on rendering and interpolation. Typical workflows like “entity moved,” “projectile spawned,” or “player joined” map very naturally to adding/removing/updating meshes or instances in a Three.js scene. It feels like a strong building block for anything that needs low‑latency, synchronized 3D state: multiplayer games, collaborative editors, shared data visualizations, or virtual worlds.

Curious if anyone here has already experimented with SpacetimeDB 2.0 + Three.js, and what patterns you’re using for syncing transforms, culling, and interpolation on the client side.

SpacetimeDB Free Tier

generous free tier, and paid tier with much higher limits is only $25 a month

What are you going to build with Spacetime?

I see this database pop up on Hacker News from time to time. I think it’s an interesting piece of tech, but I find their insistence on marketing it as a game engine type thing bizarre. There’s no advantage to using it to make games over making any other type of software service.

One comment I think sums it up well: SpacetimeDB v1.0: Multiplayer at the speed of light | Hacker News

”I kept on reading expecting to see motion prediction, multiversion, or similar given the name and focus on games, but no. This is a totally normal database, designed for low latency and with support for WASM stored procedures. You can host your own server or they will rent you one.

Don’t get me wrong, this looks very nice. It looks like a solid building block for persistent worlds in multiplayer games. You’ll just have to do your lag masking netcode yourself.”

That’s a fair take — the marketing definitely blurs the line. But I think their “game engine” angle is less about competing with Unity or Unreal and more about emphasizing real-time multiplayer sync. Traditional app databases don’t usually focus on low-latency state replication between clients.

2 Likes

联系我们 contact @ memedata.com