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

Loading player…

Multi-EVM Blockchain Game Development with the Chainsafe Gaming SDK with Jon Roethke

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

Jon Roethke

Transcript

So, welcome to the multime blockchain game development with the chain safe gaming SDK. So, originally this talk is presented by a gentleman namedWami Brian who's on the core team. He's a core engineer for uh Chainsafe Gaming, but he wasn't able to attend today. So, I'm doing the talk on his behalf. And my name is John Rutkkey and I work for Chainsafe Systems.

Also, Chainsafe Gaming is just one product underneath the umbrella that is Chainsafe. So, Chainsafe is a research and development firm. We're founded in 2017 tasked with working mostly on improving the existing infrastructure for networks like Ethereum, Filecoin, Polka Dot, uh as well as Nim most recently. Okay. So, for those came seeking a really hands-on workshop on how to build your first blockchain game, um, essentially what we've done here is I've modified the presentation slightly.

It's going to be a little bit more high level, but don't worry, you still get everything that you came here for and more hopefully. So, the resources here put together. Um, it's called V2 sample. Our SDK, we just upgraded to a new version called V2. And so, um, I'm going to give you a minute to record this.

Um, it's K Brian, which is his GitHub username. And, um, the repo is called V2 sample. And then the YouTube video underneath that YouTube link, hopefully it's large enough to see. Um, that's like a 45minute presentation exactly on how to integrate the SDK into Unity uh, environments, the Unity like game framework. Probably something you're familiar with if you know Unity at all.

Uh, it's something called the Unity Hub. you can download from their website. Okay, so for those who do wish to stick around, this presentation will be more of like a thought workshop. Um, it's focusing specifically on why one would wish to incorporate web 3 into a game and then how you might do that. Um, not necessarily getting into the really technical stuff likewami will show you.

Mine's going to be more like a little bit high level. um kind of talking about like game design, how that changes with a blockchain game versus a traditional web two game. So, if that is of interest, you're in the right place. Okay. So,wami is not here to obviously speak about himself.

So, I'll give a little bit about him um out of respect. Uh I've gotten to know him over the last two years working at Chain Safe and he's just an awesome guy. He but he spent most of his career actually in traditional web um traditional game development, excuse me. mostly working for game developers like EA as well as Microsoft game studio and some other notable companies too. So since 2014 uhwami has been involved in building web 3 tooling and so like I said I've been had the privilege of working with him for the last two years and there's his Twitter and stuff like that you can find on Discord.

He's very active. Okay, so a little bit about me. Um, so my name is John. Again, um, that's my Twitter handle, Whimo Betta. Uh, in the early 2000s, uh, basically I occupied a lot of my time playing PC games.

And I quickly fell in love with two in particular, uh, Diablo II and also, uh, an an MMO RPG called City of Heroes, where you design your own superhero. And so this game was eventually shut down on November 30th, which is the doomsday right there. And November 30th is actually my birthday. So you can imagine like this game that I loved played every day almost for a decade and they shut it down on my birthday. So it's just I'm here now to talk about this and I think it's going to be pretty fun.

Um because I have a lot to say as you can imagine, many years um thinking about this. So then after that I I moved to um a project called adchain and where we attempted to curb um the rampant fraud found in digital advertising and we were trying to do this by applying blockchain solutions. Um really difficult blockchains don't scale super well. So originally we were thinking like you can imprint all transaction data or rather um impression data which is how digital advertising works. uh impressions on a blockchain, but that quickly became like a terrible solution um out of just scalability constraints.

So we ultimately um landed on a on an idea called token curated registries or TCRs. And so our team pioneered this concept uh and we deployed the first TCR to Ethereum mainet in 2018. This was called the adchain registry. So I went on to write a book about this experience, my experience at adchain. Uh and it was called aptly called the oneb block wonder because we did a token launch in 2017 and we sold out in one block.

We raised something like 44,000 ether I think. I can't remember exactly but it was around $8 million USD at the time and we sold out in about 23 seconds. So that was a pretty interesting event. Um a preview of that can be found on my website. You can you can see the book there.

