# Introduction

Welcome to the new paradigm of gaming.

<figure><img src="/files/xhZtgCYGo4dVYgTlHoSK" alt=""><figcaption></figcaption></figure>

We're a collective of builders on the Internet Computer blockchain dedicated to building foundational infrastructure for on-chain games and autonomous worlds. We are committed to demonstrating the unique capabilities of the Internet Computer blockchain for the on-chain gaming vertical.  All our gaming infrastructure code is open-sourced on [our Github](https://github.com/orgs/BoomDAO/repositories) and documented here.

## Four areas of focus:

1. **Game Launcher**: A one-stop game platform with a suite of powerful tools including 1-click game uploads to canisters, testing fake tokens/NFTs in a test environment, deploying World canisters with configurable rules, and a discovery page for gamers to find on-chain games to play.
2. **World Engine**: A comprehensive, on-chain game server that provides a universal game-centric database, modular game logic, composable data standards, and customizable permissions for cross-game transactions.
3. **Templates**: Streamlined, ready-to-deploy templates designed for seamless integration of Unity game clients and World canisters to the World Engine, facilitating rapid game development.
4. **Examples**: A carefully curated selection of canister code examples designed to serve as a reference for game developers, helping them build game features.

***

## Connect with Us!

If you are a game developer looking to use BOOM DAO tooling for your game, please reach out to us in the [BOOM DAO Discord](https://discord.gg/FJ7H3s35). We would love to have a call with you to know the needs of your game and assist you in setting up your World canister for the first time. We will even do all the work to set it up for you, so all you have to worry about is writing your Unity code :)

## Watch the tutorial video:

{% embed url="<https://youtu.be/LHVVi4pN6CI?si=h6yx2l5_cPfp3DzZ>" %}


# FAQ

GM! Let's talk about why we're here.

## Why on-chain games on the Internet Computer?

We've devoted over two years to building games on the Internet Computer. We've explored, experimented, researched, discussed and debated every corner and crevice of blockchain gaming.

Throughout our journey, one thing remained our guiding compass - the Internet Computer combined with fully on-chain games presents the greatest opportunity for humanity to change how we interact and create value for each other.

Affordable on-chain storage (1GB \~= $5) allows a game server, database, assets (sprites, 3D models etc), game client etc. to be stored and served entirely on-chain.

By leveraging the power of the IC, we can build digital realms encapsulated entirely in canisters on an infinite, transparent, and governable World Computer. Nothing like this has been attempted before.

## Does everything need to be on-chain?

Technically no.&#x20;

But if you aren't building fully on-chain, you're missing the powerful network effects of smart contracts.

Would NFTs have grown to a billion-dollar industry if they were fragmented across Amazon Web Services or Google Cloud?

The power of smart contracts lies in their ability to socially coordinate billions of humans to participate in unified value creation on the internet.

Don't ask **if** everything needs to be on-chain, ask what's possible when everything **is** on-chain. New possibilities emerge when smart contracts can coordinate billions of people to create digital worlds together. Unique use cases emerge when worlds are 100% on-chain.

If you'd like to dig deeper into the concept of on-chain games and autonomous worlds, we recommend reading these materials below:

[Autonomous Worlds Primer](https://www.wired.com/story/autonomous-worlds-aim-to-free-online-games-from-corporate-control/)

[VC Article About the Potential of On-Chain Games](https://medium.com/1kxnetwork/autonomous-worlds-the-case-for-fully-on-chain-games-3066db695a5a)

[Gubsheep - The Strongest Crypto Gaming Thesis](https://gubsheep.substack.com/p/the-strongest-crypto-gaming-thesis)

[Lattice - MUD: An engine for Autonomous Worlds](https://lattice.xyz/blog/mud-an-engine-for-autonomous-worlds)

[Overview of On-Chain Games Ecosystem](https://twitter.com/0xtaetaehoho/status/1673715333860040705?s=20)

[Twitter Thread About Autonomous Worlds](https://twitter.com/pet3rpan_/status/1655920578505887744?s=20)

## Does a game need NFTs and Tokens?

Technically no.

Although we believe that NFTs and Tokens can be a powerful way to align incentives for gamers, creators, and developers in ways that aren't possible without smart contracts. Designing a game economy that sustainably acquires users, rewards value creation, pays developers, prevents ponzi-nomics and is inherently fun to play, is a monumental task that no game studio has solved yet.

NFTs and Tokens aren't going anywhere. We believe that there will be an economy that can attract and reward players and creators in a sustainable way. We've built the developer tools so that you can test NFTs and Tokens, but it's up to you to discover the game economy that sustains your digital world.

## How do we onboard Web2 gamers?

Over the last two years, billions of dollars in venture capital have been raised to solve this very issue.&#x20;

Has it been solved yet? The short answer is no.

**Everyone has an opinion on why it hasn't been solved:**

* UX is bad
* Wallet login is complicated
* Gamers hate NFTs
* Games should only be about fun
* Web3 games aren't high-quality
* Players don't want to deal with tokens
* Players shouldn't know they're using crypto
* Web3 games are all ponzis
* Blockchains are too slow

**What if I told you that those statements are true, but they're viewing the problem from the wrong perspective.**

All these opinions are analyzing Web3 games through the lens of Web2 games.

As Henry Ford (the inventor of the modern car) famously said:&#x20;

> “If I had asked people what they wanted, they would have said faster horses.”

In the same way, if you ask a gamer what they want, they want a Call of Duty with better graphics or a League of Legends with faster networking.&#x20;

#### Instead, let's think from first principles.

> A first principle is *a basic proposition or assumption that cannot be deduced from any other proposition or assumption*

First, we should identify what our experience has taught us about games.

Then, throw all that game experience into the trash. Erase it.

Start from scratch.&#x20;

Think about what games ***could*** be if all logic and data was entirely in smart contracts. What new use cases does this open up? What new game genres can be invented?

Stop trying to build things for the people who want faster horses.

## Why do we need on-chain gaming infrastructure?

Because building games on-chain is hard. Video games are some of the most complex  applications in the world. Cutting edge technologies were invented by game developers just trying to get their game idea to work.

Blockchain adds additional complexity on top of an already complicated tech stack. Game development timelines take 2-3 years, and now there's additional work to write blockchain smart contracts and design on-chain economies.

BOOM DAO set out to fix this problem and supercharge the development of fully on-chain games. BOOM DAO gaming infrastructure was designed to be simple enough for a 14 year old to build a fully on-chain game in a matter of days.

## Why should I integrate the World Protocol into my game?

When we began designing BOOM DAO gaming infrastructure, we realized there was a massive opportunity to create network effects across all games on the Internet Computer. This began with our concept of Worlds.

In traditional gaming, if your game is multiplayer and/or online then a game server is required. This game server enforces that players can't cheat and supervises fair interactions between players in a single digital space. When a player takes an action, this game server talks to a database to verify the newly changed player data.

In on-chain gaming, this game server is replaced by a World canister. A World canister acts similar to a game server, but its logic runs through blockchain consensus to prevent cheating and its logic can be governed by a DAO. Additionally, instead of a database on a centralized cloud provider, a World stores its data in canisters in the World Protocol - a composable and standardized on-chain game database that can be accessed and leveraged by any World.

The World Protocol interconnects the data of every game on the Internet Computer with composable data standards and access control. It governs the economic and social interactions between games, empowering Worlds to alter each other's data through the protocol.


# Quick Start

Skip the BS. Get building.

## Connect with Us!

First of all, if you are a game developer looking to use BOOM DAO tooling for your game, please reach out to us in the [BOOM DAO Discord](https://discord.gg/FJ7H3s35). We would love to have a call with you to know the needs of your game and assist you in setting up your World canister for the first time.

***

## Build an On-chain Game in Hours

To get started, you will need a World canister as your "game server" and a Unity project that connects to it. Follow these [tutorials](https://docs.google.com/document/d/1PcWcI_HQqINbpMyTG3BFtCdK8IsyfFRL7yOGgfjsoKg/edit?usp=sharing) to create a World canister, configure it, and connect it to your Unity project.

***


# Game Launcher

The developer toolkit for building on-chain games

Use it here: [launcher.boomdao.xyz](http://launcher.boomdao.xyz)

<figure><img src="/files/MMLHSv37o6YvwO2Ymtbx" alt=""><figcaption></figcaption></figure>

## The All-in-One Game Toolkit

The [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) is a platform that simplifies the creation of games on the Internet Computer blockchain. With just one click, developers can upload WebGL, PC, and Android builds directly to canister smart contracts. All uploaded games are immediately surfaced on a dedicated discovery page for players to browse and play. Game developers can deploy fake NFTs and ICRCs in a test environment.

Deploy a game World and configure the contract directly on the Game Launcher website without writing a single line of code. Your World contract is essentially the game server that governs the rules of your game. Enforce smart contract laws and empower composability in your game at its inception.

The [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) shortens game development timelines from months to days.&#x20;

Check it out here: [launcher.boomdao.xyz](http://launcher.boomdao.xyz)


# World Engine

The Hub of all Worlds

By tightly integrating composability and interoperability at the protocol-level, the World Engine will unleash massive network effects across thousands of games and empower shared economies that will dwarf web2 social networks.

## What is the World Engine?

To understand the World Engine, it is important to understand the definition of Worlds and the role that they play in the World Engine. The World Engine consists of many World canisters that are indexed by the [World Hub](/world-engine/how-it-works).

**A World canister is the "game server" and "database" of a game.** It houses all the game server logic in a smart contract. And it communicates to the World Engine to store all the data for a game.&#x20;

**The World Engine interconnects all the Worlds in the ICP gaming ecosystem**. It regulates how Worlds can interact with each other's databases, and empowers complex on-chain economies to exist across games. The World Engine is the *Database for All On-Chain Games*.

## Why is this a big deal?

**Network Effects.**

It’s abundantly clear that the massive opportunity of smart contracts lies in their ability to coordinate millions of people to build value together. By leveraging the World Protocol, thousands of games can work together to create networks of Worlds that dwarf web2 social networks. The composability and transparency of canisters accelerates this vision because Worlds can read and write data to other Worlds in ways that were never possible before. The walled gardens that plague traditional games will no longer exist, because all game data and logic will exist fully on-chain in the World Protocol. Players can become creators by cloning their favorite game’s World canister and modding it with new functionality. Offering a fresh perspective to interoperability, World canisters tightly integrate with each other at the protocol-level, unlocking major use cases for interconnected gaming experiences.

Imagine completing a quest in Game A and then receiving a sword item in Game B. Then you use the sword item to battle in Game B which results in you getting an achievement in Game A that unlocks a new map to play. All this can happen autonomously through interconnected smart contract code that allows Worlds to modify each other’s data securely.

Now any game can read and modify the data of any other game through composable data standards and powerful access control. A new paradigm of digital creation will emerge as players build mods of your World and request smart contract permission to extend the Entities in your World.

Everything is governed by smart contracts on-chain, empowering cross-game economies where you take an action in one game and the blockchain validates it and gives you a reward in another game. This new era of gaming will transform players into creators as they mod and build on top of their favorite on-chain Worlds.


# How It Works

## The Canisters

**There are three types of canisters in the World Engine:**

1. **World canister:** The game server canister
2. **World Hub canister:** The indexing canister
3. **User Node canisters:** The user data canisters

<details>

<summary>World canister</summary>

A World canister is essentially your **game server** written as a canister smart contract. You can deploy your own through our website. Your game client communicates exclusively with this canister. Its main purpose is:

* Act as the game server for your game
* Manage the Configs of your game
* Validate the actions that players are doing in your game
* Ensure players aren’t cheating

</details>

<details>

<summary>World Hub</summary>

The World Hub indexes **World canisters** and **User Node canisters**. It tells the World canisters which User Node canister they need to call.

</details>

<details>

<summary>User Node</summary>

UserNode canisters store the data of all users. User data is stored as pieces of data called **Entities**.

</details>

***

## The Data

**There are four types of data stored across the World, World Hub, and User Nodes:**

1. **Action:** Actions enforce what players can do in your World
2. **Config:** Configs define metadata, usually about Entities
3. **Entity:** Entities are data representing the objects or things in a World
4. **Permissions:** Defines which Worlds have permission to alter Entities in your World

<details>

<summary>Action</summary>

An **Action** is something a player can do in your game that gets saved to the database.

***Example: If a player spends 100 Gold they receive 1 Sword***

### Action

This is what an Action looks like in code:

```motoko
    public type Action = 
    {
        aid : Text;
        callerAction : ?SubAction;
        targetAction : ?SubAction;
        worldAction : ?SubAction;
    };
```

* **aid:** The action id that identifies this specific Action
* **callerAction:** The SubAction to apply to the user calling the Action
* **targetAction:** The SubAction to apply to the user being targeted by the Action
* **worldAction:** The SubAction to apply to the World executing the Action<br>

### SubAction

This is what a SubAction looks like in code:

```motoko
    public type SubAction =
    {
        actionConstraint : ?ActionConstraint;
        actionResult : ActionResult;
    };
```

* **actionConstraint:** The requirements for a player to do this Action
* **actionResult:** The result of this Action

</details>

<details>

<summary>Config</summary>

A **Config** defines static metadata for your game. **Configs** are stored in the **World** canister, and are fetched by the Unity game client when the game starts. They can be changed in the canister without requiring a new game build. They look like this:

```motoko
public type Config = {
    cid : Text;
    fields : Map.Map<Text, Text>;
};
```

* **cid:** The config id for this Config
* **fields:** A hashmap of "fields" and values. This allows for flexibility to define whatever fields you want to store in this Config.

</details>

<details>

<summary>Entity</summary>

In its simplest definition, an **Entity** is a piece of data in the database. They look like this:

```motoko
    public type Entity = {
        wid : TGlobal.worldId;
        eid : TGlobal.entityId;
        fields : Map.Map<Text, Text>;
    };
```

* **wid:** The world id in which this entity exists (aka the canister id of the World canister)
* **eid:** The entity id that uniquely identifies this Entity (eg. awesome\_item\_01)
* **fields:** A hashmap of fields and values contained in the Entity

This standardized data format for Entities can represent almost any data type imaginable.

The most common use cases for **Entities** include **Items**, **Buffs**, and **Stats**. But they can be used for more complex data like **Characters, User Profiles, Purchases, Tech Tree** etc. &#x20;

Entities are the building blocks of your game economy.&#x20;

Here are some example implementations:

**Item Entity:**

```
{
 eid="item_01"                       //entity id
 wid="awcae-maaaa-aaaam-abmyq-cai"   //world id (aka the canister id of your world)
 fields = [
  ("quantity", "420"),             //quantity of item user holds
 ];
};
```

**Buff Entity:**

```
{
 eid="buff_01"
 wid="awcae-maaaa-aaaam-abmyq-cai"
 fields = [
  ("expiration", "1695954265797"),            // expiration timestamp
 ];
};
```

**Stat Entity:**

```
{
 eid="stat_01"
 wid="awcae-maaaa-aaaam-abmyq-cai"
 fields = [
  ("games_played", "420"),            
 ];
};
```

**Character Entity**:

```
{
 eid="warrior_01"
 wid="awcae-maaaa-aaaam-abmyq-cai"
 fields = [
  ("attack", "420"),
  ("defense", "69"),
  ("health", "9000"),            
 ];
};
```

</details>

<details>

<summary>Permissions</summary>

Permissions allow other games to alter your game's database.

There are two types of permissions:

**GlobalPermission** allows another game World to change all the Entities in your World.

```motoko
public type GlobalPermission = {
    wid : Text; // The World Id of the World that you're giving permission to
};
```

**EntityPermission** allows another game World to change a specific Entity in your World.

```motoko
public type EntityPermission = {
    wid : Text; // World Id of the World that you're giving permission to
    gid : Text; // Group Id of the Entity
    eid : Text; // Entity Id of the Entity
};
```

These are the functions in your World canister that allow you to add and remove permissions:

```motoko
public shared ({ caller }) func grantEntityPermission(permission : EntityPermission) : async () {
    assert (isAdmin_(caller));
    await worldHub.grantEntityPermission(permission);
};

public shared ({ caller }) func removeEntityPermission(permission : EntityPermission) : async () {
    assert (isAdmin_(caller));
    await worldHub.removeEntityPermission(permission);
};

public shared ({ caller }) func grantGlobalPermission(permission : GlobalPermission) : async () {
    assert (isAdmin_(caller));
    await worldHub.grantGlobalPermission(permission);
};

public shared ({ caller }) func removeGlobalPermission(permission : GlobalPermission) : async () {
    assert (isAdmin_(caller));
    await worldHub.removeGlobalPermission(permission);
};
```

</details>

***

**Below is a diagram of how game World canisters interact with the World Hub and User Node canisters:**

<img src="/files/Gglz55vGj3xl5ZsxLYpz" alt="" class="gitbook-drawing">

<figure><img src="/files/NOn9m6XXbpqhIxqiXmjX" alt=""><figcaption></figcaption></figure>


# World Canister

Get your World canister set-up in minutes

## Deploy a World canister

A World canister is the "game server" of your game written in a canister smart contract.

You can deploy a World canister on the [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) website today!


# Actions

## Define the Rules of your World

**Actions** are the rules of your **World**. They empower developers to define, validate, and reward player actions within the World. Actions can be used to configure the rules of your World canister (aka your game server) from scratch without having to write a single line of code.

It's an optional framework, giving developers the freedom to use the no-code tool to configure Actions or instead write their own custom World canister code. This flexibility allows game devs to tailor the gaming experience to their vision.

Actions come baked into the [World Template](/world-canister). Go to the [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) website to deploy a **World Template** and configure **Actions** directly on the website in a few clicks!

***

## How does it work?

Actions are pre-defined rules that players must follow in your game.

***Example: If a player spends 100 Gold they receive 1 Sword***

As you can see, Actions are the backbone of your game economy.

### Action

This is what an Action looks like in code:

```motoko
public type Action = {
    aid : Text;
    name : ?Text;
    description : ?Text;
    imageUrl : ?Text;
    tag : ?Text;
    actionPlugin : ?ActionPlugin;
    actionConstraint : ?ActionConstraint;
    actionResult : ActionResult;
};
```

* **aid:** The action id that identifies this specific action
* **name:** The optional name of this action
* **description:** The optional description of this action
* **imageUrl:** An optional image you want to show related to this action
* **tag:** The optional tag that identifies this action so the client knows how to display it
* **actionPlugin:** An optional plugin that holds custom config data and can run custom logic
* **actionConstraint:** The optional requirements that must be validated before doing this action
* **actionResult:** The result of this action which is made up of many possible outcomes

### ActionPlugin

You can specify an optional plugin with custom config data and custom logic by using an **ActionPlugin.** The World Template comes with default plugins, but you can write your own or import plugins from other projects. Here are the default plugins:

```motoko
public type ActionPlugin = 
{
    #verifyBurnNfts : { canister: Text; requiredNftMetadata : ?[Text]; };
    #verifyTransferIcp : { amt: Float; toPrincipal : Text; };
    #verifyTransferIcrc : {canister: Text; amt: Float; toPrincipal : Text; };
    #claimStakingRewardNft : { canister: Text; requiredAmount : Nat; };
    #claimStakingRewardIcp : { requiredAmount : Float;  };
    #claimStakingRewardIcrc : { canister: Text; requiredAmount : Float; };
};
```

### ActionConstraint

You can specify optional requirements to do an Action by defining **ActionConstraints**:

```motoko
public type ActionConstraint = {
    timeConstraint : ?{
        intervalDuration : Nat;
        actionsPerInterval : Nat;
    };
    entityConstraint : ?[{
        wid : ?TGlobal.worldId;
        gid : TGlobal.groupId;
        eid : TGlobal.entityId;
        fieldName : Text;
        validation : {
            #greaterThanNumber : Float;
            #lessThanNumber : Float;
            #greaterThanEqualToNumber : Float;
            #lessThanEqualToNumber : Float;
            #equalToNumber : Float;
            #equalToString : Text;
            #greaterThanNowTimestamp;
            #lessThanNowTimestamp;
        };
    }];
};
```

* **timeConstraint:** Defines how many times the player can do the action in a certain time interval.&#x20;

  *eg. Collect gems 4 times every 24 hours. Or 1 time every 6 hours. etc.*
* **entityConstraint:** Defines a list of Entity requirements the player must have in order to do the action. An Entity constraint can even check Entities in another World!&#x20;

  *eg. Have greater than 100 Gold in Plethora to buy a Sword in Cubetopia. Or have a Luck buff that isn't expired to do a lucky dice roll. Or have a Stat with attribute that equals "Race Master" to play a secret racing map.*

### ActionResult

You can specify the resulting outcomes of an Action by defining the **ActionResult.** An **ActionResult** has a list of **ActionOutcomes.** Each **ActionOutcome** has a list of possibleOutcomes, meaning you can specify the likelihood of each possible **ActionOutcomeOption** being chosen as the **ActionOutcome**:

```motoko
public type ActionResult = {
    outcomes: [ActionOutcome];
};

public type ActionOutcome = {
    possibleOutcomes: [ActionOutcomeOption];
};

public type ActionOutcomeOption = {
    weight : Float;
    option : {
        #mintToken : MintToken;
        #mintNft : MintNft;
        #deleteEntity : DeleteEntity;
        #renewTimestamp : RenewTimestamp;
        #setString : SetString;
        #setNumber : SetNumber;
        #decrementNumber : DecrementNumber;
        #incrementNumber : IncrementNumber;
    };
};
```

#### What is weight?

You'll notice each **ActionOutcomeOption** has a **weight** field. The **weight** field for each potential outcome determines its probability of being chosen. A higher weight means a higher chance of manifesting that outcome.&#x20;

For example, if there are two outcomes, one with a weight of 1 and the other with a weight of 9, the latter is nine times more likely to occur, as the weights reflect their proportions in the total pool of outcomes.

If there is only one ActionOutcomeOption in the list of possibleOutcomes, it will have a 100% chance of occurring.

***

## Using Actions to Mint NFTs and ICRC tokens

You'll notice there are fields called **MintToken** and **MintNft** in the **ActionOutcomeOption**. These enable you to set a probability of Tokens or NFTs being minted as an outcome. The **World** canister does the minting by calling the NFT canister.&#x20;

Your **World** canister must be an admin of your NFT or ICRC canister in order to handle the minting, you can easily create NFT or ICRC collections and add admins using the [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) website.

Here's what the **MintToken** and **MintNft** fields look like:

```motoko
public type MintToken = 
{
    quantity : Float;
    canister : Text;
};
public type MintNft = 
{
    index : ? Nat32;
    canister : Text;
    assetId: Text;
    metadata: Text;
};
```

## Integration with Unity

The process of integrating the Action System with your Unity game is simple. When a player wants to do an Action, call this function in your **World** canister:&#x20;

```motoko
processAction(actionArg: ActionArg)
```

You'll notice it takes an **ActionArg** parameter that gives the **World** more context about the Action the player wants to call. Here are examples of **ActionArgs**:

```motoko
public type ActionArg = 
{
    #default : {actionId: Text; };
    #verifyBurnNfts : {actionId: Text; indexes: [Nat32]; };
    #verifyTransferIcp : {actionId: Text; blockIndex: Nat64; };
    #verifyTransferIcrc : {actionId: Text; blockIndex: Nat; };
    #claimStakingRewardNft : {actionId: Text; };
    #claimStakingRewardIcp : {actionId: Text; };
    #claimStakingRewardIcrc : {actionId: Text; };
};
```

The **World** canister will then lookup the **ActionConfig** using the **actionId** that is passed in **ActionArg**, and check for any custom **ActionPlugins** like verifying the ICP ledger or verifying an NFT was burned.&#x20;

Then the **World** will call the **processAction()** function in **UserNode**:

```motoko
processAction(uid : Text, aid : Text, actionConstraint : ?ActionConstraint, outcomes : [ActionOutcomeOption])
```

This function in **UserNode** will handle validating the **ActionConstraint**, processing the **ActionResult** outcomes, and apply those outcomes to their respective **Entities**.&#x20;

**processAction()** will return the result as an array of Entities that were affected:

```motoko
( [Entity], Text )
```

Then the **World** canister will read the tuple and handle minting any Tokens and NFTs if necessary.&#x20;

***

## Watch the Tutorial Video

Learn how to configure Actions in your World canister from the Game Launcher

{% embed url="<https://youtu.be/ANVfouAAO_Q?si=fLQRu6XChWbxRzbc&t=469>" %}


# Configs

## Configs for your World

**Configs** contain static metadata for your game. Developers can change the game Configs in the canister without needing a new game build.

Configs are stored in the **World** canister, and are fetched by the Unity client when the game starts.&#x20;

Configs look like this in code:

```motoko
public type Config = {
    cid : Text;
    fields : Map.Map<Text, Text>;
};
```

* **cid:** The config id for this Config
* **fields:** A hashmap of fields and values


# Test NFTs and ICRCs

## Test NFTs and ICRCs

You can test NFT and ICRC token collections in a test environment on the [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/).

Currently, the [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) supports testing **EXT V2 standard** NFTs and **ICRC-2** **standard** tokens.


# Unity Package

Get your Unity project set-up in minutes

## Everything You Need to Build a Game on ICP

A comprehensive Unity package with all necessary code for integration with ICP. It has all the necessary features for integration with a World, such as **login authentication, action system, config system, and database integration**. Just drag-drop it into your Unity project. We designed this package to streamline the game-building process, freeing developers from complexity so they can focus on crafting engaging and enjoyable gameplay.

\
Download the package from Github [here](https://github.com/BoomDAO/unity-template/releases).


# Login Authentication

Login authentication for blockchain-based games can be cumbersome. To solve this, we've collaborated with **@Gekctek**, the creator of ICP.NET, and **@filharvey.icp**. Together, we devised solutions for Unity ICP login authentication across multiple platforms: WebGL, iOS, Android, Windows, and Mac.

In order for Login Authentication to work, Unity communicates with a webpage that handles the NFID login. The Unity Template uses a default BOOM login webpage, but you can deploy your own login webpage with our [code on github](https://github.com/BoomDAO/examples/tree/main/login-webpage) if you'd like.

For WebGL, Unity uses custom HTML that displays an iframe of the login webpage to manage the login flow, securely transferring the identity delegation back to the Unity client. You can see this HTML template in the **Assets/WebGLTemplates/BoomTemplate** folder in the [Unity Template project](https://github.com/BoomDAO/unity-template).

On all other platforms, we utilize local websockets to ensure secure transmission of the identity delegation from the login webpage to the Unity client.

All these login flows are supported in the Unity Template.


# Canister calls with ICP.NET

**ICP.NET** is a library that allow apps built on .NET/C# to make calls to Internet Computer canisters.&#x20;

The **ICP.NET Agent** enables Unity C# code to call canisters directly, opening a realm of possibilities. And the **ICP.NET Client Generator** allows developers to auto-generate C# candid files for canisters.

**ICP.NET** was created by the awesome **@Gekctek** and the Github can be found [here](https://github.com/BoomDAO/ICP.NET).

The BOOM DAO Unity Template leverages ICP.NET to communicate to the Internet Computer.


# World Canister Integration

The **Unity Package** comes integrated with an example [World](/world-canister) canister.&#x20;

The **World** canister is the "game server" of your game. You can deploy your own World canister using the [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) website and configure it with actions directly on the website.

The Unity Template has examples for how to interact with the [Actions](/world-canister/actions) and [Configs](/world-canister/configs) of your World canister.


# Test Shop

We've built a test whitelabel Shop in the Unity Template for developers to learn by testing with fake NFTs and tokens.

Offers in the Shop are [Actions](/world-canister/actions) that simulate [loot box](https://en.wikipedia.org/wiki/Loot_box) rewards. In a loot box, there are various bundles of rewards with different weighted outcomes. So each time you purchase an Offer, you may receive a different bundle of items.&#x20;


# Test Marketplace

We've built a test whitelabel NFT Marketplace in the Unity Template. It is purely for developers to experiment and learn with fake NFTs. It is not used in a production environment. The NFT Marketplace currently only supports a single NFT collection at a time.

Feel free test NFTs on the [Game Launcher](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/) website, and configure the Unity Template to test them in the marketplace.

The NFTs use the EXT V2 standard.


# Leaderboards

Learn how to use the Leaderboard Standard

The Leaderboard Standard leverages the World Protocol to store flexible and composable data that any game or dapp can read easily.

## Connect with Us!

First of all, if you are a game developer looking to setup a Leaderboard or use BOOM DAO tooling for your game, please reach out to us in the [BOOM DAO Discord](https://discord.gg/FJ7H3s35). We would love to have a call with you to know the needs of your game and assist you in setting up your World canister for the first time. We will even do all the work to set it up for you, so all you have to worry about is writing your Unity code :)

## How to Set-Up a Leaderboard?

To setup a Leaderboard in your game, first you must deploy a World canister from the Deploy Worlds tab on the [Game Launcher website](https://awcae-maaaa-aaaam-abmyq-cai.icp0.io/).

Once you have a World canister deployed, you can tap the "Configure World" button to open the Candid UI and start configuring your World.

To configure a Leaderboard, go to the createAction() function in the Candid UI and configure an Action that looks like this:

<figure><img src="/files/dmBKpY1in2NkyCYEweZd" alt=""><figcaption></figcaption></figure>

The above Action will increment the "score" column of the user in the Leaderboard by 1 whenever they call the Action. You can create any amount of columns in your Leaderboard with any name, simply add another updateEntity outcome and specify a different field name.

With this flexible data format, any type of data can be represented in a Leaderboard. And certain actionConstraints can be applied to prevent a user from scoring on the Leaderboard until they've met certain criteria.&#x20;

For example, if you want the user to complete a race or win a battle before scoring a point on the Leaderboard, then simply check the actionConstraint checkbox and specify an entityConstraint that they must have a certain "wonBattle" or "finishedRace" Entity before being able to score points on the Leaderboard.

The reason the targetAction is filled out, but not the callerAction, is that Leaderboard entities are being written to the "UserNode" canister associated with the World canister ID itself, and not a user ID. We call this the WorldNode canister. \
\
When a client is calling this Action, the client will specify that the targetPrincipalId is the World canister ID. This way, all Leaderboard data is stored in the WorldNode canister associated with the World canister ID, and can be scalable to the needs of the game.

Configuring a Leaderboard action is as simple as specifying a `targetAction` with an outcome of `incrementNumber` or `setText`. And then specifying a `gid` (groupId) with the name of your Leaderboard. The `eid` (entityid) should be the user's principal id. To configure this, use the `$caller` keyword in the `eid` field and it will insert the caller's principal id at runtime.

The Entities in the Leaderboard group represent each user row of the Leaderboard. By leveraging Entities in the World Protocol, Leaderboard data follows a standard format that is universally readable. One game can even write to the Leaderboard of another game if it has permission to do so.


# Release Notes

## April 23, 2024

* Launch of the first gaming quest on BGG, the Paws Arena game quest.
* Launch of the Plethora game and gaming quests.
* Added new support for BOOM rewards and GHOST rewards.
* Wallet support for GHOST token.
* Added support for Airdrop Points and new leaderboards for every game.

## April 12, 2024

* Initial launch of the BOOM Gaming Guild onboarding phase.
* Enable users to verify emails they used to sign up for the airdrop.
* Enable users to verify phone numbers.
* Initial quests to have the user set a username and profile picture.
* Initial leaderboard for all guild members according to Guild XP.

## March 13, 2024

* Various bug fixed and upgrades to the World canisters in preparation for BOOM Gaming Guild launch
* Updating code related to BOOM Gaming Guild quests and action history functionality
* Backend support for daily quests

## February 12, 2024

* Major upgrades to support the launch of Gaming Guilds
* We now store tx history of all actions per user in the World Protocol
* Games can leverage this history to create quests or validate that a player has a certain history of actions
* Added actionStartTimestamp that lets devs specify a timestamp in the future when an Action will be enabled
* Added UpdateAction outcome type and DecrementActionCount outcome to allow for Actions that result in the resetting of another the action to allow the player to call it again
* Improvements and refactors to code logic when executing an Action in World canisters

## February 1, 2024

* Refactor World canisters to use ICRC-1 interface for ICP transaction validation since ICP Ledger now supports ICRC-1.
* Bug fixes for getAllUserEntities function

## January 29, 2024

* Bug fixes for all World canisters and upgrade World Deployer to use latest version
* Bug fix for Game Launcher website frontend canister

## January 10, 2024

* Bug fix for World Hub canister to allow outdated cached data in World Hub to be cleared through an SNS proposal

## December 14, 2023

* Major upgrade for on-chain multiplayer to include features for compound actions, multiple action arguments, and more flexible Configs.
* World canisters are now controlled by the World Hub and upgraded automatically through SNS proposals.
* Changes to Unity Template to enable it to handle onchain multiplayer features
* Improved ActionConstraints to encompass multiple game mechanics and systems
* Better support for data migration across canister upgrades

## November 7, 2023

* Major refactor and code changes for the On-Chain Leaderboard Roadmap Milestone
* Learn more about the On-Chain Leaderboard feature [here](/leaderboards)
* Updates to Actions and Entities to support storing game data in a UserNode canister associated with the World canister ID. This canister is referred to as a "WorldNode" canister.
* Deprecation of the PaymentHub in favor of storing NFTs and Tokens directly in the World canister and doing payments directly in the World canister.
* Refactor of ActionPlugins to be converted to ActionConstraints instead. NFT/ICRC/ICP transfers are handled using ActionConstraints now. This simplifies the development experience and streamlines the processAction() function in the World canister to only take two parameters.
* Updates to the BOOM EXT V2 standard to support NFT transaction history so that BOOM DAO game projects can validate NFT transfers in-game.
* Updates to the ICRC-3 standard to support ICRC transaction history so that BOOM DAO game projects can validate ICRC token transfers in-game.

## September 30, 2023

* Major refactor of the World Protocol to give game developers more flexibility in how they define their data structures in the protocol database.
* **Actions** have been renamed to **ActionStates**.&#x20;
* **ActionConfigs** and **EntityConfigs** have been renamed to **Actions** and **Configs** respectively.&#x20;
* **Entity** now contains a Hashmap of fields and values instead of the static fields previously (eg. quantity, attribute, expiration). This allows for devs to define "fields" in the Hashmap with any name and any value. Entity can hold much more flexible data as a result, and almost anything can be defined as an Entity.
* **EntityConfig** is renamed to **Config** and now contains a Hashmap of fields and values. This enables Configs to be much more flexible to contain data for anything. This is also why they were renamed, because devs can use Configs to define metadata for anything, not just Entities.
* Developers can opt-in to upgrade their World canisters to the latest BOOM DAO version in the "Upgrade World" tab when managing a World on the Game Launcher website. This is the first ever developer tooling that helps devs upgrade their self-custodial smart contracts.
* ICP.NET library fixes for the new query signatures that DFINITY introduced. As well as support for composite queries.
* Fixes and improvements to the Unity Template including making it simpler to use and loading NFTs and ICRC tokens by specifying them in Configs instead of hardcoding them.
* Upgrades to the custom Candid UI that BOOM DAO has built to enable game developers to edit their World canisters easily. New improvements allow devs to edit their Actions and Configs directly on the Candid UI and push the edits to the World canister immediately.


