Home - RenegadeMinds/testbed GitHub Wiki

Overview

XAYA provides a convenient solution for developers to put their games up to 100% on the blockchain. The following materials can help you get started quickly.

The XAYA blockchain is a decentralised data store. There are 3 main components to a XAYA application or game.

  1. XAYA daemon
  2. Game state processor
  3. Front end

3 main parts

The XAYA daemon (xayad) is the software that interfaces with the XAYA blockchain. It has a JSON-RPC interface to create accounts, make moves in games, etc.

The Game State Processor (GSP) is where moves are processed and new game states are created.

The front end is where the game is displayed for players. It consumes game states. All the blockchain goodness is invisible to them.

We'll look at the different parts in order, gradually building up to the point where you can confidently create your own games on the XAYA platform.

Step 0: Blockchain Basics

If you're not familiar with what a blockchain is or how cryptocurrencies work, we recommend that you read Blockchain Basics. This will provide you with a high-level overview of what a blockchain is. The shortest answer is that it's a secure decentralised data store. However, there are many benefits to it that are non-obvious.

Still, while blockchain is just a data store, XAYA is much, much more than just that. It's a complete decentralised gaming platform. How and why that is will become apparent as you progress through the various tutorials and documents here and see how XAYA enables decentralised autonomous worlds.

Step 1: xayad

Read and complete the Step 1: xayad tutorial here before you do anything else. It will give you a high-level overview and understanding of important fundamentals that you must understand in order to progress with XAYA.

Step 2: The Game State Processor

In the Step 2: The Game State Processor tutorial here we learn about the XAYA Game State Processor (GSP) and its relationship to other components.

Step 3: libxayagame

The core of the GSP is libxayagame. It does much of the heavy lifting for blockchain operations, and nicely isolates developers from that complexity so that they can focus on creating their games.

Read libxayagame Component Relationships for a high-level overview of libxayagame and how it interacts with other components.

In order to stay up-to-date with the latest improvements and feature additions, it's recommended to compile libxayagame on your own. Using git will keep your libxayagame code fresh with the latest version and compiling is very simple with the provided scripts in the "HOW TO" documents below.

See here to compile libxayagame in Windows or here to compile libxayagame in Ubuntu.

Step 4: Run xayad for Games

In Step 1 above we learned about the XAYA daemon, xayad, and how to issue some RPC commands to it. There was quite a bit in there.

Running xayad for Games is very short and well worth the 3 minutes it takes to read to refresh your memory and get a solid grasp on just what the most important options are for you to run xayad properly.

If you encounter any errors while trying to run a game or program, the first thing to check is whether or not xayad is running properly.

Step 5: Hello World!

Hello World is a simple XAYA game that you can build. Once you've finished, you'll have mastered 90% of everything you need to know to build your own games on the XAYA platform.

Hello World in C++ is a long, thorough tutorial where you code every line and where every line is explained in detail.

Hello World in C# is a quicker tutorial that focuses on the bare basics of the XAYA platform. Pre-compiled binaries for libxayagame are included with the sample solution so you can run it immediately, set break points, and dive straight into the code. The tutorial itself includes videos and walks you through all the most important aspects of building a game on the XAYA platform without getting into too much nitty-gritty details. For those details, the code is extensively commented, and you can study those on your own.

Keep in mind that BOTH those versions of Hello World are for THE EXACT SAME GAME and if you want to play the game, you can equally use either one.

You could easily write your own version in Python, Ruby, or any other modern programming language.

Step 6: Mover

Now that you've got some experience with the platform, it's time to look at implementing game logic. Hello World didn't have any significant game logic, but with Mover we have some very simple game logic to examine.

Start with the Mover Sample Game Overview. This is a high-level overview to explain the various moving parts and concepts behind Mover.

Once you've completed that, you can dive into the code.

Again, we have multiple tutorials for you, depending upon your preferences.

The Mover Console Tutorial is a C# console application with a code walk-through. Much of what is in the code walk-through you've already seen in Hello World, so those portions you can skip. The main content to focus on is how the game logic is implemented in the 3 callbacks.

The Mover Sample Game in C# with Unity tutorial is substantially the same as the Mover Console Tutorial, but adds in a front end with Unity. This is closer to a "real world" example of a game. Again, as above, the main content to focus on is how the game logic is implemented in the 3 callbacks.

Both the Mover console and Mover Unity games are the exact same game, just as with Hello World above. You could easily write your own Mover game in Java, Ruby, Python, or any other modern programming language just by porting the code for the callbacks properly and then wiring up libxayagame as described in other documents.

Next...

The Guides and Tutorials section below provides high-level overviews of the various documents and tutorials. Skip to there if you're already confident.

Things to Skim Quickly

Skim over the following documents. Don't worry if you don't understand everything. A quick skim will familiarise you enough so that you'll find new material easier to follow as you progress through various tutorials and documents.

Background and Additional Information

For some background information, read through this section to see what parts of XAYA you're most interested in.

XAYA Specifications

Reading the XAYA Specifications will give you a high-level overview and familiarise you with various concepts and details. This is highly recommended reading and is considered reference material.

Wallets

Wallets are critically important. Read the Wallets section of the XAYA Electron wallet help for a quick high-level overview if you're not already familiar.

The XAYA CLI

Many tutorials use the XAYA Command Line Interface (xaya-cli). Read up on xaya-cli here. It's a command line interface for you to easily send RPC commands to the XAYA daemon (xayad).