Um but it should be published in the next month or two. Um I just wanted to share the story with people. I think they should know about it and it's hopefully pretty inspirational. Uh so then I joined Chainsafe and I worked as a backend engineer on a project called Chainbridge which is a modular blockchain bridge connecting like environments like EVM as well as Substrate. Um, and then now I lead developer relations at Chainsafe and I spend most of my time evangelizing for blockchain technologies and demonstrating web3 tooling at events like this.

All right, so let's get into the main talk here. Um, soqwami likes to think that the future of gaming is where studios become networks, players become communities, and games become platforms for growth. So studios becoming networks kind of like you can think maybe studios running their own blockchain or perhaps their specialized DAP chain. Uh players as communities. We're kind of already seeing this in massive Discord communities and um these vibrant communities that are all abound and then games as a platform for growth.

It kind of borrows from that previous point of communities. um where there's more opportunity for like user generated content originating from the community and then possibly making it its way into the game itself. Okay, so Chain Safe Gaming, what is it? Uh it's a complete suite of web 3 gaming products um and services for studios, developers, indie developers, too um and players to bring games into the the future. Uh so it includes a full feature gaming SDK that I'll be talking about today.

there. It's called Web3 Unity. And there's also an NFT mentor and marketplace. Um, and if you use the marketplace with the SDK, it's a native integration. So, you don't have to do any custom um, coding.

So, basically what you could do is you can mint an NFT on our marketplace and then be able to pull that asset into a game that you've created. Um, and that's made possible by using or leveraging the SDK in your Unity context. Okay. So, chain safe gaming basically helps you um you know engage your community in an easier way because you can take you can grab access to like all these cool web 3 components that we know and love like tokens. That's a huge one.

Um and so you can connect your game with the web3 experience into Unity 3D using something like a prefab. And if people don't know what a prefab is, it basically allows one to configure, create, store game objects, um, with all of its values, components, child components, child objects, and things like that as reusable assets. So, it could be like a tree that you use multiple times within your game. It could also be an NPC. At some times, you would like to that NPC's behavior to like increase or decrease depending on the game or the situation of the game.

Um, and that can all be done with a prefab. So you don't have to create these uh these aren't individual object objects each time which would be a lot of work and tons to maintain. You just use prefabs and basically duplicate them. Um so now we'll start getting into the different kind of tokens that we support. Uh obviously 20 721 1155 standards.

There are many cases where um using a 721 doesn't make sense. Um, people say, "Well, it's nonfgeible, you know, and just like an 1155." And it's like, "Well, you know, there are still situations you don't want to you don't want to use a 721." Like, for example, if everything were a 20 a 721, um, there would be there could exist like a cap on the number of uh, these non-fundables that are issued. And so, if you imagine each avatar in your game is a 721, you might actually limit you might end up limiting the number of players who can play your game.

Um, so at the same time, like looking at something like like weapons or wearables within a game, not every single weapon needs to be unique. It can be, but it doesn't have to be. Um, so these are just two cases where you might want to leverage the 1155 instead. Um, so the the gaming SDK web3 Unity is EVM compatible. Um, and it operates on mobile and desktop environments as well as WebGL.

For those not familiar with that, that's basically like browser environments. And so it compiles down to web assembly. And so it's also embedded with a decentralized storage services like chain safe offers their own which is just kind of like a layer on top of IPFS, but you could also just use IPFS on your own if you're familiar with that. Um, and again I talked about the marketplaces just a little bit. Uh, you can either create your own and bring that within the game context so players don't have to leave to go out to like an openc.

They can have that marketplace live inside the game. And many games that maybe some of you know like World of Warcraft for example, City of Heroes 2, they offer marketplaces in game. So if you can imagine that assets were digitized or digital collectibles, those assets can be traded within the game and then of course taken outside of the game which is really where the value comes from and we'll get that we'll come to that in the next slide after this. But I want to briefly talk about the the blockchain trillemma um which is kind of like a widely held belief that decentralized networks can really only provide two out of the three of these benefits at any given time out of respect to decentralization security as well as scalability. And so we won't speak about this at length um but we should let this slide kind of serve as a reminder of the present challenges to providing all of these three elements at one time.

