A Pokemon-style PVP combat system with a clever strategy encryption solution to prevent front-running by bots and allows seamless integration into any on-chain games, enhancing the overall gaming experience.
Encryption Pokemon is a module that enhances player versus player (PVP) combat in on-chain games, elevating the real-time battle experience.
In current on-chain games, confrontations mainly revolve around 1) Player versus Environment (PVE) or 2) Player versus Player (PVP) scenarios, both relying heavily on user statistics and random numbers. Our objective is to innovate an on-chain combat system that introduces PVP dynamics based on user strategies.
The challenge lies in securing these strategies. Given that all data is recorded on the blockchain, strategies chosen by users are visible to everyone, leading to potential exploitation. To address this, we've implemented a clever strategy encryption solution: To add salt to the strategy transaction before putting it on the blockchain and request both parties to publicly disclose the plaintext and salt of the strategies after confirming both parties have presented strategies.
The gameplay is as follows. When two users engage in battle, they select actions—attack or flee—and employ strategies: blitz, resilience, or shadow, each countering another. For instance, if both Player A and Player B choose to attack, and Player A's strategy (e.g., Blitz) counters Player B's strategy (e.g., Resilience), Player A's attack stats are boosted by 1.5. This approach ensures that battle outcomes depend on both user stats and strategic choices, allowing weaker players to triumph over stronger opponents through strategic initiatives rather than relying on pure randomness.
This concise and adaptable combat module can be seamlessly integrated into any on-chain multiplayer game, including simulations and RPGs, injecting excitement. The turn-based design proves resilient to blockchain latency, aligning well with the on-chain environment. Our innovative design aims to pioneer a user-centric combat experience in on-chain gaming.
The challenges in implementing PVP on FOCG lie in transparency. 1) All transactions are atomic, so in PVP battles, there will always be a specific order in which both sides initiate transactions. 2) In EVM, any transaction is plaintext and traceable. Therefore, the person revealing the strategy later can see the specific strategy of the one who revealed it earlier, allowing for targeted responses. 3) Even if the program requires simultaneous strategy submission, users can still read opponents' transactions and modify their own actions by overriding transactions in the mempool.
Encrypted Pokemon offers a clever solution to this problem. We will add salt to the transaction of the strategy and submit the hash to the chain. After confirming both parties have presented strategies, then request both parties to publicly disclose the plaintext and salt of the strategies.
This is the most important technology that we used in the project. We wrapped up the technology in a Pokemon-style turn-based PVP combat system to let everyone enjoy the fun.