The secret power of ALEO: Zero-knowledge proofs and game development

Feng
6 min readOct 13, 2023

--

What would a game with built-in zero knowledge look like?

ZKgames are nothing new, and experiments by others have explored similar approaches to demonstrate simple examples of the power of zero-knowledge on both a technical and gaming level. But is there a place for zero-knowledge proofs of games in the gaming industry? What benefits can this technology bring that the intrigue and mystery methods of traditional games cannot?

In this article, you’ll learn how ZK makes existing games better, more interesting, and more fun to play. To answer this question, I set out to create the framework for my own ZK game, where cryptography is central to the storyline.

Create a zero-knowledge storyline

A common framework used by independent game makers is the concept of a “core game loop”. In short, you should think about what activities will keep people coming back and design core game mechanics around them.

In traditional games, the gameplay loop usually revolves around a series of tasks or explorations that the player must complete. For the game we conceptualize in this post, I want these tasks to be more than just arbitrary goals; they need to be cryptographic challenges that can be solved via ZK proofs.

I took inspiration from the Monkey Island and King’s Quest games and started looking for the core gameplay and interactions that made them classics. Essentially, they are linear games where your progress is determined by challenges. With this in mind, our ZK game will be centered around similar interactions and surrounded by an atmosphere of mystery and intrigue. The basic version of the game works like this: you advance the story by acquiring special items that update your status. These “ artifacts ,” as I call them, serve as evidence that propels the player toward the next goal.

I think it would be interesting if each artifact unlocked secret conversation options with NPCs. After deciding to make artifacts the core of the game, I wanted to add a suspicion mechanic to the NPCs. This will serve as another layer of proof verification, a test to ensure you have the artifact you need.

The challenge was to make the ZK elements fit and enhance the story and gameplay. This is where the real fun begins.

Here is the game loop I created:

  • Trigger: The player initiates a conversation with the NPC.
  • Suspicion: They were given some background but hit a snag.
  • Test: The NPC initiates a SNARK check to verify whether the player meets the conditions to continue the conversation. Or players use an artifact (another separate piece of evidence) to solve a puzzle. For the first instance, the test passed without exposing the artifact itself. In contrast, they reveal this in a puzzle instance that automatically “dissolves the artifact’s power.” In other words, the player reveals the content of their proof, which can still be helpful in future conversations with NPCs.
  • Result : Players verify through NPCs and gain clues to the puzzle or unlock the puzzle itself by revealing artifacts. What they discovered in both cases points to the next steps in their mission.

I analyzed this game loop to better understand the role of SNARKs in the game, which also determines the role of each verification in advancing gameplay.

Proof 1: ZK artifact

First , ZK artifacts are scattered throughout the game world. These can be items important to the plot, such as keys, tools, or documents. You can discover them by solving puzzles or passing trust checks on key NPCs.

Once the artifact is found, it needs to be verified. They will have public data (for example, a description or image) and secret data (for example, a code or password). When you discover an artifact, you don’t immediately know its significance. You can use its public data to verify whether it is one of the ZK Artifacts you need without revealing secret data. Finally, players can find some clues by solving ZK puzzles or completing trust checks given by NPCs. Solving these questions will bring you closer to determining the next steps to take in order to complete the level.

Proof 2: NPC trust check

When you first approach an NPC, they have a basic level of trust. This can be affected by your actions and the artifacts you own.

However, at certain critical moments, NPCs will challenge you to prove your authenticity. Using ZK-SNARKs, you can verify your claims without revealing your identity or the specifics of your artifact.

As you gain the trust of NPCs, they may give you clues about the location of artifacts, help you with challenges, or even provide you with unique artifacts to solve the next puzzle.

The concept began to take shape. Now, all we need is a story to tie it all together.

Create ZK stories for the ZK world

The cool thing about building the underlying mechanics for this game is that anyone can use it to tell any story you want. The example above uses Artifacts, but the suspicion and mystery mechanics behind the concept make for some of the best scenes in the game.

For example, what if your character is your typical time-traveling mad scientist? You’re testing your great invention and end up stranded in a foreign country, where your mission is to get home without exposing your identity to the locals. Bingo, you have a game.

These are just some of the many possibilities. My goal is to show you the versatility of this primitive for a variety of games. This is not my game; it belongs to all of us now. Similar to Battleship and Bologna! ” becomes the go-to ZK game for all Aleo events, a new game concept that can inspire developers like you to make the next great zero-knowledge game.

ZK Game Build Resources

If you’re looking for some resources on how to build and deploy a ZK game on Aleo, here are some puzzles that are particularly helpful when conceptualizing the game:

  • A basic guide to understanding Aleo and its features.
  • These are the elements that put the logic in place to make proofs an element of the game.
  • (Tic-Tac-Toe, Bubble Sort): Provided Leo with real-world context and helped define core ZK game mechanics.
  • and Guide: The key to understanding how to deploy and integrate zero-knowledge components into online games.
  • Community ZK Games ( , , ): Provides insights into best practices for launching and hosting ZK games.
  • Kryha and Demo: The most valuable resource for understanding how to integrate ZK proofs (especially SNARKs) into your game loop.

If I were to launch this game myself, I would first learn how the ZK game developers have successfully launched their projects in the past, and then build up my knowledge of Leo. Finally, I’ll get to the web application implementation part, which is probably the trickiest: there may be only one Aleo blockchain, but there are thousands of ways to make an online game.

Why ZK is defining the future of gaming

A similar version of the game can be run on traditional tracks in addition to traditional tracks, but it’s only through Aleo’s ZK infrastructure that the game becomes more than just an idea. Sam Parker explains why in this talk.

As an imperfect information game by design, this game framework relies on players and NPCs not knowing the specific details of the narrative from the start. Even if you were to introduce some randomness into your game, the variable would still be stored somewhere in the code and the player could use that variable to pass a challenging level.

By relying on SNARKs, this game concept can lead to a realistic experience of surprise, intrigue and even competition when you consider how people try to reach the end of a level in record time. The gameplay will not be the same, as the evidence to unlock puzzles can be dynamic or static, depending on what the person deploying the game chooses.

In the end, this experiment helped us find a framework for launching games like Papers Please, Mist, and Return of the Obra Dinn without relying on the game designer’s planning to make trees. Rather than spreading zero-knowledge proofs across every decision at one level, and letting their verification drive the story forward.

This is where blockchain gaming starts to show its real potential beyond P2E casinos and NFT in-game items. So, now it’s your turn to iterate on the implementation of this concept you can find in your own ZK game.

Ready to try building a ZK game on Aleo?

--

--

Feng
Feng

Written by Feng

A person who enjoys analysis and focuses on privacy!

No responses yet