Um, and there's ongoing there are ongoing efforts from like L1 and L2s to try to try to fix this trillemma or address this trillemma. And I guess if if some of you are actually familiar, there's a a separate trillemma called Zuko's triangle. And it's kind of unrelated, but it's interesting because Zuko's triangle basically talks about um how to provide recognizable names and network protocols. and Zoko's triangle was was addressed by many projects, but one in particular that y'all may know is Ethereum Name Service or ENS. So, um, that's pretty cool.

So, we're solving problems left and right up here. Um, okay. So, now we kind of get into this slide. I'm sure it's kind of overused. Many people have probably seen this, but it just talks about the evolution between like web 1, web 2, and web 3, and maybe where we are right now, which is more of like a web 2.

5. Um, so, you know, web one is kind of like you can just read things. You can't really change state. web two you can start start to like change state and see that you know relayed back to you and then web three starts getting into more ownership of that data and so in the context of a game if you were able to own those digital assets and the game shuts down like I will explain in my personal story here soon um all that data all that time isn't just locked into the game that doesn't go down with the ship so to speak when the DB gets sunseted like you can take some of that data away if it's in a token if it's stored on a blockchain All right. So, here's my personal story.

Um, and so before we get into more details about the SDK, I'd like to talk about this a little bit and maybe starts helping you to see like, oh, this is these problems are going to keep occurring or have occurred in the past. And and it really like marooned communities when this event occurred. And um, yeah, I'll just explain it briefly. So, like I said, I've been a gamer since the early 2000s. And in 2004, I fell in love with this game.

It's a desktop game called City of Heroes. And um you were able to design and play your own superhero. And at the time, this was the only game of its kind. And of course, like Marvel came out with their own superhero games, as well as DC. But those two games, you aren't allowed to create your own superhero.

You're just able to play as something like Wolverine or maybe play as Batman. You can't create your own superhero. So, like, what if you wanted to do that? And so this game really addressed that like market need. And so that's why it was so sad when it went away because players didn't have an alternative.

Um and you know in the same way like people don't have an alternative to like maybe the banking system. They don't have an alternative to some of these like traditional web two systems now they're starting to with the advent of web 3. Um so it's pretty it's pretty cool to see. So, um, City of Heroes naturally they created like a a darker version called City of Villains and it, you know, it opened up this whole like player versus player. Um, lots of fun and you could design your own costumes and power sets and, you know, each hero was like a different archetype and yeah, and so, you know, obviously villains would wish to like rob banks and heroes would be like trying to prevent that.

So, it created like this really fun dynamic. So in 2012 though I realized the impact centralization had at least on me at that time and uh on my life and this game that I loved they just shut it down and without a lot of warning and so um it left me as well as others kind of feeling helpless and really frustrated too. So it's like what can you do now? um they just shut the game down and like and it makes sense these studios, you know, they're they're businesses so they have to make difficult decisions and sometimes these decisions the community doesn't agree with. Maybe many times actually um but what can we do as a community?

What can we do as a community though? like it's kind of a challenge. And so, um, yeah, so essentially what happened is like they just took the servers offline and they didn't open source the code like a like a Starcraft might. And so people were just stuck. Um, and so this is the message that was sent out by the the community manager of the studio at the time who created this game.

And I'll let you read that for a second. Um, but you know, it's pretty sad. And again, like I said, I mean, it makes sense why these studios make these decisions. they're operating at sometimes profit margins, sometimes none. Um, and so they just have to make difficult decisions, especially to make make way for like new games and things like that.

Um, so that was the fa fateful message we received when the server went offline. And as you can see here, lost connection to map server. This sometimes happened when your when when your internet drops, but it also happened on this exact date when they just pulled the plug basically. And it was really sad cuz everyone's like teleporting around and firing off their powers because they know it's like the last time. And it was really sad when you read the chat messaging.

It's everyone's like, "Please don't do this," you know, and it's it just it just proves like there are some situations you can't control. Um, so centralization, it's a nice segue because centralization disrupts each of us in unique ways and uh with no less damaging impact. It's just subjective. And so by integrating technologies like Ethereum into a game for example or any kind of blockchain maybe um this can not only introduce in-game economies that we talk about but it can also help players be less impacted from centralization faults whether those are accidental or on purpose u by allowing them to be in more in control of their game assets and perhaps even one day maybe even the game state itself. So hopefully the story and the examples provided here like help you to think about game design and how that may differ between a traditional web 2 game and one you know built with web 3 from its inception.

