Using Polkadot to power the future of online multiplayer games

Thanks to my colleague Iggy (Web3 Foundation) for creating this awesome visualization.

Recap of problems identified

In my previous blog I outlined why we might want to put the entire game state on-chain. I alluded to the ability to verify actions and to also improve item ownership. Data that is on-chain should be easy to verify, which means that player actions will be easy to verify.

  • Ownership of items is poor in the current model of online games.
  • Action verification is weak and highly asynchronous.
Cross-chain interaction with Polkadot (Source)

Rogue: looking backwards to move forwards

Given the scalability issues that we saw when CryptoKitties hit peak popularity, it probably sounds like a wild suggestion to put the entire state of a game on-chain. However, I believe that it is possible if we employ the latest techniques in blockchain scaling.

Rogue. A classic game from 1980 (Source: Wikipedia)

Note on graphics

Graphics don’t necessarily need to be stored on-chain. A simple set of sprites could certainly be stored on inside the game client. Obviously, they shouldn’t be sent those via extrinsics (transactions). If players use essentially use the same client then they will see what other players see. Minor modifications to graphics shouldn’t really affect gameplay. What matters is that players can verify each other’s movements and actions.

Game State: what does it look like?

I expect the game state to be a combination of the world state (the game world in which we play) and the aggregation of all character states. Potentially, we just need to save state proofs rather on-chain: i.e. in an encounter between two players, they must be able to check that their respective characters are valid.

  • Character identification (e.g. GUIDs, name)
  • Character Stats (e.g. Position, Speed, Strength, etc)
  • Items (e.g. weapons, armour / clothing, game currency)
  • Optional: magic spells and similar abilities.
  • Hash of the current character state
An example of character stats in Ultima Online (Source)

Actions are state transitions

When the game world is updated or a player’s state is changed then these updates will be stored on chain. Any update to a blockchain’s state is done via a state transition function. This is the expensive part of having a game that stores the state on-chain.

No gas needed!

No gas needed! (Image source)

Player Movement

I think handling player movement will be one of the hardest challenges to get right. Potentially, movement will be turn based in the first iteration of such a game, but ultimately I don’t think it is strictly necessary. Ideally, a player’s movements appear smooth and fluid in the game’s graphics.

Illustration of dividing up a path into discrete chunks.

Combat, levels, and experience

As mentioned, game stats will be stored on-chain. Experience points and the progression of stats will also be stored on-chain. Updating player stats involves updating the game state and is performed by the transition function. Combat relies upon player movements being accurate and valid, so it is necessary to solve the problems with movement before working on combat.

Cross-chain trading of loot

Once loot has been collected after combat, and the blocks finalised, it will be possible trade these game items to other players. Moreover, with cross-chain transactions it would be possible to trade assets across chains and therefore across games.

Visualising cross-chain interoperability (Source)

Up next….

In the next piece I will discuss further the game state, in particular the game world which is a part of the game’s on-chain state. There will also be consideration for incentivisation: both for hosting the game data and paying for future development work.

About me

Currently, I work at the Web3 Foundation, covering numerous responsibilities (such as security and communications). This blog is of a personal nature. It just so happens that my hobby aligns with work.

Questions / Comments?

You can create a reply to me here on Medium, or reach out to me on Twitter: @EAThomson.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store