The Dark Forest of Full-Chain Games: Incomplete Information Games, Discussing the Application Potential of ZK in Games
Author: Snapfingers DAO
Introduction
At the Montenegro EDCON conference, Vitalik Buterin stated that zk-SNARKs will be as important as blockchain in the next decade. The fully on-chain game Dark Forest utilizes this technology and received a comment from Vitalik: "It's really interesting."
Dark Forest is an MMO "Cryptographic Warfare Fog of War" blockchain game. The fog of war is a mechanism commonly seen in games, used in titles like "StarCraft" and "Warcraft 3," where information is hidden through the "fog of war"—areas on the game map are obscured until players discover them. This mechanism of environmental unpredictability and tactical uncertainty is also known as an incomplete information game, and almost all popular MMO games are incomplete information games, allowing players to explore a richer and more dramatic strategic space.
On the blockchain, data is completely open and transparent, making it impossible to implement an incomplete information mechanism. Dark Forest uses zero-knowledge proof zkSNARKs technology to allow players to publicly submit verifiable valid actions while maintaining privacy, thus achieving incomplete information.
The following will introduce the project overview and interesting designs of the fully on-chain game Dark Forest, and through this game, we will see how the Web3 world realizes fully on-chain incomplete information games. The article will also explain concepts such as "fully on-chain games," "information games," and "cryptographic fog of war," breaking down terminology barriers. It is hoped that this article will help those who want to understand the overview of Dark Forest and explore the fun of fully on-chain games.
* This article is for informational sharing only and is not investment advice, so specific Tokens or NFTs are not recommended for purchase. Please DYOR.
01 Game Background
Dark Forest is a decentralized RTS (real-time strategy) fully on-chain game built on the Ethereum and Gnosis (formerly known as xDai) chains. The game is an MMO space conquest game adapted from Liu Cixin's representative work, the second book of the Three-Body Problem series, titled Dark Forest. The main content of the game involves repelling invaders from other players, collecting resources randomly scattered across the star map, and expanding your interstellar empire as much as possible.
* MMO stands for Massively Multiplayer Online game, referring to online games that can have 100 to 1000 players participating simultaneously over the internet.
The original idea and founder of Dark Forest is @Gubsheep, who was inspired by Liu Cixin's theory of the dark forest after attending a conference on zero-knowledge proofs. Thus, the idea of creating a "dark forest in a cryptographic world" using zero-knowledge proofs was born. Initially, this was a very experimental and somewhat playful idea, as games, being high-frequency interactive applications, faced enormous challenges in the blockchain environment at that time and even now. Moreover, no one expected that Dark Forest would not only realize this concept but also become a milestone in blockchain history.
Early members of the Dark Forest team
The early team of Dark Forest consisted of Gubsheep, Alan, Ivan, and Moe. The team released the first test version of the game (Dark Forest v0.3) on the Ethereum Ropsten test network on Friday, August 7, 2020. The winners of the competition would receive a total of 1024 DAI.
02 Simple Tutorial
What do users need to prepare to play?
Official game website: https://zkga.me/
Initial website settings
Click the lock icon to enter the website settings and change the settings for "Pop-ups and redirects" and "Insecure content" from block to allow;
Pop-ups and redirects: The first time you log into the game, a pop-up will request a signature transaction;
Insecure content: This option needs to be enabled when using remote map opening.
- Prepare xDAI
The game runs on the xDai chain, and accounts are fully compatible with Ethereum accounts. Each operation in the game requires xDAI as gas fees, and xDAI can also be used to purchase HATs for planets or artifacts sold by players in the market. During each round of games previously held by the official, 0.05 xDAI would be sent to the address of the verification key for the early stage of the game. In community rounds, xDAI may not be distributed, so you should prepare a certain amount of xDAI for your account in any case.
There are two ways to obtain xDAI:
Purchase from centralized exchanges: AscendEX
Cross-chain bridge exchange: for example, Li.Finance, Hop, xPollinate - V2, xDai Bridge…
- Prepare an invitation code
Typically, the official will distribute several invitation codes to qualified participants from the previous round via email before the game. You can ask friends or request them in the community's Discord. However, you should subscribe to the email list on the official website before the game, so you also have a chance to receive a key. You should also pay attention to designated communities for obtaining keys in community rounds.
03 "Fog of War" Mechanism
The concept of fog of war was introduced and formally proposed starting from the early real-time strategy game "Dune 2." Players of "Warcraft" are certainly familiar with the fog of war system, where information about the opponent's units and terrain is not displayed until the player's units explore the area, creating uncertainties in the combat scenario.
After "Command & Conquer," the fog of war in games gradually became commonly defined as two layers: the map layer and the unit layer. The map layer includes terrain that is difficult or impossible to change, ensuring the validity of intelligence even after units move away, while the unit layer refers to the status of active units in that area, which cannot be guaranteed to remain after our intelligence source disappears (such as when a scout unit moves away), thus becoming obscured again. The two layers of fog are conventionally distinguished by varying degrees of blackness, with the map layer being darker, and once the map layer is opened, the remaining unit layer fog is relatively lighter. This classic form of fog of war has been inherited by most subsequent real-time strategy games and has evolved into RTS games and turn-based strategy games, indicating that this design has become an essential element in the concept of 4X games.
In Dark Forest, the fog of war consists of the parts of the map that players cannot see. When creating a new account, only a small portion of the starting area of the map is displayed to players, while the rest of the universe is covered by fog of war. The star map will be explored and expanded through CPU calculations, and the speed of exploration depends on the CPU's performance. Once the star map is explored, this information will be continuously observed, unlike the fog of war in traditional web2 games, where the area returns to a fog state once the scout unit leaves. Therefore, the speed of star map exploration directly determines the amount of intelligence that can be obtained. The more intelligence gathered, the more accurate the decisions made.
Returning to the game Dark Forest, the fog of war in web2 games relies on visibility, terrain, exploration, weather, etc. As a Web3 on-chain game, zero-knowledge proofs cleverly build a decentralized cryptographic dark forest. This gameplay of exploring the universe and broadcasting enemy coordinates through digital computation has not been seen in previous games.
The biggest difference between fully on-chain games and regular blockchain games is that all game data is on-chain, combined with the characteristic of blockchain data being open and transparent, making most so-called fully on-chain games completely informational. Therefore, the common view is that incorporating fog of war elements makes it difficult to create a highly playable fully on-chain MMO game.
Dark Forest achieves accurate verification of player actions using zkSNARK technology while hiding the state from other players. From the player's perspective, the complete state of the universe is not fully revealed, allowing players to enjoy the fun of exploring the map and discovering unknown worlds on-chain. Players can even utilize the principle of fog of war to develop multiple lines simultaneously, expanding planets in different areas of the star map. When other players discover you and have the ability to launch an attack, you will not be wiped out due to resource concentration and can regroup elsewhere.
04 Achieving Incomplete Information Games with ZK Technology
ZKP (zero-knowledge proof) can fully prove that one is the legitimate owner of certain rights without revealing specific information to the verifier. zkSNARK is one of the methods to implement ZKP. Dark Forest uses zkSNARK to ensure that player actions can be verified in detail while remaining hidden from other players. Therefore, although it is a fully on-chain game, it possesses confidential information, allowing Dark Forest to be classified as an incomplete information game.
Complete information games and incomplete information games may sound unfamiliar, but the concepts themselves are simple. Games like chess or Go can be considered complete information games because all information on the board is publicly available from anyone's perspective. StepN is also a complete information game, as every player knows who owns which pair of shoes and the characteristics of each pair.
Dark Forest is referred to as an incomplete information game in the fully on-chain game category. If we use familiar games to describe incomplete information games, they would be games like Mahjong or Poker, which involve hidden information. In Mahjong, the opponents' hands and tile sets are hidden, while in Poker, the opponents' hands and tile sets are also concealed. The innovation of Dark Forest lies in its implementation of this incomplete information game on-chain. While sending verifiable and valid actions as public information, each player maintains a private state.
Dark Forest uses zkSNARK to hide positions on the shared map and create fog of war.
Players do not need to send the coordinates of conquered planets to the smart contract; they only need to claim the planet's position (by hashing the planet coordinates) and provide a valid zero-knowledge proof, ensuring the non-public nature of the planet's position.
When players move, they send the hash value of the planet they are leaving and the hash value of the destination, along with a zero-knowledge proof that proves this is a valid action.
Reversing the hash value is difficult, so checking the Dark Forest contract cannot reveal the true positions of other players. You can only find other players through exploration of the star map. Since the destination information cannot be known in advance during star map exploration, players' decisions are optimal only in the current situation. Whenever a new planet or artifact is discovered, players need to reanalyze and make decisions based on all available information at that moment, such as whether the cost of attacking the opponent's planet or obtaining this artifact is too high. Constantly choosing the optimal solution based on the current situation is the essence of incomplete information games.
05 Open Plugin System Enhances Playability
The primary goal of Dark Forest is to allow users to have fun in various ways. The competitive objective of the game is to score as many points as possible; even if you are not a competitive player, there are many other ways to enjoy the game. Plugins are an important part of the Dark Forest game, serving as a testing ground for various functions. Currently, the official has reviewed and included 55 open-source plugins in the plugin library, mainly divided into three categories:
- Visualization: The game's native interface is relatively simple, allowing players to develop various functions according to their needs, such as data visualization (heat maps, mini-maps, tools that calculate transfer times between planets, etc.), highlighting or marking specific targets (friendly markers and highlights for grouping, highlighting planet buffs, etc.).
- Trading Market: Mainly facilitates the exchange of different resources among players, providing new gaming motivations, including but not limited to: artifact trading markets, similar to equipment trading systems in other games, coordinate bounty markets, planet bounty markets, etc.
- Automation: These plugins are usually used more frequently, mainly helping players simplify originally complex and tedious operations through scripts, improving execution efficiency: resource-related (artifact capture and management tools like Hunt Artifacts, Artifactory, one-click distribution of silver Distribute Silver, one-click resource centralization Centralize Resources, etc.), combat-related (one-click capture of surrounding planets Crawl Planets, automatic repeated attacks Repeat Attack, one-click coordinated attacks Simultaneous Attack, and even the ability to wage war directly against players Wage War, etc.).
Conclusion
In Dark Forest, the Fi elements are weakened, focusing more on gameplay, thus creating a rich gaming experience and diverse gameplay; at the same time, it also experiments with new features. Excluding bugs that disrupt game balance, fraud, bribery, cooperation, and automation are all allowed because you are in the "dark forest."
The novel gaming experience has made Dark Forest a dark horse among blockchain games, and the open guild system better meets the needs of decentralization. In the future, Snapfingers DAO will continue to pay attention to this fully on-chain game.