GDC 2019: Developing Ethereum Games with the Enjin Platform

my name is VTech I'm the CTO of engine and right here next to me is Tim he's one of our super store developers and we're gonna be showing you some live demo here hopefully nothing crashes blue screens we'll see what happens so you're all ready to see how our platform works awesome okay so this is unity and we've made a little template game here that we've started integrating blockchain into so let's look at the Unity SDK panel real quick here so here's the engine unity SDK this is a visual editor that runs inside unity and interacts with the runtime SDK for c-sharp we created this interface to give game developers an easy way to visualize and interact with the blockchain items and we're just logging in here with our developer account okay so this this count might have different applications but right now I think we're on yeah let's go to the GDC demo huh so let's go to the team tab the team screen shows you all the developers who can log in and administrate your application and then you have the identities tab this will show you all the users who have linked their wallet with your game and then we have the crypto items tab this is the most important part of the editor here you can view a list of all the items you've created as a game developer if you view an items details you can see its parameters the item ID and the metadata location of that item and finally the wallet tab this will show you a wallet details as a developer and how much ether an engine coin you have it allows you to link your developer wallet with the app itself okay so let's try the game that we've put together here okay so we're playing the game and we see that the player has no items in his intimate inventory those four boxes up there each of these inventory boxes at the top will display an item if the player has it in their wallet so the items you see in the scene can be picked up and that will send a notification to the developers wallet a copy of the item will be minted and sent to the player so let's pick some items up so now that we've picked up some items you can see that they show up as transparent icons in the inventory boxes this means that the transaction was sent to the wallet and the game is waiting for the transactions to be confirmed since we're currently using the etherium test net transactions can take around 30 seconds or so until they're confirmed on the blockchain so this is normal behavior when using the blockchain directly later this year we'll be releasing affinity our scaling platform which will actually work seamlessly with the existing SDK this will reduce the transaction times to one or two seconds in any case it's good to show that the player that show the player an indication that their item is pending like we're doing here and now you see that they've turned fully opaque so that means that the blockchain transactions have come through and they should show up on the players wallet there you go you have all those items that you've picked up so now let's restart the game and see that see how the game can recognize that you actually have these items in your wallet see now that the game is restarted you can see the three items you own are appearing in the players inventory let's look at how all this works inside the code okay so here we're storing a list of game items and their IDs on the blockchain each of these hexadecimal values is the base token ID of one of the blockchain assets and since each of these items is fungible which means they have other identical copies we only need to refer to that item by this short base ID these ids are unique to the engine smart contract and each one will always refer to its blockchain asset as long as the if theory and blockchain exists consider that a hundred years in the future players will still be able to interact with an item using that same ID okay so let's go to get crypto item balances when the game starts we ask the engine SDK to retrieve the players inventory we use their identity ID which you can store for each player account this maps to their actual wallet address on the blockchain and we can scroll down here to the switch statement once we know the players items we handle them in various ways with the gold item we update a counter that shows the current amount of gold pieces they have for all the other items we send out an event that updates the inventory box and finally we'll go to the picked up item section so down here we can see that the function that triggers when the player picks up an item we figure out what item ID they picked up and then they send a mint request to the developer wallet this asks the developer to forge a new copy of the item and they transfer it to the player in one transaction finally we queue the item and wait for confirmations that the transaction was a success once it's confirmed the item becomes fully opaque in the inventory box alright so now that we've seen how this super simple game works maybe we can try creating a new item and adding it to this game so let's open up the engine SDK editor let's log back in so this visual interface is the easiest way to define a brand new item you can also do it with code but right here it's really easy to to start making some items for a game so let's open up the create correct app and we'll go to the crypto items tab okay here we can see the list of items they've been using and we've clicked into one of the items or we click the Create button and alright so let's create a new item in this visual interface we're gonna add a new gun to the game yeah this is a fantasy game but maybe the producer wants sci-fi DLC expansion pack or something like that alright so we've filled in some parameters here so we have the name of the gun we have a total supply the initial reserve so let's let's look at the supply type options for a second actually here fixed supply means that you have a maximum number of guns of this type that can ever be created you can use this to make a rare item by setting the total supply to a low number that's like a limited print run of a special card and and trading card game for example the settable supply lets the developer change the total supply at a future date and the infinite supply lets you mint items in the future as many copies as you want okay so the collapsing supply finally that one lets you make really rare items if a player melts or destroys the item no one can ever mint and you copy about it again so the supply will go down so for the total supply we made 1,000 copies of the gun initial reserve is the number of tokens you want to stake when you first create the item will use the same amount there and then melt value every item on the engine platform is infused with a reserve value and this demo will say that each gun is worth 0.01 inge so when players melt or destroy gun they can receive their value back into their wallets and now for the metadata URI will type the web address of a JSON file that has some metadata about the item so can we look at that JSON file all right so as you see the JSON object has the name the description and the image that will appear in the users wallet we can also add custom properties and metadata to this item so for example let's give this gun a firepower value let's add some data to the file any keys placed in this properties object here will be available for the game engine to use the properties will also show up in the users wallet and also in our blockchain Explorer well it's not another property after this called max ammo why not so what's cool is any other blockchain enabled game can also read this data this is really useful if you want to build a multiverse of games that use the same base stats for an item or if you want to integrate another games item inside of your game and what we're talking about here this is the the kind of centralized metadata but the item on the blockchain will always point to this JSON file in the future you can also put this on ipfs and host it there okay so we've updated the file and let's create the item so a request was just sent to the developers wallet the engine wallet comes in a mobile version for the player to interact with and more importantly we have a server daemon with a console interface for the game developer to run on their back-end server this will process all those transactions like minting or sending tokens to players all right so can we check out that gun in the wallet itself well I think we're waiting for them there we go so it's just been created and we have a metadata there and let's check out the wallet oh this is actually the player's wallet so we will have to send it to the player first yeah okay so let's update the code to actually handle this gun and we'll add it to the game and then the player can pick it up and then we can take a look at it okay so we're copying the items ID here you have all the parameters of the gun we're gonna open up the code and we'll just add this to this dictionary here well I call it gun and put the blockchain ID token ID okay we'll copy the ID one more time all right let's go into the item again the GDC gun view the parameters will copy the item ID paste it in here okay we're gonna go down and see what we're gonna do with this gun we want to add it to the inventory okay great you know I think we're gonna have to add another inventory box to be able to show that gun just position it on the stage and give it okay there we go litem names gun I'll give it another texture okay I think we're ready to play the game right oh we have to add one more thing we have to add the gun to the stage the player can pick it up so we've cloned one of the swords and I move the gun onto the stage yeah yeah that should be good all right let's see if all this worked all right players picking up the gun it's popped up in the inventory box so far so good and I'll have to wait for the blockchain transaction to come through this'll take a few seconds basically the our platform will actually notify the game it'll notify the wallet when when these transactions happen so the game receives all these events and now it updated the gun there we go we have the G G DC Multiverse gun and do we have stats yes we have firepower and Max ammo from the JSON file so there we go that's that's that's how you can easily start using blockchain our blockchain sdk in your games it's a really simple demo but you can do a lot more with this you can start integrating items from the multiverse from other from other games and use them in all sorts of interesting ways so one more thing we can show you let's let's look at the API that we are using because this is the Unity SDK and it's just a front-end sort of interface to the API what we're using is graph QL this is a powerful query language and API made by Facebook but it's we're using it to fetch and retrieve data and send transactions so here we have a query at the top called get tokens and you can specify what data you want to receive and we'll just run it here in this web interface and you can instantly retrieve any sort of structure of data using graphic you all about your tokens if you want to look at another query at the bottom here we don't quite have this set up to work with the right wallet but you can write a query to send tokens to players or mint tokens or interact them with with them in any way and graph qaul has integrations with tons of languages so you can use it no matter what your game is programmed in okay so that is our demo for now about now we also have Ariel from Godot engine who's going to show off how Godot works I'm going to show very briefly sort of the equivalent of this in goes out so in the dot we we did a an SDK similar to the unity one this is a video apologize there's no life and but you know it's a supposed to be the same sort of experience that which is so in the collage editor so we open this window with this this icon that shows up up here when you have your your SDK installed and you see the same this same interface it's made to be a similar as you know here we are actually creating the the game so you know this the we recorded like the whole experience right so here we create the game with an icon with the description in the in the SDK so so there's a game and so here's the linking the wallet to the to the to the game right so here in the left you see the on the rights or you see the wallet this would be running on your phone and so we linked the wallet with with your new game that you created your developer wallet oh it's a Spanish sorry but you you know you type this code this code in here and this is how you link the wallet very important I think they went over this but you know your wallet holds your keys and so your game doesn't hold keys right that's very important your wallet takes care of the security of the blockchain etc so here's the wallet linked up here we see all the same tabs right your team your identities here's your your identities etc this is and this is the the item creation again very similar screen we create the item all of these parameters it's all you know it's made to be the same experience and so we can have games that share items games that maybe share a universe right and so to two different games can could use the same items because I live in the blockchain their phone cheval etcetera or no non function you know what I mean so here's the the item going into the blockchain [Music] and yeah so he this is waiting for the blockchain to to upgrade and there's there's our item that would create it here's our meta that I think were meant melting it or yeah here's our item metadata and all of that okay and then second video what's the other video sorry now we have a video of like a little bit of the in-game sort of this is very brief this is basically the game it's running here you can see the the requests that we make again with this graph language again it doesn't matter really what what engine you're using you're sending this this requests and then and so this is what your server would do I guess it would you know make sure that this guy is actually picking up these things that they're picking up and then we this is minting the the the item and giving it to the to the user and here's here you can see the these items getting into the into the guy's wallet and and all that and the very simple minigame and that's it it's you know it's made to be the same experience every word right thank you thanks guys for checking out our demo will we're open now for questions if you have any questions about any of the technology please fire away and we'll try to answer noe we support mobile anything that the unity engine can export to anything that go down engine can export to and eventually we're gonna be doing unreal as well see how the wallet currently is is on mobile on iOS and Android and it also has a server daemon for the game developer but we are thinking about integrating it further as like a back-end wallet for games and PCs and stuff well we'll see where that goes so currently we have a lot of tokens being created but they are for games that are in development so we have almost 30 just about 30 games now building on the platform and they've you know this has only been out for a short amount of time we started building it a year and a half ago and we finally released the Unity SDK about ten days ago so people are pre selling their tokens for their games people are creating secondary markets and trading them in telegram and in different different ways but you know we're gonna have to see how this plays out and pans out over time in actual games and people will probably start making interesting games and game design based around this model the question was could you imagine a game being made where it's completely opaque to the players that they're using blockchain assets definitely and that's what we're aiming to achieve so currently you have to have a mobile wallet to interact with these items and receive them and send them but our goal here is for a person to jump into a game start receiving and sending items and those items will go into a temporary address for the for the beginning and once they actually want to interact with the blockchain they want to do stuff have more security things like that then they can do a bulk transfer to another address can you speak a little bit louder sorry yeah cool can you tell a little bit more about connection between front-end and back-end part of your game or future games because understand saving that on client side is not secure at all yeah so the way the whole platform works is we have a whole bunch of components we have the the wallet the player's wallet we have the developer's wallet and those can store assets and the game engine and and are a graphic qll api and all that stuff that will query the blockchain and figure out who owns what assets so as a game developer you want your server code to be you know executing the transactions that send players items because that's you don't want the client to be able to send those transactions obviously so you'll you'll have the game server that says please send this this token from one user to another and then the game developers wallet will get notified of that and it'll create the transaction automatically and the player will receive that and then on the player's end their side is is checking the blockchain and seeing that it appears in their client all right any other questions okay so the question was you know beyond just trading card type of games can we do anything beyond that well with her currently with her platform the we're basing it around assets so you can't organize items you can tokenize characters one of our early early adopters ultra versus tokenizing game servers so when people have a token it'll represent a game server that they can then spawn on on some cloud servers you can also add metadata like multiple players can add metadata to an item and you can have things like for example a sword that's signed by a famous player or enchanted by a certain player you can also have players minting their own items and creating them and of course we have this multiverse aspect which is something no one's ever explored before where you can have ten different games that share specific items and all and then players can use them in different ways across the games there's also some puzzle games being developed like age of rust where they're using the blockchain for their puzzles so if you use an item it might have a cool-down for you know a number of blocks or you may need to perform a number of transactions before you can open a certain part of the game and there's different lots of different creative ways they're doing they're doing that another cool thing you can do with these these assets is you start building a giant history on the blockchain of every player's transactions and every accounts transactions and one of the games called cats and mechs is using deep learning to look at all those transactions and all those items and actually be an AI storyteller and change the game around using using that deep history so that's what we're doing right now I mean there's there's experiments in the future you know lots of people are experimenting with blockchain doing like finite state machines gameplay on the blockchain but right now we're not focusing on that where we're trying to do the things that we can achieve really well with these assets and there's a lot to explore there yeah so a question about the supply type yeah the fourth one is collapsing okay so yeah the question is about the fixed versus collapsing supply types the difference here is that a player can destroy an item and release the engine coins stored inside an item because every engine every item has a bit of engine coin at least inside of it so with the fixed supply type if a few players destroy some items now the game developer has the ability to mint new copies of those items so you know always bring the supply back up to 100 if it's been destroyed but with a collapsing supply type thus the total supply will go down if any items destroyed so it'll become more and more rare yeah so well well about who mints the items usually I mean in the traditional game models we see now developers mint a bunch of items and they'll distribute them to players but you can build interesting games by allowing crafting allowing creation of tokens by players and then just whitelist those items inside your game and display them attach them to a mesh you know and and tokenize actual player created content I could do things like you know dog tags between players that create create different tokens for each other and stuff any other questions all right well thanks everybody for coming I'd like to remind you guys about this survey please let us know how what you thought of this talk if you want to see more live demos in the future and yeah thanks thanks again and please check out the engine platform you can find us on enj I n dot IO download the unity asset off the asset stores start playing around thank you very much

You May Also Like