introduce

Dark Forest is a decentralized strategy game based on the Ethereum blockchain. Players can collect resources, build bases, develop technology, collect weapons, fight with other players and compete for resources in the game.

In Dark Forest, each player controls his own planet and needs to collect resources, build bases and develop technology on the planet to improve his combat capabilities. Players can use resources to produce buildings, research technology and weapons manufacturing facilities to gain an advantage in battle.

When players fly in interstellar space, they need to discover other planets and resources through constant reconnaissance and exploration. When two players discover the same planet at the same time, they can choose to attack the planet or flee. When attacking, players need to use their own weapons to attack the opponent's base and seize the opponent's resources.

The characteristic of Dark Forest is that the game is completely based on blockchain technology. Each player's planets and resources are stored on the blockchain and cannot be tampered with or deleted. In addition, Dark Forest is also a decentralized game (DeGame). There is no central server to control the game process, but it is jointly maintained and decided by all players.

Dark Forest is also the first game to introduce the fog of war system in a fully decentralized game, which has been recognized by Vitalik Buterin. We will analyze it in depth in this article to explore how such a real-time strategy game can be implemented in a fully decentralized environment. On April 1, @DfArchon announced that a "Community Round" will be held soon, and interested students can also participate in the test.

Let's start with the game types and compare MMORPG and MMORTS games:

MMO -RPG game: multiplayer online role-playing, open world, the game has a beginning but no end, the fun of the game lies in the immersive experience of the story and the metaverse game world. For example, World of Warcraft. MMO-RTS game: multiplayer online strategy confrontation, relatively small closed world, a round of the game has a beginning and an end, the fun of the game lies in the multiplayer confrontation against the background of the story, and strategies are needed to obtain resources to develop and then eliminate the enemy. Typical representatives are StarCraft and Warcraft, and a round lasts 20-40 minutes. DF is an MMORTS game. Because many people can participate at the same time (up to thousands of people), and the blockchain TPS is limited, so a round lasts about 10 days. The victory or defeat is based on the ladder score ranking, and the score mainly comes from the resources obtained in the game (free acquisition of PVE and plunder of PVP). As for how to pause the game on the blockchain, it is not very clear. Real-time operation

At first, when only the official round was held, you needed an invitation code (key) to log in to participate. Now with the lobby function, anyone can create their own round, so there is the so-called community round (similar to a competition held by the community). Go to the homepage https://zkga.me/ and click "Create Lobby" to enter the lobby setting page, as shown below

Game settings: You can modify the game speed by changing the energy/silver recovery speed and the sailing speed. World Size: Change the size of the map by changing the universe radius. Space Type & Biome: Select the game map. Planets: Set the basic parameters of the planet. Player spawn: Parameter settings for spawning players. Space junk: Parameter settings for this game prop. Capture zones: Parameter settings for captured zones. Artifacts: Parameter settings for this game prop. Admin permissions: Set whether to open the whitelist player. Advanced Snarks: Parameter settings for the fog of war.

For more tips on using Lobby, please refer to this official answer:

https://blog.zkga.me/introducing-dark-forest-lobbies

Dark Forest looks complicated on the surface, but its basic rules are very simple: planets have energy values, which decay as the distance increases. Jumping between planets is like attacking each other, and the outcome of the attack is determined by the decayed energy value. Of course, there are already many articles and videos on how to play the game, so I won't share them in more detail here.

Developer Documentation Analysis

https://dev-guides.zkga.me/

The developer documentation provides some framework explanations of the game’s development architecture, targeting plug-in developers, web client developers, game contract developers, and ZK circuit developers.

Connect to the Blockchain

The game runs on xDai’s layer 2, which is now the Gnosis Chain. Because the game needs to interact with contracts a lot during operation, an RPC node is built in. The Gnosis team even opened a dedicated node for this game.

Plugins

Dark Forest allows players to customize the default web client through a plugin system. Plugins are snippets of code that players can write to generate alternative views of game data, automate common game flows, or even reskin the game. Essentially, Dark Forest allows players to programmatically interact with the web client in any way they like.

Mining

The key mechanic of Dark Forest is its crypto fog of war. When you first join the game, you have no idea where other players are located. Players must calculate hashes to discover points of interest in the universe, such as the locations of planets and other players. These hashes are saved in your browser's local storage and are treated as secret data. By default, the Dark Forest default web client uses a single-threaded Javascript miner to explore the universe, but you can take several steps to increase the hash rate, such as changing the CPU cores next to the mining button. If you try to set the number of cores to more than your computer actually has, your miner's performance will plateau.

When the player's miners discover the universe area map, the web client will save the information related to these undiscovered areas to the browser's local storage. Dark Forest saves data to IndexedDB. Players can also act as miners to explore the location map by running a remote server.

Snarking

Dark Forest is powered by ZK-Snark technology, a cryptographic technique that can be used to prove the correctness of a function without revealing its inputs or logic. Dark Forest uses this technique to verify that moves in the game are valid without revealing the location of the planets to people snooping on the chain. This technique (Zk-snark Proof Generation) is computationally expensive! So this ZK-Proof moves the computation outside the browser and requires a Node.JS running locally. Of course, the game also allows the use of a remote server to run this service.

Summarize

As a highly innovative full-chain game, Dark Forest's development is indeed slow. One possible reason is that this is a community-driven project. Although decentralization can be guaranteed, it also affects development efficiency. The last official round was in February 2022. The Webclient was updated in October 2020, and third-party (community) plug-in updates were slightly more active, including nightmarket (anonymous trading of planetary coordinates) in July 2022 and lobby in March 2022.