project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

zKastle

zKastle is a solo strategy card game. Manage resources, and upgrade your village to make the maximum points possible. Make tactical decisions to help your village grow and flourish.

zKastle

Created At

StarkHack

Winner of

Starkware - Best use of Starknet 3rd place

Cartridge - Starkware General Dojo Prize!

Cartridge - Onboard with Controller

ETHGlobal - 🏆 StarkHack Finalist

Project Description

zKastle is a solo strategy card game inspired by Palm Island. In this game, you take control of a village and help it grow and flourish by strategically managing resources and upgrading your infrastructure. Your goal is to maximize your points through tactical decisions and efficient resource management.

Turn Structure:

•	At each turn, the player draws two cards from a deck of 16 cards and interacts with them.

Card Interactions:

•	Storing Resources: Cards that represent resources (iron, wheat, stone) can be stored for future use.
•	Cards can be upgraded using stored resources. Each card in the base deck has 4 upgrade versions, progressively enhancing their effects and benefits to the village, with additional cards obtainable through achievements.
•	Discarding Cards: If a card is not needed for immediate use or storage, it can be discarded (only the first one of the deck)

Card Management:

•	When a card is used, whether for storing resources or upgrading, it is placed at the end of the deck. This cycling of cards ensures a continuous flow of options and strategic choices for the player.

The player goes through 8 rounds of full deck cycling. At the end, the points that each card holds are tallied to determine the player’s final score.

How it's Made

This project uses the Dojo framework, an open-source toolchain for building provable games. The core game logic is implemented using Cairo, a programming language designed for writing smart contracts on Starknet. These contracts handle the essential game mechanics, ensuring that all actions are securely executed on the blockchain.

The frontend is built using React and dojo.js sdk. dojo.js complements React by providing tools and modules specific to the Dojo framework, facilitating seamless integration between the frontend and the backend smart contracts. Notably, it uses the Torii indexer to manage and query game data efficiently. Torii ensures that all game-related data is accurately indexed and readily accessible, providing a smooth and responsive gaming experience.

The randomness for the card deck creation is achieved using a VRF (Verifiable Random Function) based on the stark-vrf repository (https://github.com/dojoengine/stark-vrf). We’ve built a Rust backend server that holds the private key and generates the random number with the associated proof. The proof is then sent by the frontend to the Cairo contract, where it is verified. The Rust server is hosted in this repository: https://github.com/z-korp/zvrf.

We have two hosted versions of the project:

1. Katana Instance: This version is hosted on a Katana instance, using Slot. Slot is a toolchain developed by Cartrige.gg for rapidly spinning up Katana and Torii instances. Katana is a blazingly fast Starknet sequencer, designed to support both local development and production deployments. In this version, a burner wallet is created for the user when they connect to the app, stored in local storage, allowing them to play immediately without needing to sign transactions every time.
2.	Starknet Sepolia: This version is hosted on Starknet Sepolia. Users can connect using the Cartridge Controller, a wallet provided by Cartridge. The Cartridge Controller is a gaming-specific smart contract wallet plugin that enables seamless player onboarding and game interactions. This wallet works on both desktop and mobile, allowing users to connect using passkeys.

We would have loved to host only one version, but the Cartridge Controller is not yet working on Katana.

Finally, the app is a Progressive Web App (PWA), meaning it can be installed on mobile devices and function as a mobile app.

background image mobile

Join the mailing list

Get the latest news and updates