Skip to content
Ryan edited this page Nov 1, 2022 · 41 revisions

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.

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

  2. 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.

  3. Hello World! with SQLite is a C++ console application tutorial that shows you how to use xaya::SQLiteGame. Before you start on your own game, you should read this. SQLiteGame makes developing your blockchain game far easier than using a CachingGame. Further, you can build MASSIVE game worlds with SQLiteGame. This is most likely how you will choose to make your game.

Keep in mind that ALL 3 of these Hello World implementations are for THE EXACT SAME GAME and if you want to play the game, you can equally use any of them.

Further, 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.

  1. 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.

  2. 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...

If you've completed the above steps, you're in a very good position to begin programming your own blockchain-based game.

Make certain that you've reviewed the tutorial on SQLite as that is probably the best choice for you to create a game on the XAYA platform.

The next thing to do is to explore other documentation linked in the sidebar navigation. There's a wealth of information there and most is very easy to get through quickly.

Developer Support

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


Clone this wiki locally