XAYA RPC Methods

Next, read about XAYA RPC Methods. You'll need to know how to send RPC calls to the XAYA daemon. This will get you up to speed quickly.

libxayagame: The Core Engine for Games

The libxayagame Component Relationships shows you the basic architecture. It details how your game logic and front end interact with XAYA.

Start Coding with Hello World

If you skipped Step 1 and Step 2 above, well, it's time to get started coding! Let's jump into the deep end!

The Hello World tutorials are good templates for you to learn and begin coding your own games. Everything you need for a game is in there. (More complex games require more, but for simple games, Hello World is a decent template.)

Start with Hello World! in C++ or Hello World! in C#.

NOTE: The Hello World tutorials do not have any significant game logic, which makes them very easy to follow. Game logic is the part that game developers create.

Hello World in C++

The Hello World! in C++ tutorial is a thorough walk through for you to create a functioning game. This is strongly recommended for all developers.

Hello World in C#

Hello World! in C# includes a fully functional example project and several videos. In this tutorial, you'll learn how to wire up a working XAYA game.

Mover

The Mover Overview document provides a high-level view of what Mover is and does.

Once you've read that, try one of the Mover tutorials. The console MoverSharp tutorial demonstrates simple game logic, but does not get into updating the front end.

The Mover in Unity tutorial goes over much of the same material as the console version, but adds in updating the front end. This is ideal for Unity game developers to use as a template.

Developer Support

If you have questions, visit the XAYA Development forum. You can ask questions and get answers there.


Guides and Tutorials

The following are quick decriptions of the various documents and tutorials mentioned above. You can read through here to get a high-level overview.

For game developers, this is the first place you should look to get started with XAYA game development. The sections below are loosely arranged in order. You can read them from top to bottom, but feel free to skip around.

Additional resources will be added on an ongoing basis.

Blockchain Basics

If you're unfamiliar with blockchain technology, Blockchain Basics will give you a quick overview and highlight some important aspects. This is a quick, high-level overview and far from exhaustive. If you are already familiar, you should skip this.

XAYA Specifications

The XAYA Specifications repository contains technical specifications and design documents that describe how the various components and layers in the ecosystem interact. In particular, important topics are:

The specifications are required reading. Other documents will refer to specific sections of the specifications.

NOTE: The specifications contain some difficult material. You do not need to understand it all at once. However, as you progress you should refer back to it from time to time. If you don't understand something, just move on. You can also post in the XAYA Development forums.

XAYA RPC

XAYA uses RPC (Remote Procedure Calls) to communicate with the XAYA daemon (xayad). The daemon contains many of the same methods that you may already know from Bitcoin. It also contains methods unique to XAYA. The documents here will help you with those unique methods and provide some additional guidance on their purpose.

XAYA is language agnostic, so you can use any language you wish so long as it is capable of making RPC calls.

XAYA RPC Methods

The XAYA RPC Methods document describes several of the most useful RPC methods and provides examples. It is language agnostic and you should read this first.

RPC Windows C# Tutorial

The RPC Windows C# Tutorial uses a 3rd party library to demonstrate using several XAYA RPC methods. A sample Windows Forms application is provided with comments to assist you.

libxayagame

The libxayagame library lets developers focus on building blockchain games without worrying about any of the inner workings of the blockchain, such as reorgs. That is, libxayagame does some very, heavy, heavy lifting for you.

Instead, it provides a simple framework for you to code your games on top of the XAYA platform.

Once you have libxayagame wired up, you only need to implement 3 callback methods. The Mover example shows you how to do this.

Code ninjas and rock stars may enjoy browsing through the code or code documentation available here.

Component Relationships

The libxayagame Component Relationships document provides a high-level overview of the component relationships and information flows when using libxayagame. While it aims to explain the Mover sample game, other scenarios are briefly outlined.

How to Wire Up libxayagame in C#

This very short tutorial explains how to add libxayagame to a project.

Hello World!

This is a step-by-step "Hello World!" tutorial and a good place to start. Make certain that you've covered the "getting started" basics first.

Mover Sample Game Overview

Mover is an extremely simple game that uses the libxayagame library. The goal of Mover is to help you easily build your game.

Both libxayagame and Mover are written in C++. The Mover sample includes a game test written in Python. For more information, see the Mover Sample Game Overview tutorial.

Mover Sharp - A C# Implementation

MoverSharp is a truncated C# implementation that does not allow user input. It merely displays moves.

This tutorial illustrates how libxayagame is wired up for Mover and then explores game logic on the XAYA platform.

Mover in Unity

For C# developers, the Mover example has been ported to C# along with code to wrap the libxayagame C++ library.

The Unity project provides a front-end GUI for Mover. The wrapper and additional code implement the Mover game itself.

Regtestnet

Regtestnet is what you should primarily use during development instead of mainnet or testnet. At some point you may wish to move your testing to testnet, but that shouldn't be your first choice.

The regtest option gives you a private XAYA network where you have complete control.

You can instamine CHI at will and control exactly when and how blocks are mined. You can invalidate blocks, and undo that.

See the "Getting Started with Regtestnet" tutorial for more information.

Getting Started with xaya-cli

The XAYA Command Line Interface lets you easily interact with the XAYA daemon and XAYA wallets. It's used extensively in various tutorials. This tutorial introduces xaya-cli and gives examples that you can practice with to learn it very quickly.

XAYA Electron Wallet Help

This is end user documentation for the XAYA Electron wallet.