> For the complete documentation index, see [llms.txt](https://docs.realmscale.vip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmscale.vip/2.-technical-architecture/2.1-the-zk-ecs-execution-layer.md).

# 2.1 The ZK-ECS Execution Layer

The core execution environment of RealmScale is built around the ZK-ECS (Zero-Knowledge Entity Component System) model. This design choice directly addresses a long-standing incompatibility between traditional game development and blockchain execution.

Modern game engines such as Unity and Unreal rely on the Entity Component System (ECS) architecture to efficiently manage large numbers of interactive objects, physics calculations, and state updates. ECS prioritizes data-oriented design, cache efficiency, and parallelism—properties essential for real-time and large-scale games. By contrast, blockchain execution environments such as the EVM are based on object-oriented smart contracts, sequential execution, and global state mutation, making them unsuitable for complex game logic.

RealmScale resolves this mismatch by treating ECS—not smart contracts—as the primary execution abstraction.

Developers write game logic using familiar ECS paradigms in Unity (C#) or Unreal Engine (C++), defining entities, components, and systems exactly as they would in a traditional game. The RealmScale SDK introduces a transpilation pipeline that transforms this ECS logic into a deterministic intermediate representation. This representation serves two purposes simultaneously:

* It defines the authoritative state transition logic of the game world
* It produces the Arithmetic Intermediate Representation (AIR) constraints required for generating STARK-based zero-knowledge proofs

As a result, game logic written for a Web2 engine becomes directly provable execution logic without requiring developers to write Solidity, design circuits manually, or reason about cryptographic primitives. From the protocol’s perspective, every ECS system corresponds to a verifiable transition function whose correctness can be proven independently of execution.

This approach establishes the execution layer as a deterministic specification of game physics and rules, rather than as an on-chain program subject to EVM limitations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.realmscale.vip/2.-technical-architecture/2.1-the-zk-ecs-execution-layer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
