New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Fully on-chain games: How we'll make it happen, and why they're a game-changer with Nicolas Laurent

Ethereum DenverMon, Oct 9, 2023, 12:00 AM

"This talk will have two parts: The first part motivates fully on-chain gaming, and explains their potential: from permissionless composition of game assets and even gameplay elements, leading to the creation of a player-directed (and player-owned) ecosystem of game mods, touching on the social implications of gaming in a universe where assets can be freely composed. The second part explains how we can onboard gamers (especially non-blockchain-native ones) onto these games, and how we can improve their UX. We'll describe techniques such as the use of session keys to avoid excess wallet interaction, limited-scope off-chain trials, the use of app-chains, as well as caching and indexing architectures and frameworks." Nicolas Laurent NFTs + Metaverse, + Gaming Stage

Transcript

Uh, today I'm going to give you a talk on fully on-chain games. So, it's going to be a little bit introductory. If some of you are like experts, might seem simple, but experts uh will be able to fact-check me and ask interesting questions. So, I'll try to open up some space for questions at the end. So, basically why do we want on-chain games?

Are we crazy? Do we hate God? What's going on there? So, some good use cases. And then, assuming I convince you that on-chain games are a cool thing that we want, how do we make it happen?

What are some like choke points that are holding us back from the the world of fully on-chain games? Uh all right. So, first of all, why do we put anything on chain? When you are pitching a project to someone, the first question that will come is does it need to be on the blockchain? And uh this is especially true with uh my friends that are not in the blockchain.

They're like, "Yeah, but what's what's the point?" And so, I have to explain them that sure, there's only one thing that a blockchain gives you, which is trustless execution. Uh and that data custody. And even that you could do you could do differently, right? If your state changes slowly, you can use zero-knowledge proofs to do that.

But, when your state is changing fast, like in a game, you need something for a block like a blockchain for trustless computation. Uh yeah, so basically don't trust all the big guys. But, I think that's like too short-sighted. The blockchain is not just uh technical, it's also a culture that pushes some values that we want in the software. And so, we know that if you're trying to do some software on the blockchain, some web three product, and you don't have these properties, uh people will just laugh at you basically for being a centralized not Ponzi, but like, you know, shilling for the man.

And so, you know, we [clears throat] want things that are decentralized, we want things we want to verify, we don't want censorship, uh and we want this to be on a blockchain immutable, and uh autonomous that it keeps existing even long after the creator has stopped caring. Uh also, if you don't like it, it's open source, you can fork it. These are all important values, and these are I would argue things we also want in games. So, so far uh games on blockchain have been web 2.5.

So, the assets are on chain, but the game logic lives off chain. That's because mostly for practical reason it's difficult to make a game on a blockchain, and that's something we'll get to later. So, you could put your uh you know, your resources, your if you're a game with uh vehicles, equipments, you can put all that on blockchain, you can have it traded. Uh so, that already exists, and it's successful to a fair amount. Uh but, I think we can like go beyond that, and so um what I want is fully on-chain game.

That means putting the logic on chain. Um and so, there's I'll picture of Vitalik right there because there's this apocryphal story. I don't know if it's true, but that Vitalik was very motivated to create Ethereum because uh Blizzard, the company that makes World of Warcraft, uh nerfed his uh his gear when he was playing a warlock in World of Warcraft. So, what he wanted there is that he wanted the game to not change on him, to not change the rule arbitrarily. Or at least he wanted a stake in this decision.

So, what being fully on-chain gives you? All these properties. You want to be trustless in the presence of financial incentive, and as we've seen, we have assets, they can be traded, so there's money in play. This is not like just hypothetical. So, like there's been controversy and outright fraud, people have been to jail for this uh for online poker websites.

Right? They manipulate the result of the poker games. So, you don't want that. You want continuity. So, if I'm making a game and I stop making the game, you want the game to continue, you want someone to be able to take over.

You want guarantees on ownership that the game is not going to ban you, take your stuff, and that the rules don't change on you. This is all great. What really excites me though is this one. Composability and extensibility. It's taking an existing game and then improving it, adding new modes of gameplay.

So, this is all very vague. Uh for me it works better with a few examples, so I'll give you a few examples of things I think are cool. Uh the first one is something I'm hacking on for this hackathon. It's a trading card game. So, you got Magic the Gathering over there, so people playing on a table, uh you know, with dice and cards.

And this is Hearthstone, it's a very popular uh card game you can play on your computer. So, obviously card games lend themselves very well for a blockchain because you can have the cards and you can trade them. This this happens in the world in the real world as well with physical cards. Um so, that's obviously a a good fit for NFTs. What I think is really cool with with trading card games is you can extend them.

