MMO's are almost always run on large scale servers owing to the sheer computation cost of pinning down the various characters in the world. Peer to peer systems have, so far, been ineffective, simply because it is too easy to cheat. In this project, I present an implementation of the 'tangle' blockchain, widely used by the IOTA cryptocurrency, as a fast but secure P2P implementation of a massively multiplayer game. In addition to being more secure than the typical Server-Client based MMOs, this model will also allow for indie and open-source developers to branch into the MMO market, since the upfront costs of putting up a centralized server is basically non-existent.
The Building Blocks
Python 3.6.1 : The answer to every unsolved problem in the universe
Flask 1.2.1 : Server stuff
hashlib : Self Explanatory
PyGame : For the cool demo example.
Arch Linux : Best Linux distro ever ;-)
What it does
blockchain_roguelike creates a peer to peer network similar to the 'Tangle' architecture used by the IOTA cryptocurrency. In this case, each item and monster object in a given instance is generated with a hash and sent to the player's system. The system then does a simple POW to generate the overall hash of the instance. The server then sends the Monster, Instance and item hashes to another randomly chosen instance. If there is any discrepancy, the server flags the player's instance as invalid, thus nullifying the effect of cheating.
How I built it
Lists in Python made the task of building the tangle chain really easy. Once this was complete, I wrote a quick turn-based empty 2D instance using PyGame to demonstrate the effect of sending a mismatched hash combo.
This was my first time building a blockchain. As far as I know there isn't really a good tutorial on building a tangle-chain. I had to follow the video explaining the architecture and build my own structure from scratch. Testing was also an issue since tangles become more stable with an increased number of nodes.
Accomplishment I'm proud of
I'm still in disbelief that the thing ran on the first go! xD
The system needs to be improved to incorporate aspects of the Server-Client model -- in the interest of reducing lag -- while also maintaining the anonymity of the blockchain. I have a decent idea in mind, but suspect that it will take a lot of effort to get this next step implemented.