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
GOPATHand append it toPATHby adding the following lines to your~/.bash_profilefile:
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
protocbinary v3.9.1 for your operating system from this page.Extract the zip and then:
- copy the
bin/protocfile into/usr/local/bin/and - copy
include/googleinto/usr/local/include/.
- Now, cd into
~/go/binand download theloombinary 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
depdependency manager:
go get -u github.com/golang/dep/cmd/dep
- Building the
gamechainbinary 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,
cdinto 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_INITscene.
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 Settingsand selectAndroidfrom the list of platformsClick on the
Open Download Pageand download the installer.Run the installer. Once the installation is finished, restart Unity.
Go to
File->Build settings. Then, selectAndroidfrom the list of platforms.Next, click on
Player Settingsbutton. Go to thePlayer Settings->Publishing Settingssection and select a keystore.Go back to the
Build Settingswindow and clickBuild
iOS
Go to
File->Build Settingsand selectiOSfrom the list of platformsClick on the
Open Download Pageand download the installer.Run the installer. Once the installation is finished, restart Unity.
Go to
File->Build settings. Then, selectiOsfrom the list of platforms.Go back to the
Build Settingswindow and clickBuildThis 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.