Like in a similar way we don't build DAPs by first building a web 2 variant and then incorporating like web 3 in. We don't try to like layer it in after the fact. It's built from the ground up like unis swap was built with web 3 in mind from day zero. And so games should could probably need to um follow a similar design path. And I'll I'll get into this a little bit later um when we actually we show you a demo of a game that we built and I'll talk about some of the challenges that we that we ran into.

Okay. So now we're back to now we're back to the web 3 Unity SDK. So I told you about the story of City of Heroes shutting down. um what would that have meant if if that game let's say that game was built in Unity and let's say that game um did incorporate the SDK into it like what could have been done well some like one of the cool things about City of Heroes is you can collect badges and achievements and like if you just if you work with a bunch of people a bunch of other heroes to like take down a big giant monster you get a badge for that and then when you leave the game though or when the game shuts down that badge goes down with the ship it's gone um and so you have no proof of that so if you were obviously you You can kind of see where I'm going with this. If that badge were to represent like a 721 or a 721 were to represent that bad badge, you'd be able to take that outside of the game with you.

And then even if the game was shut down forever, maybe a different game that recognized that badge or that achievement within that game, City of Heroes would be able to pull that data into that game and say like, oh, this person was here on this date or like kind of like a PO app, but it also could be um you know, proof of achievement or proof of time spent in game. So, let's get into a little bit about the SDK. Um, so I talked a little bit about the prefabs that we offer. Um, saves you a lot of time in development. You can just drop these prefabs in.

You don't have to build them yourself. Kind of gives you a nice template to work with. Um, we support a various EVM chains. Some of the biggest that, um, you'd use for gaming like Kronos and Polygon, BSC, of course. Um, and so it supports like um, multiple environments like I said, desktop, mobile, as well as browser.

And you can communicate directly with RPC providers. So this is one of the big changes with V2 is we removed our middleman API basically from the equation. And so previously a transaction would be crafted in our servers and then it would be sent back to you to then sign and broadcast. But now we've removed the API layer because chain safe is all about open source software as well as promoting decentralization. So we wanted to remove that point of failure in many ways because it was a point of failure.

It was a point of like constriction for people because the API kept, you know, getting overloaded. I mean, you'd have like millions and millions of requests a day and we're we're not an infrastructure company. We build infrastructure for other companies, for other networks and and so we didn't want to get into that business model. So, we built it as a proof of concept as kind of something that would have be like sunseted eventually. Um, and the problem is we just got so much usage that it just it pushed it to the absolute limits.

So we've sunset that or or it's happening like in the next month or two, but the the v2 update is out. So now you just hit an RPC provider directly. It's great. And so um that means like the transaction handling the readrs occur on the client side. So in this case it would be within Unity itself.

So you have a lot more control um a developer does. And then of course there's like a vibrant community that we have fellow builders and really experienced people too. Um, and it's made for Unity developers and Unity is one of the biggest game engines uh in use today, especially looking at a platform like Steam and the percentage of games on Steam built with Unity a lot. So now we're kind of in this like research phase of like where do we go next? We do we delve into like Unreal uh do we go somewhere else?

And so that that's uh to be determined. Okay. See, let's if I skipped a page. Okay. Yeah.

So a little bit about the SDK. I've already talked a lot about this, but um it improves reliability because we're no longer having like this middleman API server that can't go down on weekends, which is usually when like game developers become super active and our team happens to go offline because we're trying to like enjoy our weekends. So you can imagine like the difficulties there, people are scrambling and like um so yeah, it proves the reliability as well as scalability because we're no longer the bottleneck. You configure the RPC provider. You don't have to use Infura.

you can go to somebody else, quick node, any number of these. And so it's kind of like um we're pushing that out a little bit. And so it improves the SDK speed because you no longer have to hit an API to get a response and then broadcast a transaction. You do it all from within the context of Unity to the RPC provider. And then again, it provides uh it improves transaction handling.

