Starknet - Powering Onchain Games

FDWS...ZDoH
14 Nov 2024
95


Imagine stepping into a game where every move, every item, and every player interaction is real, permanent, and owned by you. In this new era of gaming, your items aren’t just pixels — they’re assets, crafted, traded, and evolving in a fully decentralized world.
This vision is becoming a reality with Starknet, Ethereum’s powerful scaling solution. Starknet combines blockchain’s transparency with a seamless, cost-effective experience, pushing the boundaries of what on-chain games can achieve. Autonomous worlds are no longer a distant dream — they’re here.

In the blockchain gaming world, on-chain games aren’t simply an evolution; they’re a fundamental shift. While Web3 games introduced the concept of blockchain-based asset ownership, giving players true control over items like skins, characters, and collectibles, this approach only skims the surface of what blockchain can enable. On-chain games go deeper: wherein the game’s very state and logic are encoded directly onto the blockchain. Not only are the assets decentralized, but gameplay mechanics and interactions are governed entirely by smart contracts.

By storing everything on-chain, these games inherit the blockchain’s intrinsic properties such as composability, allowing assets and mechanics to integrate seamlessly with other applications; extensibility, where game features can grow through open community contributions; and permissionlessness, empowering anyone to access or contribute without gatekeeping.

This approach breaks down traditional boundaries, letting players and developers shape games in ways previously unimaginable. On-chain games aren’t just decentralized — they’re dynamic ecosystems where rules, assets, and interactions evolve openly, laying the foundation for a truly adaptive and community-driven gaming future.
While Web3 games brought meaningful advances with asset ownership on-chain, they still depend largely on off-chain mechanics and centralized servers for core gameplay. On-chain games, by contrast, bring the entire game experience onto the blockchain, but that isn’t the only advantage they offer. Let’s go through the need for fully on-chain gaming.


The Need for Fully On-Chain Gaming


Complete Decentralization
In Web3 games, assets belong to players but gameplay mechanics often remain centralized. On-chain games, however, decentralize both the assets and logic. This ensures that no central authority can halt or alter the gameplay. These games are resilient and autonomous, accessible to anyone under the smart contract’s rules. On-chain games promote true decentralization, ensuring that they persist as long as there is an active community.

Enhanced Player Agency
By encoding both state and logic on-chain, players gain unprecedented transparency and control over in-game decisions. This guarantees that game mechanics are immutable.

Interoperability and Composability
On-chain games enable items or characters to be used across games, adding depth and fostering expansive ecosystems. This composability transforms game assets into pieces of a larger, collaborative economy.

Trustless Collaboration
Unlike Web3 games that restrict player-developer interaction, on-chain games enable anyone to contribute new features, build expansions, or introduce new interactions. This supports a community-driven evolution of the game, defined only by the limits of its smart contracts.

Onchain Gaming on Starknet

TL;DR
Starknet is ideal for on-chain game development

  • It exponentially boosts the amount of computation that can be processed/verified on-chain via ZK-STARKs.
  • Account abstraction smooths the onboarding experience, enabling users to join with minimal friction.


While the advantages of on-chain gaming are evident, gamers believe these games prioritize earnings over enjoyment. Moreover, the user experience pales compared to traditional games, with cumbersome wallet interactions, clunky interfaces, limited throughput, and high transaction fees making the process less enjoyable.

To make matters worse, realizing the benefits of on-chain games necessitates robust infrastructure to pave the way for a more accessible and immersive gaming experience.
Starknet offers a solution to these problems. Its capability to handle exponential computation on-chain, coupled with low transaction fees and seamless integration through Cairo, is essential for developers to realize the full potential of on-chain gaming.

Exponential On-Chain Computation: Starknet’s architecture allows advanced computation to be processed directly on-chain, enabling complex game mechanics.

Low Fees: With the Dencun upgrade, Starknet has become one of the most cost-effective Ethereum L2s. Using zk-rollup technology, Starknet ensures high transaction throughput and low fees — critical for gaming, where frequent interactions demand speed and affordability.

User-Friendly Experience through Native Account Abstraction: Starknet’s native account abstraction helps smooth onboarding, creating a fun gameplay experience via session keys.

High Transaction Throughput and Scalability: The Madara sequencer is a high-performance sequencer within Starknet, engineered to create highly customizable and efficient app chains, particularly well-suited for gaming. It is built on the Substrate framework, known for its reliability in the Polkadot ecosystem. App chains are private versions of Starknet that give developers the ability to adjust various parameters — such as block times, frequency of settlement on Layer 2, or the use of non-native data availability solutions. This kind of flexibility and control empowers developers to tailor their games to meet specific needs. For instance, if a game aims to prioritize the speed of player transactions, it could implement a First-Come-First-Served (FCFS) sequencing method.

Cairo for Optimized Performance: Cairo is a specialized programming language developed by StarkWare that enables highly complex game logic. Since computing and calldata are inexpensive on Starknet, it allows for advanced features and immersive interactions that enhance gameplay.

These advantages position Starknet as a promising L2 for fostering a thriving, accessible, and equitable on-chain gaming ecosystem. Starknet is actively nurturing its network and community to establish itself as a leader in autonomous worlds.
This marks the beginning of an exciting journey, with StankNet leading the charge in revolutionizing on-chain gaming, paving the way for innovative game experiences that empower developers and players alike.

Cartridge and Dojo are innovative frameworks within the Starknet ecosystem, designed to accelerate the growth of on-chain gaming by simplifying development and enhancing scalability. Here’s an overview of each:


Cartridge

