Get Started with Gaming On Scroll using  Paima Engine

Get Started with Gaming On Scroll using Paima Engine

ยท

5 min read

What if you could build trustless Web3 games entirely with Web2 programming languages you're already familiar with? Well, with Paima Engine, you can!

Web3 games bring fresh vibes to the community, yet their development demands a high level of technical skill and interoperability. Moreover, a lot of the current game engines are optimized for Web2 games, which are centred around centralized servers and databases, lacking the essential features required for Web3 games, such as decentralized ownership, play-to-earn incentives, and cross-chain compatibility.

The Paima Engine solves all these problems by allowing developers to build Web3 games using a familiar stack in just days. In this guide, we are going to get familiar with the Paima Engine, explore its potential to build games on Scroll and then deploy a sample project to the Scroll network.

What is Scroll?

Scroll is an EVM-equivalent Layer 2 scaling solution for Ethereum that uses ZK (zero Knowledge) technology. It is more accessible and responsive, extending Ethereum's capabilities down to the bytecode, enabling apps to scale without any surprises. Scroll is compatible with Ethereum at the bytecode level, which means existing Ethereum apps can migrate onto Scroll as-is, and at a significantly reduced cost.

Scroll, being a ZK rollup makes it fast, cheap and super scalable which are all the things that sound exciting when building games.

What is Paima Engine?

Paima Engine is a framework built by Paima Studios for creating app-specific layer 2s (L2s) as sovereign rollups. That means: apps can publish transactions to a blockchain for ordering and data availability, but use its code to determine the correct app state. It is super-optimized for games, gamification and autonomous worlds.

Paima engine allows devs to deploy games using Web2 stack while not having to worry about the complexities of blockchain integration. It pioneers the solution for trustless open-source gaming primitives which were not possible in the Web2 world. Paima also supports cross-chain gameplay in that players can access the same game from different blockchains and wallets without compromising their identity or assets.

Games & apps written using Paima Engine are non-custodial, meaning user funds are not at risk even if the game/app gets hacked. These two, in combination, make Paima Engine the cheapest, fastest and safest way to start building completely trustless Web3 games. Let's take a quick look at the problems Paima Engine solves for gaming in web3.

Why does the Paima Engine exist?

Before Paima, game developers had to grapple with tons of blockers to build fully decentralized games. Let's discuss these reasons and in doing so highlight the need for Paima:

Development is Expensive

Building on the blockchain can be quite expensive. There is the cost of minting the NFTs, the cost of auditing the smart contracts and also the technical cost of having to write the smart contracts in strictly EVM-compatible language(Solidity or Plutus).

With Paima Engine, things are different; Devs can apply their years of knowledge in JavaScript, relational databases, and all parts of the classic Web2 stack with Paima Engine, while fully taking advantage of the bleeding edge in Layer-2 blockchain technology.

Web3 is Risky

Software gets hacked every day and with the blockchain, the impact can be devastating. In 2022 alone, over $3 billion was stolen in hacks. And with Web3 Gaming where assets carry value, this volatility raises serious concern and spotlights the need for a better approach.

Paima Engine, out-of-the-box is committed to security. It protects users even in the case of hacks allowing brands to build web3 applications without worrying. Since the layer 2 state machines are deterministic and verifiable by anyone, any malicious or invalid transactions can be readily detected and reversed by the network, ensuring enhanced security and reliability for all users. In addition, users can always withdraw their assets from the layer 2 network to the layer 1 blockchain at any time, ensuring their safety and sovereignty.

User acquisition is difficult

There are currently over 1000+ chains running in the blockchain ecosystem and each has its community. This fragmentation of the user base makes it difficult to onboard users to games.

With Paima Engine, we can target the entire web3 Space regardless of the chain and network. This alleviates the friction of driving and attracting diverse communities to use the dApp.

Fast Iteration is really difficult

With Smart Contracts, you only have one shot at getting it right. Iterating and redeploying the contracts requires going through Security Audits (which is quite expensive). While Immutability is one of the blockchain's attractive features, for games it's a huge friction. It's almost impossible to retract already distributed items like NFTs from the users to rebalance the system or modify the contracts.

Paima Engine combats this premise by minimizing the number of static data in the dApp. Historical Web3 games rely on tons of NFTs that are expensive to Mint and hard to update. Paima Engine instead reduces the amount of NFTs used and introduces NFT compression and Stateful NFTs that are updateable. This means that developers can use the layer 2 state machines to add extra information and functionality to the layer 1 NFTs, allowing them to change over time based on user actions or game logic.

Build and Deploy Games to Scroll using Paima Engine

What you will need

  • npm and node.js installed.

  • Ethereum wallet preferably Metamask Installed.

  • ETH on Scroll Testnet (Get test ETH / Bridge from the Faucet)

  • A desire to learn!

Setting up Paima Engine

Setting up your first Paima project is straightforward. You can choose to either start from scratch or use a template provided by Paima Studios to bootstrap with all of the essentials. In this guide, we will be going the template route.

To initialize a game using a Paima game template, run the command below to create a new directory paima-game-scroll and clone the paima-game-templates git repo to your local machine.

mkdir paima-game-scroll
cd paima-game-scroll
git clone https://github.com/PaimaStudios/paima-game-templates.git

Once you've successfully cloned the repo, navigate to the rock-paper-scissors template which we will use for the rest of the guide.

While in the rock-paper-scissors directory, run the command below to initialize the project.

npm run initialize
๐Ÿ’ก
You need to be running the latest node version (20.xx.xx) to run the command above.
ย