Purpose
Relentless is an adrenaline-pumping trading card game for mobile and desktop. The game is completely free and now it's open-source too. This document will show you how to spin up your instance of Gamechain, build the Relentless smart contract, and run the game in Unity. Lastly, we'll show you how to generate the binaries for macOS, Windows, Android, and iOS.
Getting Started
Install Go by following the instructions from the Go Getting Started page.
Create the directory in which we're going to install dependencies and build the game:
mkdir -p ~/go/src ~/go/bin ~/go/pkg
- Create an environment variable called
GOPATH
and append it toPATH
by adding the following lines to your~/.bash_profile
file:
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
- Reload configuration:
source ~/.bash_profile
Install the Protocol Buffers for Go by following the instructions from this page.
Download the
protoc
binary v3.9.1 for your operating system from this page.Extract the zip and then:
- copy the
bin/protoc
file into/usr/local/bin/
and - copy
include/google
into/usr/local/include/
.
- Now, cd into
~/go/bin
and download theloom
binary by entering the following command:
curl https://raw.githubusercontent.com/loomnetwork/loom-sdk-documentation/master/scripts/get_loom.sh | sh
- Install
go-loom
, our Go package for building Go Smart Contracts for the Loom SDK:
go get github.com/loomnetwork/go-loom
- Clone the Gamechain repo with:
cd ~/go/src/github.com/loomnetwork/ && git clone https://github.com/loomnetwork/gamechain
- Install the
dep
dependency manager:
go get -u github.com/golang/dep/cmd/dep
- Building the
gamechain
binary requires you to authenticate to GitHub usingssh
. Follow the instructions from this page to generate a new SSH key. Next, refer to the instructions on the Adding a new SSH key to your GitHub account for configuring GitHub to yse your SSH key.
Build the Relentless Smart Contract
To build the Relentless smart contract, enter the following commands:
cd ~/go/src/github.com/loomnetwork/gamechain
make deps
make
Spin up Gamechain
In a new terminal, run the following commands:
loom init
cp zb.genesis.json genesis.json
loom run
Setup the Oracle, Create an Account and Run Transactions
Follow the instructions from the GameChain GitHub page to create an account and run transactions.
The Front-end
Download Unity 2018.4.1 from this page and install it
Fire up a terminal,
cd
into your projects directory, and clone the Relentless repo:
git clone https://github.com/loomnetwork/Relentless/
Start Unity and point it to the directory in which you cloned the Relentless repo.
Configure the backend endpoints by editing the
Assets/Scripts/App/Settings/BackendEndpointsContainer.cs
:
using System.Collections.Generic;
namespace Loom.ZombieBattleground.BackendCommunication
{
public static class BackendEndpointsContainer
{
public static readonly string CurrentStagingDataVersion = "v26";
public static readonly IReadOnlyDictionary<BackendPurpose, BackendEndpoint> Endpoints =
new Dictionary<BackendPurpose, BackendEndpoint>
{
{
BackendPurpose.Local,
new BackendEndpoint(
"https://stage-auth.loom.games",
"ws://<backend-ip-address>:46658/queryws",
"ws://<backend-ip-address>:46658/websocket",
"https://stage-vault.delegatecall.com/v1",
CurrentStagingDataVersion,
false,
false,
false,
PlasmachainEndpointConfigurationsContainer.EndpointConfigurations[BackendPurpose.Staging]
)
},
{
BackendPurpose.Development,
new BackendEndpoint(
"https://stage-auth.loom.games",
"ws://<backend-ip-address>:46658/queryws",
"ws://<backend-ip-address>:46658/websocket",
"https://stage-vault.delegatecall.com/v1",
CurrentStagingDataVersion,
false,
false,
false,
PlasmachainEndpointConfigurationsContainer.EndpointConfigurations[BackendPurpose.Staging]
)
}
};
}
}
- Start the game by opening the
APP_INIT
scene.
Build the game
From the Windows
menu, select AssetBundle Browser
and go to the Build
tab.
MacOS and Windows
Select the platform, the output path, and then check the Copy to StreamingAssets
checkbox. Lastly, press the Build
button.
Once done, make sure that the asset bundle files are correctly placed in StreamingAssets/AssetBundles/
Android
Go to
File
->Build Settings
and selectAndroid
from the list of platformsClick on the
Open Download Page
and download the installer.Run the installer. Once the installation is finished, restart Unity.
Go to
File
->Build settings
. Then, selectAndroid
from the list of platforms.Next, click on
Player Settings
button. Go to thePlayer Settings
->Publishing Settings
section and select a keystore.Go back to the
Build Settings
window and clickBuild
iOS
Go to
File
->Build Settings
and selectiOS
from the list of platformsClick on the
Open Download Page
and download the installer.Run the installer. Once the installation is finished, restart Unity.
Go to
File
->Build settings
. Then, selectiOs
from the list of platforms.Go back to the
Build Settings
window and clickBuild
This will generate an XCode project. Use XCode to compile and sign the iOS app. See this page for more details on the structure of the iOS project.