Author: StarkWare Compiler: Cointime.com 237

TL;DR

1. Dojo is a verifiable on-chain game engine that enables game ownership, interoperability, and scalability.

2. It runs on Starknet and provides a software framework for game creators to help them create high-quality, seamless and fast games.

3. Dojo enhances game development by enabling fast and cheap transactions, meeting the needs of production-level crypto games.

4. Components such as ECS, Sozu, Torii and Katana help game development and deployment.

5. Future Dojo improvements include Layer-3 game research, optimistic updates, client proofs, and cross-chain transfers.

6. Dojo-powered games on Starknet, such as Dope Wars, Influence, Realms, and CafeCosmos, are increasing, marking the rising trend of on-chain games.

Blockchain games have failed to deliver on their promise. Scaling limitations and high costs have limited most on-chain games to tokenizing in-game assets. But with the cheap and fast transactions enabled by Starknet and the new Dojo crypto game engine, not only can players own their in-game assets, but they can also prove that the game logic runs on the chain.

The global gaming market is valued at $245 billion by 2023, making it one of the largest segments in the global entertainment industry. Blockchain gaming, with its promise of unlimited interoperability, offers even more exciting possibilities for the gaming world. Similar to how multiplayer gaming has brought a whole new dimension of possibilities to the gaming ecosystem, on-chain gaming can become even more interesting and relevant.

But this promise is challenged by the reality of blockchain - transactions are expensive and slow. These two problems are intolerable in games. Because of this, it is almost impossible to create a successful on-chain game.

But as the effectiveness of Rollup technology matures, the promise of on-chain gaming is finally being realized.

In this article, we will look at how the high TPS achieved by Starknet can fulfill the promise of on-chain gaming. We will also explore how Dojo, as the first community-built verifiable game engine, can leverage Starknet to empower creators. Finally, we will look at the future of Dojo for blockchain gaming and the openness it brings.

Crypto Games

When we talk about blockchain games, two of the most popular concepts enabled by blockchain are ownership of game assets and interoperability.

Ownership of game assets means that game assets belong to a wallet owned by the user. In other words, they do not belong to the game developer or a simple email account stored on a centralized server that the game developer can delete remotely. In blockchain games, the assets you create or earn truly belong to you.

Once those assets are yours, games become interoperable. With interoperability, characters and assets from one game or world can be transferred to another. If you've invested hundreds of hours into a game but decide you don't want to play it anymore, you can take those hard-earned assets with you to the new game of your choice.

In order to achieve these two concepts, the game must be built on-chain. This means that all game assets, all actions taken by players, and any other state changes must be carried out as transactions on the blockchain (either individually for each action, or aggregated transactions pushed periodically). On a relatively decentralized blockchain, the fee for a single transaction can range from a few cents to hundreds of dollars (in times of congestion) and take minutes or even longer. Obviously, operating a large-scale gaming infrastructure on such a platform is very expensive, slow, and impractical.

Starknet and cheap computing

But with the advent of validity rollups (such as Starknet), everything is changing.

Starknet is a Layer 2 validity Rollup (often called a zero-knowledge Rollup) developed by StarkWare that uses a cryptographic system called STARKs to drastically reduce computational and storage costs.

