1

I am fairly new to solidity, and i am exploring decentralized game development.

This said, let us go more into the details. Imagine i want to develop a 2d game, where you can buy for example assets, like a weapon or a potion or anything like this.

I can write this game let's say in ASP.net, combined with HTML5, JavaScript and Ajax, and it would work just fine in a webbrowser.

But is it possible to make this game from that point communicate with the Ethereum blockchain to exchange data and make transactions, like the purchasing example that i explained before?

If yes, where is the best way to start learning this? Does anybody have experience with this or can anyone share some good resources to get me started?

Thank you so much for your time and help!

0

I believe you might have figured out the technology for your online game (Unity, Phaser js, canvas , etc). Let us assume in your game player will earn points(tokens) every time he/she clear any level and at the same time player can buy points(tokens) using Ether.

Using those tokens user can make in app purchase where player can buy weapons , skip level , etc.

You would need a payable smart contract and that contract should hold large amount of tokens and you have to implement 2 methods buyTokens and buyTokensWithPoints. Your player must have a Ethereum account with few ethers in it.

  1. Develop a Smart contract using Solidity
  2. Compile the Solidity code to Binary -> ABI (Application Binary Interface)
  3. Deploy the ABI to Ethereum main netwrok
  4. Interact with Smart contract using web3 js and ABI

I guess you may need to run a light weight ethereum node to handle all the player transaction or you can use Metamask if the game is browser based.

You can refer to Metamask architecture for how they are integrating with Ethereum blockchain.

Here the role of the smart contract is simply to transfer tokens if the condition is met (Level 1 - 5 Completed -> 100 Tokens, level 5 -10 completed -> 500 Tokens)

In app purchase using those token is up to your game logic and scoring system. enter image description here

0

It is possible. Your best bet would be to look at web3 https://github.com/ethereum/web3.js/

You can commit transactions and utilize smart contracts. I would look at other open source projects like my ethereum wallet for examples. https://github.com/MyEtherWallet

The one issue is that you will need to provide users a way to login which can cause a security hurdle

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.