If you put them on a blockchain, you can let people create their own cards. Right? You can tell them, "Well, make your own cards with your own rules, and you can play them in games with your friends." So, that lets people be creative. There's also another thing you can do, which is that you can leverage existing cards to create new modes of gameplay.

So, for instance, if you're playing uh both of these games, these are one-v-one games. You just play against another player. However, uh in the physical game, people have made up new rules to play with four, six players. So, this is like a game mode where you play three versus three. It's called Emperor, so basically you can't attack the emperor before you defeat his generals, and it's uh the first team versus the second team.

So, you can do that in Magic because these are physical cards, you do whatever you want. But, you can't do that on Hearthstone, which is on a computer. What I want to do with card games on the blockchain is reintroduce the ability for people to mod the game so that they can implement this on the blockchain. Uh yeah, so I'm hacking on this right now. Uh its tentative name is Zurich Fables, so that's going to be uh a contender in the hackathon.

Okay, another example. There's this game mode called uh tower defense where uh basically you have a map and there's a path on the map, and there are creatures walking down the path. And you're building towers to destroy these creatures before they reach the end of the path. It's a very popular uh um game mode for uh Warcraft, Starcraft, things like that. So, here's how this could be extended.

People on the blockchain could create their own towers with special properties. This is a tower that slows down the enemy. This is a tower that is strong against fire creatures, things like that. You could design your own maps with your own twisting path that goes whichever way you want. You could design your own creatures.

You could design new game modes. You could say, "Well, I'm going to design a map with a certain path, certain creatures, certain towers. You're going to do the same, and we're going to play each other's map and see who comes out ahead, right?" Okay, I just said all this. Um there's a bunch of games that do space conquest, so this one here is the the granddaddy of these games, it's called OGame, it's a very old like browser game.

And this right there is Dark Forest, like one of the most popular fully on-chain game. And what you can do in these games is basically you you colonize planets, you extract resources, you create spaceships, you send them to other planets, you wage war to other planets. And um what you can do there for extensibility, you can do a whole bunch of things. So, in Dark Forest, people have uh have created user experience extensions, so add-ons to manage the game better because it became very competitive, and so having these fancy add-ons that let you know exactly what's going on in your galactic empire made it very uh say, "I have a bunch of planets. We're in this together, you can emit orders to my planets, so that even if I'm sleeping, someone can still operate my my planets, my spaceships, and all that stuff."

So, um Dark Forest also makes heavy use of zero-knowledge, and one thing they do is that basically there's fog of war in the game, so you don't know where the other players are. And you're able to basically this fog of war is is created through hashes, and you can mine the map to reveal it. And then, once you have that, uh people have written this thing called night market, which is a a marketplace for coordinates of planets. Say you have find a planet that contains a lot of gold. But, uh maybe I'm too far to colonize the planet, it's too dangerous for me to go.

But, the information that the planet contains gold is valuable. So, I can sell it on this marketplace. I I can prove that I know a planet with gold. I just don't tell you where you are until you paid me. After you pay me, I reveal the location.

So, these are all interesting possibilities of on-chain games uh and extensions that people can can derive. Uh if you take a more classical game than Dark Forest, you could make NFTs out of your resources. Uh you could do alternative mode of combat. So, say I I create a game in space, and I have a a mini game to battle the spaceships. That's how you gain and lose resources against other players.

Maybe my my game mode is not so fun. So, someone else come and says, "Hey, I got I got another idea on how we could do this." So, basically they just do a smart contract, and as a player of the game I can opt in to the new combat mechanism, which maybe is much more fun. And so, that's how the game evolves. And you know, if if you got a a game creator that's a little bit wired in, you you can like pick up on the good ideas and bring them back in the main game.

So, for me like like extensibility like this is really the most exciting thing about on-chain games. Uh yeah, on-chain massively multiplayer role-playing game. I don't really have the time to get into that, but that would be super cool. And I believe there are some people building that. Um so, modding has a rich history of creating awesome games.

So, Dota, Defense of the Ancients, that's the first uh MOBA, so that's the genre of League of Legends. That was a a a map for Warcraft III. Counter-Strike, one of the most popular shooter of all time, that was a mod for Half-Life. PlayerUnknown's Battlegrounds, that's a a mod for Arma II. Um you know, tower defense games also uh something that's uh a custom map for uh strategy games.

So, mods have been super popular. So, that's the motivation for how why we want on-chain games. Now, I'm I'm going to go into some like technical hurdles, things that could be better for people that are looking to build uh these games. So, the main problem, blockchains are public, but most games need private information. If you're playing a card game, typically you got to have a a hand of cards that the opponent cannot see.