Cartridge is harnessing Starknet to develop its Dojo game engine and a suite of related technologies, equipping game developers with the tools necessary to deploy fully on-chain games. By building this stack, Cartridge aims to accelerate the growth of on-chain gaming and drive industry innovation.
Cartridge’s technology stack enables developers to create games with Dojo, scale with Slot, and allow players to engage via Controller. This integrated framework streamlines the entire process — from development and deployment to user interaction — making it simpler for developers and more accessible for players.
Slot is a managed infrastructure-as-a-service (IaaS) solution specifically tailored to help game developers bring their projects from development to playtesting and beyond. 
Slot is the execution layer of Dojo, supporting rapid provisioning of low latency, dedicated, provable execution contexts, bringing horizontal scalability to the blockchain.

The Cartridge Controller is a smart contract wallet built specifically for gaming, addressing two main challenges in on-chain gaming: streamlined onboarding and seamless player interaction. Traditionally, setting up wallets and managing multiple transactions added friction to the gaming experience, deterring potential players. The Controller overcomes these barriers with several innovative features:

  1. Account Abstraction for Session-Based Gameplay: Through account abstraction, the Controller introduces session keys, which are temporary permissions that allow players to make multiple in-game moves without repeatedly signing each action. This not only makes gameplay smoother but also removes repetitive prompts that tend to take away from the fun.
  2. Social Logins & Web Authentication: Players can log in with familiar social accounts instead of managing complex wallet keys. By combining web authentication with device-based secure enclaves, users can sign up and perform on-chain transactions with a single biometric scan (like Face ID or fingerprint).
  3. Portable Profiles for Universal Player Identity: The Controller enables players to use a single, portable identity across all Cartridge-enabled games, allowing them to seamlessly carry progress, assets, and in-game reputation between titles.


Dojo

Dojo is an open-source framework for creating provable on-chain games and autonomous worlds. It’s built on Cairo, a zero-knowledge proof-based language that brings provability and security to game logic while allowing it to scale effortlessly on Ethereum.

Here’s a breakdown of Dojo’s main tools and features:

  1. Katana: A fast sequencer that processes game transactions with high efficiency, ideal for real-time, interactive games.
  2. Sozo: Simplifies version upgrades and smart contract migrations, letting developers update games easily.
  3. Tori: An indexing tool that keeps game data synchronized in real-time across all players and worlds, ensuring consistency.
  4. Subscription System: Keeps client applications updated.


Dojo is a powerful, developer-friendly toolchain within the StarkNet ecosystem that simplifies and optimizes on-chain game creation, making it both approachable and scalable.
From a developer’s perspective, promoting a fully on-chain gaming ecosystem requires an engine that helps reduce the difficulty of game development. Dojo abstracts away the underlying complexities of smart contract development, providing a high-level, modular framework that allows developers to focus on gameplay mechanics and user experience rather than the intricate details of smart contract logic and blockchain infrastructure.

Developed with the idea that the standardization of logic on a shared network fosters deep levels of composability, Dojo is based on the Entity-Component-System (ECS) architecture — a popular game development pattern.
In this architecture:

  • Entities represent game objects, such as characters, items, or buildings.
  • Components are data holders that describe an entity’s characteristics (e.g., health, position, or inventory).
  • Systems define the logic that manipulates these components, determining how entities behave based on component data (e.g., a battle system that updates health after combat).


Dojo’s ECS-based structure is highly modular, allowing for greater flexibility and reusability in game design. By processing components and systems independently, Dojo facilitates efficient state updates, making it particularly well-suited for games that involve numerous state changes and player interactions.

Moving Beyond On-Chain Games
While on-chain games offer valuable propositions such as interoperability and composability, they face significant challenges stemming from their operation on a public network — specifically, the need for verification by numerous nodes. This extensive verification process can slow down gameplay and limit what developers can achieve.

To address these challenges, Dojo is designed to support the creation of provable games — games that utilize zero-knowledge proofs to verify game actions and computations without the need for extensive node verification. Dojo enables developers to easily integrate zero-knowledge proofs into their game designs, simplifying the creation of games that can confidently validate player actions and game states mathematically. In short, provability paves the way for games to operate with complete confidentiality. Players’ actions can be kept private while maintaining trustlessness and achieving scale and fair play. So player actions remain private until critical game milestones or events require them to be revealed.

Rather than relying solely on a decentralized network of nodes to verify every action, Dojo allows developers to build games where trust is derived from mathematical proofs. This shift means that players can have confidence in the integrity of the game without needing to trust a large network of participants. This approach not only simplifies the trust model but also aligns with the core principles of decentralization, fostering a more robust and reliable gaming experience.

The approach is valuable in games or applications where privacy is essential until a major change occurs. For example, in multiplayer games, auctions, or voting systems, where timing and confidentiality are crucial, only the necessary proofs are shared on-chain. It enhances the strategic depth of the game and player security, by revealing actions only when needed.
With tools like the Dojo Gaming Engine and Madara Sequencer, Starknet’s exploration of off-chain provable games is setting the stage for a new era, where privacy, autonomy, and innovation are central.


If you find this helpful, please support us by subscribing/ following.
Everythingblockchain — Freethinkers, Writers ✍, Blockchain explorers 🔭
In pursuit of simplifying the different blocks of the chain metaverse
Socials
Twitter, Youtube, Substack
The information provided through this work is intended solely for educational purposes and must not be treated as investment advice. Any lapses in presenting any of the information correctly are ours alone. We disclaim any liability associated with the use of this content.

Get fast shipping, movies & more with Amazon Prime

Start free trial

Enjoy this blog? Subscribe to Everything Blockchain

5 Comments