So, one of the biggest um requested features that we have is basically instead of having to wait for the transa or essenti essentially like how it would work before is you would um you would submit a transaction through the API and then you'd have to wait for the response. you'd have to ping the API and say like basically like was it a success or a failure like give me an update and now you just await the RPC call and so it just tells you it'll come back like it's literally an await um in the code um and then you just wait for the response that that returns um so lastly I guess it improves collaboration it's open source everything we do is open source so um collaboration is kind of in our DNA and so if you find something about the codebase that you don't like or you wish to change or maybe a lot of the community wishes to change it. Um, you can submit a PR and we're definitely happy to like entertain that. Obviously, it just helps to like make a better SDK experience and um really optimize the code. Okay, so now we're going to show a sample trailer of a game that we put together.

Now, Chainsafe is not a gaming studio, but we wanted to create a game. We wanted to showcase our SDK within a game. And it's it's it's awkward because like I said, we're not a gaming studio, but how do you show a game demo highlighting like SD what an SDK can offer? It's like this is all behind the scenes stuff. Like you don't want to be showing this.

But for for the sake of trying to get more people to use this SDK and incorporate um these this web 3 tooling in your game, we we tried our best. See if I can how do I can run this? Okay, maybe there's no sound. There's no sound. So, these weapons are 1155s.

This shows claiming tokens that you've earned within the game itself from like basically turning germs into or like healing germs. This is the transaction details that show up within the game itself. It's too small. We can't do full screen. So those grenades, these are the networks we support some of them for example.

Um but those grenades are like those are 1155s too. And in order to purchase those, you generate you collect like ERC20 tokens within the game and then go to the store or the marketplace that could, like I said, be embedded in the game itself. We didn't go that far, but we could have easily. Um, then you can just buy these 1155s and all of a sudden you're you've hit the ground running like so yeah. So, what this shows kind of behind the scenes, you maybe saw a little bit, but it shows contract reads, contract writes, uh you're checking ERC20 balances, you're checking 1155 balances, and then obviously all of that is predicated on the first and most important step, which is just basically making sure that you have a wallet connect.

So, once you have the wallet connected, it just opens up this whole world possibilities. Okay. So, the cool thing about this is we'll also be conducting a buildalong series in the next like couple months. It should be around two months. We're going to release the build along series on YouTube.

So you, you know, power users within the group here can you can always just kind of go ahead and and skip ahead and things like that. But the buildalong series will also have um live Discord community calls. So you can actually meet the developers. They can talk about some of the challenges um and incorporating the SDK into those games. Like I said, the game design like that's a huge piece and game design itself.

It it definitely differs between traditional web 2. And how we know this is because we built this game first as a web 2 game and then tried to incorporate web 3 after and it was just like it was tricky. It was just tricky and and it's doable for sure, but you just kind of need to change your thought process behind it. Um, even like reward pools, like maybe at the end of a game you have like the you have like a reward um or not a reward, you have a um like a winners list, you know, and it'll be like the the top the top earner in the game or the you know, the top scorer in the game and that can be turned into like a rewards list where you just incentivize those people to keep playing um and make it to the top of that list and you just drop them token or something. So, um, this build along series should be instrumental in in kind of helping things click.

Uh, as well aswami's YouTube video, that whole 45minute, uh, video I highly recommend. But, um, we designed the game specifically around the series for education purposes. Uh, and so we provide all the code resources as well as, um, you know, the videos of course that you can follow along from like all the way at the beginning to all the way at the end. And the series might even continue as we release new features within the SDK. So you can stay up to date with a really dead simple game and you can understand how all of that works.

And then you take all the what you learned and incorporate into like maybe a first-person shooter like this. And it gets a little bit more complex, but at least you have the base. And so once you have this baseline knowledge, then you're able to really expand where you go from here. And that starts to get really fun. you can think beyond just the basics of what we talked about today because this is very basic stuff when it comes to game development.

We're not even talking about dynamic NFTs or nested NFTs, uh, any of that stuff where you start to like get into like traits. That's going to be really, really, really cool. And the technology is starting to get there. So hopefully once you have this baseline knowledge, that technology will be ready and you'll be able to incorporate that within your game. Okay, so I guess that's all the time we have.

Um, I can't advance this, but there's a thank you screen here. Anyway, it doesn't matter. Thank you for your time. Uh, and if everybody wants to, if anybody wants to reach out, you can find more information about the SDK on gaming.chainsafe.

io and I'll be around answer questions as well. Thank you very much.

Automatic transcript — names and jargon may be misspelled.