Retrofitting a Blockchain Powered Economy Into Ultima Online
Retrofitting a Blockchain powered economy into Ultima Online
What we will be looking at today is integrating blockchain into an existing game using Blockmason Link. The game we have chosen today for our example is the 1997 classic MMO Ultima Online. Ultima Online is a great choice to work with because it has lots of open source servers and a very strong player-run community with a robust economic system.
Players can trade items, walk around, and interact with the game and with one another.
In this example, a player approaches an in-game vendor to buy an item. In Ultima Online, multiple items of the same type can stack in groups, and these groups can then be split into subgroups.
Like many games, there is an in-game currency system that uses gold coins to purchase various items from vendors.
Today, we are going to create an alternate currency called Platinum.
Players will be able to trade in that currency within the game, but, unlike standard in-game gold, P
Pretty cool, right!
You can hand somebody cryptocurrency in the game that will actually transfer cryptocurrency to that person on the blockchain. Today, Blockmason Link is going to help us make this possible.
So here is what we are going to be using
We have recently released our SDK for .NET, which allows any developer using any .NET application or library to consume Blockmason Link. It’s easy to install and use.
We are going to start by getting the Blockmason Link .NET SDK. It’s freely available on Nuget, and you can add it to your own .NET projects by adding the package reference element. In Visual Studio, you can just find the package Blockmason Link, and just use the latest version for that.
You can find the source code here at github.com/blockmason/link-sdk.net
We are also going to be using Blockmason’s product Link
To start, we have created a smart contract written in Solidity and a new project on Link. We are going to call our server Platinum within Blockmason Land. Our Smart contract does most of the basic functions you would expect of a token. Let’s take a look.
This contract allows you to check how many tokens are in the total supply, the balance of any player, mint new Platinum, burn Platinum from the supply and transfer Platinum between players.
So, let’s take a look at the code in our server.
You can locate our core Link integration in a file called Platinum Ledger. Here you will find that there is a thin wrapper for the Link project we made earlier, with functions like the ones we just looked at, balance, burn, mint, and transfer.
We are then going to use the Blockmason Link SDK to get an instance of our project and call our transfer function with these parameters.
We have also created an item within the game that behaves exactly like the piles of gold we showed earlier, except that it keeps track of which player is entitled to that P
For every item of Platinum in the game, we need to know what player the item belongs to, not just who is currently in possession of it.
We’ve added some hooks so that whenever a pile is split in two, the owner is set on both of them. We created a hook that whenever some Platinum gets added to a container, we find the owner of that container. If that owner is different then the owner of the Platinum, then we invoke a crypto transfer. This will make sure that the blockchain has the new player’s ownership on it. And finally, when Platinum is spent within the game, we burn that from the supply. This creates an economic “sink”, removing currency from the economy. We also need a “faucet”, allowing new currency to enter the economy. Typically, players would earn this through engaging with the game, but for now, we will build a simple command that game staff can use to reward a player with newly minted Platinum coins.
Finally, we need a place for players to spend that Platinum, so we created a vendor we’ll call the “
Let’s now take a look and see what it looks like running in Ultima Online. We are going to begin by taking a few actions. Our staff member Mason is going to create some P
Let’s open her bank box, ah yes, and there it is.
Let’s double check the blockchain and confirm
Alice can take that Platinum, put it in her bag and bring it to the in-game vendor “The
Finally, to transfer ownership, Alice is able to take a few pieces of Platinum and trade them to Mason.
And that’s it! So, using the smart contract based APIs created by Blockmason Link we are able to easily integrate a whole new blockchain powered currency system into a 20+-year-old game that allows players to purchase unique in-game items.
This is a simple example of some of the cool things you can do in a game, now that Blockmason Link makes blockchain development much easier. You could, of course, create a much more complicated and robust economic system than our example, but those ideas we will leave up to you.
Thanks for checking out how we retrofit a blockchain-powered economy into Ultima Online. Do you have an
Link is the first decentralized functions-as-a-service (FaaS) platform, bringing the convenience and familiarity of conventional web APIs to developers without the vendor lock that you get with products like AWS Lambda or Google Compute Engine, or the complexity of interacting directly with blockchain platforms or containerization solutions, or the cost of investing in deploying applications on typical cloud infrastructure providers. Link frees developers to pursue more creative and innovative projects and get them to market rapidly.