All right, so how do we solve that? Games uh need players to take many actions, so they need high throughput, low latency. Like, even in a card game, which is a very slow game as they go, if I put a card and then I have to wait 4 6 10 minute uh 10 seconds to put the next the next card down, that feels really slow and really annoying. So, we don't want that. We need low cost per transaction because if you're going to sit down to play a game, you don't want to pay three or five bucks every time for all the transactions you're making.

Uh and you we can't have user click their MetaMask wallet for every action. That's just not a good experience. Currently, um everything on the blockchain is is a little bit hostile to new users just because if you're not in web three, you come to you see a cool game and you're like, "Well, I want to play that, but now I need to install MetaMask. I need to securitize my mnemonic." That's just janky.

And um finally, it's just like the tooling and stuff is not really good. So, we want to improve the the user experience for the for the developers. All right, so let's tackle this first problem, like private information. Uh you want to use zero-knowledge technology there. You want to use commitments, hashes, Merkle proofs.

Um and so, for instance, to illustrate this point, card games. In a card game like Magic: The Gathering or uh Hearthstone, you have multiple areas like the a card can be in your deck, in which case it's private, in your hand, it's public to one player but private to the other. It can be on the battlefield, in which case it's public to everyone. And so, for the public areas, you just put everything on the blockchain. That's easy.

For the private area, what you can do is use a Merkle root to commit to the content of your deck of your hand. But then say, I have my hand, which is public to me but private to the person. I have the deck, which is private to everybody. When you want to draw a card, you will need to generate a ZK proof that show that you use the randomness on-chain to draw the correct card that you put in your hand. So, you will need to update the Merkle roots for the hand and the Merkle roots for the deck.

And with a zero-knowledge proof, you can prove that you did that correctly. So, if that's something you're interested in, I have a uh a Twitter thread on how to do that that that goes into the details. So, tinycc/shuffle-deck. Okay, next problem. Uh basically, we want things to go fast and be cheap.

So, maybe high throughput chain can solve this in the future. Um I'm always concerned about decentralization, personally. So, I'm not sure. Another solution is app chain. Your game can run on its own chain.

Again, you want decentralization. Fortunately, now we have a solution for that, the rollups. Uh so, you know, these rollups app chain, I call them rollups. I think other people do, too. And that's something that's being developed right now.

So, there's like a lot of companies in this space looking to provide solution for that. Again, there's a Twitter thread there that like it's basically a list of companies providing rollup solution. So, I'm hoping that this works well because that's something we need. Uh finally, like just some some painful stuff in the front end. Like, I played a game recently and it was a resource collection game, so you could build a farm and collect wheat and stuff.

The problem was each time I did this, it took like 10 seconds for the interface to update and show me the new amounts, which felt very janky and it wasn't a good experience. So, solution that make the front end reactive are also necessary. In general, we just need better tools. Um and here's a tool that I'm a fan of, it's called Mud. It's a entity component system, um which is a a famous pattern to for making games.

They're they're building the V2 right now, and the V2 is going to be even better. Uh it's going to apply to a lot more than games. So, you know, if you're looking for tools or frameworks to build your on-chain games, uh definitely check out Mud. Yeah, so we don't want to you want to click MetaMask, and for this we need a temporary wallet. Or basically, you just say, "Hey, I'm going to be gaming now for 1 hour, so during 1 hour you don't ask me for for signing transactions, but only for the game."

Okay, so someone that has this permission is not able to steal your uh other NFTs or things like that. And there's there's a lot of design space there, so I don't want to enter the details, but it can be done with smart contract wallets and account abstraction. And again, I have I have a thread with the detail where I explain like the potential of delegating permissions to other wallets or contracts. Uh so, but basically, that's what you want. You want to delegate the power to someone else and make sure you don't need to click an interface every time you do an action.

Uh and again, we need tooling to integrate this cuz people are already doing this. Like, Dark Forest is doing this, but to my knowledge, there's no um I'd say, there's no library that that makes this easy. You just import it and it works. Uh this is sort of related to onboarding. You want basically a new user that's not in web three to have a really easy time to onboard.

Uh it doesn't have to create a wallet immediately. Like, maybe we create a wallet for him and we custody the key and it's a smart contract wallet, and later we take him we let him take ownership of the wallet. All right. Uh yeah, better tools. I'm going to skip that.

All right, so basically, I'm working on a fully on-chain card game. If that's something that interests you, talk to me. If you are interested about anything I talked about, so um all the technical problems, the potential of it, I just would love to to talk to you, basically. So, this is my Twitter, it's my Telegram. Feel free to reach out.

I'll be hanging around after. And with this, I want to open it up for for questions and and comments from you guys.

Automatic transcript — names and jargon may be misspelled.