Les Amis d’Ethereum France #9.1 — “MUD: An engine for Autonomous Worlds” Justin Glibert, Lattice
Ethereum Paris·Mon, Oct 9, 2023, 12:00 AM
Speaker
Pour ce premier meetup de l'année nous avons le plaisir de vous inviter pour une édition spéciale Onchain Gaming en présence des équipes de Lattice. Ces derniers étaient notamment impliqués dans la track Gaming de Devcon Bogota. L’évènement aura lieu dans les locaux de Cometh rue des Belles Feuilles. Au menu ce mardi, démonstration et présentation de jeux et d'utilitaires de jeux tirant partie de la blockchain pour offrir une expérience novatrice. # AGENDA — 18h15 à 20h - GRATUIT “ MUD: An engine for Autonomous Worlds” • par Justin Glibert de Lattice "Supporting a P2P rental system in a game " par Vincent le Gallic de Cometh Plus d'information: https://lattice.xyz/ https://mud.dev/ https://battle.cometh.io/ -- Les Amis d’Ethereum-France #9 avec Lattice & Cometh: "On Chain Gaming" Lien du meetup: https://www.meetup.com/fr-FR/ethereum-france/events/291155500/ Rejoignez Ethereum-France sur: • Blog: https://www.ethereum-france.com/ • Twitter: https://twitter.com/Ethereum_France • Discord: https://discord.com/invite/2cGc5JP4JC • Meetup: https://www.meetup.com/fr-FR/ethereum-france/
Transcript
[Music] my name is Justin I am working on loudest um lattices part of a larger group called zurich's Park um as we're expecting a lot of zero knowledge research research in on-chain gaming distributed Networks education and stuff lattice is a company that has been building on this idea called autonomous world for a year and a half essentially what we're aiming to do is to build very crazy things on ethereum you can stub whatever blockchain you like there but it it's based on the realization that all the smart not all the smart people that's a very big generalization but a lot of effort has been spent on what I call the hardware stack of crypto essentially anything beneath the application layer so consensus um PW Networks scalability VMS Etc and then you reach the Eurasia software layer and what you have there is only product people um and if you look at personal Computing industry we have multiple areas of abstractions even on the software side we have operating systems with browsers we have just a lot of work nobody programs bare metal right just writes app that runs on CPUs that's not the case um and essentially oh I think my oh my mic is back um essentially what we've seen same with the with the personal Computing Revolution is that the hardware people make things fast and the software people make things easy and the thing is there hasn't been any good Innovation on software side of blockchain programming basically ever people still use the programming languages we've been that have been created six years ago uh specifically for ethereum but also for other chains there are no Frameworks there are no operating systems running on chain nobody would even know what this would look like um so kind of the rapid hole we went into uh while building video games we built Dark Forest which is an on-chain game we've built a bunch of other since then it's really hard hence why we're here with the comet people because they've been trying to do the same thing you know and everybody realizes it's really really tricky but it's not about the games it's just about the fact that building big applications on channel is really tricky so we wanted to build Virtual Worlds um words with rules run on the evm and whose state is secured by ethereum right fully not just hey you have some assets on the blockchain and everything else it's just your regular old technology uh for overlords no no we want we want everything there we want to see what happens when you create a new kind of product basically um bunch of people call the marching games we like that idea but we we created our own meme called autonomous worlds main needs because we want to say hey this is beyond gaming this is about putting complex systems and giving them autonomy essentially um so the problem as I said is building stuff on chain is hard um it's it's just to give a another tangent it's very similar to the 2000 internet boom where you had to raise 50 million dollars and hire 15 Engineers to make a website because you had to write your server in C plus plus uh you had nothing about from the internet essentially and it was really hard to make anything and then you know there was more like you got Ajax and then there was the team I don't remember how they were called that made the thing that became Gmail because they discovered oh I can make a website that refreshes without clicking the refresh button and all that stuff happened and give us the internet as it is right now but I was not because of better Hardware it's better because of better obstructions um so over the last six months we've been working on this project called mod which we describe as an engine for autonomous Wars but basically it's it's an engine for anything on chain um mud essentially the goal is to solve all the hard problems of building onshine games where you can cross the games you can say on chain apps um it's to say hey every team is Reinventing the same thing uh beyond their features and there has been an entire industry that has been built around those problems you know like indexers upgradability all that stuff stems essentially from Bad abstractions um and there are three problems we wanted to change to solve sorry the first one is State sync some people called that the chaincline barrier it's the idea that your blockchain has some State and your application has some State and somehow they're never synchronized and you have to like if you have billion dollar companies they've been built on this problem nobody's incentivized to solved it inferior and Alchemy don't want it to be cheaper to sing stuff they actually want you to make requests that cost 100 milliseconds of CPU to charge you like a micro Cent for each of those um and it's hard it's not easy just to sing State properly the other thing is content um content can be seen from the perspective of a consumer product how do you add new spaceship to cometh but it's really about everything you know how do you make kids such that the engineers build the engine and the designer built everything else at Facebook I mean most famously but messenger all of messenger is actually a massive app engine and every screen in the messenger app is actually made by designer they don't code or the code barely because I missed the engineers messenger like solve the hard problems and Engineers don't work with product managers they just build the engine that builds messenger so you want to turn stuff to content and from a perspective of video game there is that story around World of Warcraft where they spend five years building the engine in one year making the game afterwards and all the designers that prepared everything already they had tried on paper and in Warcraft 3 and then it should work and then just put all the content at the end the last problem um interoperability interoperability is kind of a meme everything interprets with each other but actually it doesn't it's really hard interpret he has largely under delivered but there's Financial interoperability but applications are mostly siled and the reason is it's really hard for apps to talk together um because we have a bunch of standardized languages like oh do you own this thing yeah and that's it that's it's a very primitive language it's a homo Economist because language we just talk about owning things um so this is a bit technical so I won't go too much details but essentially if you've built um smart contracts up and then you have tried to make a front end for it um this is specifically from the perspective of organization what you do is you describe like hey what your app is made of you know like a monster you would describe the same structure on your client adding this you put a function in a smart contract that says hey this is how I get all the monsters when my app starts and you put an event which is hey every time I guess example the health of that monster changes there's an event that is emitted and I'm subscribing to it so I can change it in my app and then you have to redo the the same freaking thing every time you add a new type of stuff and so you end up with thousands of line of spaghetti code everywhere so what we wanted to do is say hey like actually if we just solve the problems and let you be fun creative novel uh make good content I can't turn all of these into verbs and design cool stuff um and so what we did is first um we said okay the video game industry has the same problem of Designing for extremely large complex applications right and one meme that emerged amongst the video game industry is this idea of ECS entity component system um turns out Apple built all of their software on the same thing it's just not called ECS it's called entity attribute values but maybe people ReDiscover the same thing the idea is to say hey every single thing you care about is a number and they're all unique like I'm a number this computer is a number this board is a number the idea of God is a number um and then the thing that gives substance to those things is components components are just pieces of data that attached to those numbers um and those components do not care about the other components there so example the notion of embodying something like the fact that is true there is embodied and I am embodied it's just because we both have a position component but the position component doesn't care if I'm a chair or if I'm a person right so that's what a component would look like um each entity you know entity one has a value for that component so as example if this is the core component entity one is blue entity two is null it doesn't have a color entity 3 is green but it doesn't care about what those things are it just describes them a color um then we have systems the idea of systems are there are pieces of logic that ex that do things with components but don't care about what the thing is so the move system can move anything that is a position it doesn't care if it's a chair a person a monster anything as long as it doesn't move the position component can move it you can also operate over multiple components if you want to um but again it's all about modernization um if you wanted to do something like a token with this idea you would say okay with a balanced component where every address is a balance and with a transfer system that decrease the balance and increase another balance and it doesn't care what owns the thing right now like I think sport erc20s can only give a balance or addresses but what if you want to give balance to other tokens or like other things and people make monstrous Solutions in order to do this but you should just motorize the stuff just like I allow the the the the system I mean not the system I don't want to call two different things the system allow the app to ascribe a balance to anything right um and in a way we synchronize things so here folks might have used things like the graph indexers blah blah the problem with those is you have to teach them how to understand your application you have to write a sub graph you have to write code here the way it works is every component every time one of their key value change they just talk to the world which is the central contract and they say hey um enough that has occurred that contract just emits a stream of event that the client can read another client can reconstruct the entire state the client could just listen to a single Bible and be like I know how everything is changing in my application um and the way you synchronize them is you define some components in your contracts you define the same one in your client and then they're magically linked together you don't have to write any code that connects those two things together the state on the client is going to magically reflect the state on the contract um you can also have an indexer there the nice thing is you don't have to write code when you use a mud indexer there is no sub graph you just boot a program and then it knows about your whole application and it's in a postgres database and that's it and you can just ask it any question you want because it understands how your app has been written it doesn't have you don't have to tell it how you did it um and then the way you make stuff is literally you just connect the components together so like a fighter in a game or in like does this equally applies to any kind of applications but maybe it's just a thing with health attack and movable and the contract doesn't care if it's a fighter just knows that it's a thing that has those stuff um I'm on a dragon cool like make a new entity and bump the number up you want to make a defense store remove the movable components you create a new component the healing component cool now you can make more stuff um so it's it's all about modularizing your logic in your set um and there's also kind of like tangently makes interoperability way easier because when you want to connect those words together and make them talk um they need interfaces to understand each other right and mode is kind of an interface for everything on chain as opposed to specific things so if we take as a case study here c721 which is an interface for fungible sorry non-fungible ownership the only two questions you can ask is what's the balance of this address and what's the owner of this token but you can't make complex questions like hey um what are like like how many people own something with that stuff as an example you can't make those questions it's impossible and so the thing we do with Mod is every mod app you can send a query to it you're like hey can you give me all the entities whose owner is uh XYZ and that if the attack component the movable component and you just send that query and you get a bunch of stuff back so it's it's genre Gnostic that's where I copied the slice representation we made when we were made when people were amazing using it to make games if not people use it to make everything but it's basically you can make anything so to prove that we build a with a Minecraft on the blockchain um all of everything runs on on ethereum and we build a strategy game with mod and they're very different games different applications Sky Strife is the real-time strategy game inspired by um sorry my computer is progressively falling to the left I have to rescue it um skystrive is very inspired by um what's this Nintendo game now I'm blanking uh advanced war yes advanced war um it's made out of 39 components two into systems and zero networking code when we worked when we wrote skystrive I mean we found bugs in the networking code but when we solved it it sold them for everybody else and we we didn't have to spend time like oh what's the indexer how do I synchronize the state how do you do that actually why the way you write SkyDrive is the application thinks it's basically a local application it has a little database in your browser that knows everything about your app and you just interact with that same thing with opticraft we did it in we built it with optimism I was the tour the two companies building that together um eight components seven system zero networking code and it's basically very similar right like you make a Golem in Sky straw if you just put a bunch of components together you make a block of grass in opgraph you just put a bunch of components together it's just the way you represent it that actually matters and what the rules are so yeah that's what you get with Mod you get steat sync adding content is easy interoperability is on steroid and your problems are solved I mean now you have your real problem which is to make a good product instead of fighting like shitty Tech stuff that like takes you like two years and 10 million dollars anyway um that's why people need a lot of money these days you know first they have to solve all the crap problems um so foreign that's running on the blockchain so let's let's give some disclaimers here so this this the positioning like the fact that my friend is just moving around and looking at me that's a peer-to-peer Network that's not secure very ethereum but it doesn't matter all the blocks all the crafting the procedure Generation all of that is on fully on chain um you can see actually on the top the video is personal but you can see plus two minus one that's literally a block Explorer you can see the blocks that are broken and added in Minecraft in real time um and we had oh I don't want the video to play again we had a 1.5 000 players play uh do pretty interesting stuff or with four actions they could break block place blocks craft things and claim so claim is pretty important to explain for something I want to talk about later basically the way it works in opencraft is diamonds are not used to make armors they're make to make stuff yours so you can put them in a chunk which is an area of space and now nobody but you can break blocks during Dropbox there unless someone puts more Diamond than you and then they they just essentially they wanted capitalism sorry and then they can take your stuff um and that's it those are the four Primitives the client was open source people could change it and everything was built on mud which means that and this is something I didn't tell you because it wasn't important yet but in mud it's not just a first party developers that can add components and systems it's anyone anyone can add new components in system to a contract that is already running because it doesn't break the rules right like if um I don't know who's in the back adds a component that is liked by rap in a game and he marks a bunch of stuff at Black by rap well that's fine you know like everybody knows about it but they don't care or maybe I care and I change my client and and the things that are like by rap they're slightly golden but you can you're free to lay new meaning on top of the world that's what we do actually here right we don't need to get an agreement from God in order to play tennis or like pay money to children like hallucinate capitalism those are rules we laid down on top of the low level rules um and they went hard with this it was running for 10 days it was a new new technology and people did super cool stuff so first as you expect people build a lot of things together um just just lots of stuff lots of pixel arts and stuff like that but then it became really interesting when a couple days later people understood how to change the game so um the first thing we saw is someone made a drill plug into mine diamond automatically that's what everybody does in every single video game uh and then someone made a better one that mines even faster uh that's uh and that's peer-reviewed science and building on the shoulders of giants um someone made a chat plugin that everybody used to be able to talk together um yeah I just changed the graphics but then we saw somebody something really interesting that you can only see in a game that runs fully Unchained um someone built the autonomous People's Republic of opcraft so that's basically a communist government created by an anonymous person and what they did is they just mined 300 000 diamonds in one night probably with a lot of machines and a lot of bots and then they claim every single piece of land who's there was that stuff built on top of it around the spawn and they were like we declare the independence of epicraft um in order to join the alliance you have to install a plugin on your game that literally transfer your entire inventory to the inter inventory of of the of the Republic and in exchange you can build on top of the land controllable Republic basically and the way they did this and this is the plugin it even had a social credit system where you had ranks it's uh inspired by some great successes out there in the world um and that's the inventory you had when you when you joined the Republic you had 161 000 diamonds and a bunch of other stuff people built monuments with that it was really cool um yeah that's that's the monument they built this is a an uh this is an idol for the for the the the supreme leader um and here's what it they created they changed the plugin sorry they changed the client and they told everybody install that plugin and they added a new component the comrade component that is essentially a registry of all the comrades and in your system called the government system that comrades can use to build as as the Republic basically it's almost like a proxy and they did that without asking us anything they didn't need to apply to be a developer they didn't need an API key they didn't need to like uh I don't know mod the game and Fork it because you know we've had modding before but modding always involved making a copy of the thing and then convincing everybody to move to eurocopy that's like modding on top of existing things um which I think is quite interesting um and and you can imagine how doing stuff like that in a traditional game would have involved putting those social features those like literally like it's basically societal infrastructure right how do you get the players to play together you you would imagine that they would have to put that amongst the Bayes actions right and that's what every game does they add start Guild as like a thing that exists in the game right it's like part of the rules and then if drawing Guild Battle Gear blah blah and you have to bundle all of this with the low level rules uh and then what the players can do well they can talk about it on Discord or on forums but they don't have much agency beyond all of this whereas in something like opiecraft you can totally start layering those things on top of what origin exists the only thing that people need to agree on is the low level rules and then everything else can emerge on top of that um yeah you can get all the classic hallucinations we have um religion money uh social structures Nations and so forth um so those are some little stats we like made almost four million transactions 1.5 000 players lots of traps uh I didn't show that but people got stuck in holes all the time there was a whole Squad of the score that was digging people out it was pretty funny um plugins and and one supreme leader so that that was a little experiment we run for 10 days and it was interesting to see yeah you can build something that um is akin to an existing game in five weeks we had print engineers build this in five weeks um and and it scales I mean to some extent at the end I think you had to download the gigabyte of data to start the game uh it literally it really stress tested the whole idea but and he gave us new new um it gave us new ideas for the V2 of the whole architecture but it was interesting um and the last thing I want to show you today is this little game we've been working on um that we actually played with the comet people earlier today so I have to do I have to juggle between two different presentation let's go okay uh don't ask me what people are making figma presentations at lattice I don't know um so this is skystrive Sky Strife is basically it's like advanced war on the blockchain uh it's a cute supercell-like advanced war where um you everybody brings little units in a strategy game and they'll try to escape with the crown and whoever skips with the crown wins so um this is what the game looks like I mean this is just like I'm scrolling through a map um it's it's pixel art um you have to compete for the Ember cron you grab the Amber Crown everybody wants to kill you and then you escape if you manage to escape with the brown the game ends there are alternative objectives you can steal all the stuff on the map and essentially as soon as the Crone escapes everybody ends with whatever they have in their inventory and then you can bring your items back in in other games and and craft stuff and so forth the classic so the way it works is you make armies you move them on a grid and you make them fight you can see that underneath settlements which create armies and units there are little um yellow dots those are action points so the game is neither turn by turn nor real times why did we do this well turn by turn games are really annoying because you have to wait for everybody to finish their actions before doing yours and that doesn't scale to many players real-time games are unfair on the blockchains because machines are gonna beat the out of you because they can play a thousand times faster so how do you make a system where people are bounded in terms of their actions but you don't have to wait for other people to finish your turn so the way it works is you can only do so many things whether you unit and then you have to wait for color code the new turn for all of them to get new action points um the way you progress is simple merging mechanics you take 2D units are the same you can move our fall on um and you have battles people fight uh and they have to place themselves at the right place use range units in the right way upgrade themselves and so forth it's pretty fun um and that's that's the determinator mechanism so you can see those three units they didn't have action points Boom the Energy Research kicks in they all have new auction points some regenerate faster than others you move them they're out but we have to wait for the energy search so it's a mix between real time strategy and uh turn by turn I don't think anyone else has done this before this is a weird thing we ended up with because of the constraints of the chain but it has been interesting to balance it um and it's built with mud uh it's 10 000 lines of solidity built by a single engineer because it scales really well it's complex it's not it doesn't become spaghetti basically it's very well organized so for a few components 32 systems um still shipping um this is as an example how you define a swordsman in the game and you can see that a sword man is just a bunch of component attached together the game actually doesn't know what a swordsman is just oh yeah it has some don't bother about the unit time that doesn't have that's um it's just about telling the client hey if you see this blob of things render it as a swordsman but it doesn't matter in the logic we could actually completely drop that but what the swordman is is it's it has stamina it can fight it can move it can be traversed and then it has an inventory and if you want to make it Fly Just Add flying component boom no new source man Supply um so actually the nice thing is because everything is content um the whole map of the game is just a Big Blob of ECS data it's not called we have a map editor because of that people can make their own map um so that's it's really pushing what you can do on chain actually most of the time people just like write very big smart contracts and that's it they have a few contents here we decided to do kind of what what people did with World of Warcraft we made the engine um RAF wants to build a mobile on it to see if it's fun uh you can make a 1v1 game you can change it it's it's pretty flexible and that's the nice thing we're living a lot of content you just make a game that can actually don't build a game you build a thing that can express a various like area of products um I don't know what this slide was for this is like an old presentation but yeah that's all I wanted to show you I'm happy to take questions I know this was this is a bit weird um you might not be used to that stuff but I wanted to show like hey um if you essentially stop thinking about scalability for a little bit if you really hold in your mind that there is a Moore's Law of crypto and it's actually faster than Moore's law in terms of how much compute we can run on on distributed networks and how it fast accelerates basically how fast do we go from a Macintosh to a Xenon server blade and it's a couple of years and you can make hacks actually to go faster and like give up a bunch of security so the idea is okay if the hardware is going to get way better weekly how are we going to manage all that abstraction and that complexity well we have to build software obstructions so I know those software absorption come with cost no D5 person would build their app in mode oh God damn they're going to pay 10 cents more every time they make a swap but it doesn't matter when gas goes to zero right so we really just said okay we don't care about scalability we don't care about financialization we know like 10 people are going to want to play this game but it's a great way to exploring the technology and we're starting to see um more and more interest in this and it's striking how much can be done compared to 1.5 years ago and so that stuff is accelerating pretty fast so yeah thank you [Music]
Automatic transcript — names and jargon may be misspelled.