Starknet (and Starknet's smart contract language Cairo) allows dApps to handle high TPS at a very low cost and still leverage the security of Ethereum. Such cheap and fast transactions are exactly what is needed to unlock the promise of blockchain gaming. Now games can be built entirely on-chain, quickly and affordably.

But even with on-chain functionality, for blockchain games to flourish, they need a second important building block: a verifiable game engine.

What is a game engine?

A game engine is a software framework that makes the beautiful scenes, fast player movement, and realistic character behavior in your favorite games possible. Game engines typically include libraries and support programs that provide developers with a framework so that they don't have to recreate basic systems (such as physics, graphics, and game mechanics) from scratch for each game. Game engines can also include audio and video processing, rendering 3D effects, and artificial intelligence capabilities.

The game engine is the stage on which games are built.

Most of the games we enjoy playing are thanks to two of the world’s most popular game engines: Unity and Unreal Engine. Developed by Epic Games, Unreal Engine has been used for popular games such as Fortnite, Street Fighter V, and the Gears of War series. Unity is another major player in the game engine industry, giving life to games such as Hearthstone, Ori and the Lost Forest, and Pokémon Go.

Because Starknet unlocks the promise of crypto games, many projects have begun building games on Starknet. But what is still missing is a crypto game engine that allows developers to build games without writing custom code for basic physics, logic, and game mechanics while keeping them running on-chain.

Dojo - The first verifiable game engine

Dojo is such a crypto game engine. It is a community-built verifiable game engine and toolchain for building on-chain games and autonomous worlds. It turns the promise of crypto games into reality.

The number of games on Starknet using Dojo is growing rapidly. Some of the most popular games include:

1. Influence - A large-scale strategy MMO set in a distant asteroid belt, with an open economy owned by players. Users can purchase NFTs to explore and develop asteroids. All asteroids exist in the same world, and players can interact with each other.

2. Realms — A strategy game with 8,000 land maps with specific names, shapes, sizes, and geographical features, providing users (owners of the land) with on-chain utility functions such as resource generation as well as interchangeable housing primitives, thus enabling economic games.

3. CafeCosmos - A land-based on-chain game where users must manage resources effectively. This includes collecting resources, farming and raising animals, making appliances and furniture, trading assets, and much more.

Dojo Components

The Dojo ecosystem includes the following components:

1. ECS (Entity Component System) written in Cairo

2. Sozu Migration Planner

3. Torii Network and Indexing Stack

4. Katana RPC Development Network

Let’s look at each component in detail.

The ECS system is a design pattern used in game development to improve maintainability. The ECS system allows game developers to provide unique functions (components) for game objects (entities), so that the entire scene can run as an integrated system.

Dojo's ECS framework is designed specifically for blockchain-based game development, promoting modularity, efficiency, and flexibility, which are critical to managing the unique challenges of blockchain environments. This makes it possible to create complex, dynamic games on the blockchain, supporting diverse game mechanics and interactions, and taking advantage of the transparent, decentralized advantages of blockchain technology.

And, because Dojo is written in Cairo, it maximizes the efficiency of the code that needs to be validated.

Sozo is a toolchain specifically designed for build and migration planning. In other words, Sozo can be used to deploy developed games on Starknet. With a simple sozo migrate command, an instance of the game "world" can be deployed on the chain. Sozo only provides a command line interface (CLI) tool. However, a GUI interface is currently under development.

Torii is a comprehensive index and networking layer for Dojo worlds. Since the Torii system is built on top of Dojo, it is designed to index any event that occurs in a game world deployed on-chain. It systematically organizes the state of the Dojo world, making it convenient and efficient for clients to query data. Considering the many state changes in a game (imagine that every click is a state change), an efficient query system is a useful feature on the Dojo stack. Queries made on Torii are made using GraphQL.

Katana is an extremely fast local Starknet node designed for local development with Dojo. Katana allows developers to test their applications on this "devnet" for fast local development. Developers can use the Katana network to test transactions sent in their games. Katana provides convenient RPC methods to change the configuration of the network as needed (for example, change the block time or allow zero-fee transactions, etc.). In addition, Katana supports version v0.3.0 of the Starknet JSON-RPC specification (the latest version as of June 2023). Native Starknet JSON calls such as starknet_getTransactionReceipt, starknet_getStorageAt, etc. can be used on Katana.

Dojo and the Future of Crypto Gaming

The Dojo community is constantly researching and building to advance crypto gaming. In addition to improving current components, lead developers are also working on:

1. L3s for Gaming

2. OP Update

3. Client Proof

4. Cross-chain asset transfer

Let’s take a look at what each one contains and what it means for the game.

1. L3s for Games — Dojo is investigating the feasibility of developing games as L3s on Starknet. This means that a separate chain is deployed on top of Starknet that periodically proves the execution of its transactions and submits the proof to Starknet (L2). Starknet aggregates this proof along with other transactions on the network and submits the proof to Ethereum L1, where it is verified. This solution could drastically improve the scalability of games. (As an additional step, imagine if every time a player attempts a level of the game, a new one-time-use layer is built on top of the game layer.)

2. OP Update — How many times have we quietly waited for the “Transaction in Progress…” text in our wallet to turn green, indicating that the transaction has been “verified”? A lot of times. If every move a player makes in the game is sent as a separate transaction, the player will waste a lot of time waiting for the transaction to be accepted.

The OP Update feature that Dojo is working on adding will solve this problem. This feature optimistically runs the transaction on the client (i.e. the browser itself) and allows the player to continue playing. If for some reason the result of the transaction is different from the result of running it in the browser, the game will adjust the changes.

3. Client-side proofs - In addition to optimistically running updates on the client, Dojo is also exploring the possibility of client-side proofs of partial transactions sent on-chain. This will allow games built on Dojo to effectively hide certain inputs passed by users, because a zero-knowledge proof of receiving these inputs can be created on the client. This zero-knowledge proof can then be sent to the sequencer on-chain, which executes the rest of the transaction.

4. Leverage Proof of Storage — Proof of Storage is a cryptographic way to store blockchain information so that it can be shared between different chains. Similar to oracles, they provide proof that the information is true. But unlike oracles, Proof of Storage does not require trust in a third party — the trust in Proof of Storage is already built into the storage. Proof of Storage can also prove the validity of the state of another chain or layer built on top of Ethereum.

Dojo is working with the Herodotus team to implement proof of storage in Dojo, eliminating the need for cross-chain asset transfers. Using proof of storage, ownership of assets from different chains can be proven, and users can use their assets in different games on different chains or layers.

in conclusion

Dojo is the world's first verifiable game engine, made possible by the availability of Starknet and Cairo. With the advent of verifiable game engines such as Dojo, true on-chain crypto games are beginning to see the light of day. The promise of "interoperability and ownership" is gradually being realized.

To summarize, Dojo is the world's first verifiable game engine, and it is powered by technologies from Starknet and Cairo. By using verifiable game engines like Dojo, true on-chain crypto games are gradually becoming a reality. Through continuous improvement and innovation, the Dojo community is committed to promoting the development of crypto games and exploring many new features and possibilities. We can expect to see more exciting developments and innovations over time.