ZKPodcast: ZK & Games: Dark Forest with Brian Gu
6 Aug 2020 · 1:02:40
Anna Rose talks with Brian Gu, an MIT student and creator of the blockchain game Dark Forest, about building an onchain space-conquest game with incomplete information. They discuss how zkSNARKs create a cryptographic fog of war that hides player positions on a procedurally generated map, along with the broader design space for zero-knowledge proofs in blockchain gaming and what drew Gu to the project.
Speakers
Topics
Transcript
[Music] welcome to xero knowledge a podcast where we talk about the latest in zero knowledge research and the decentralized web the show is hosted by me anna and me frederick this week frederick and i speak with brian goo about dark forest a fully decentralized zero knowledge proof-based game built on ethereum but before we start in i want to say a big thank you to this week's sponsor leased authority leased authority is a team of security researchers open source devs
privacy advocates and cryptographers they're known for their security audits and reviews like the eth 2.0 specification protocol labs gossip sub protocol zcash sapling upgrade tesla's foundation's as well as others they're also known for their work on zero knowledge proofs integrated into the tahoe lab secure distributed file store with their zcaps zero knowledge access passes so for this particular spot they wanted to let our audience know that they're hiring right now they're looking for a technical writer to help write security research and audit reports as well as open source technical documentation and privacy analysis statements they're also open to hearing from anyone who's
interested in working in advanced security in distributed systems or who may be able to contribute to this mission to promote privacy in some other way if you want to find out more check out leastauthority.com zkpodcast or check out their jobs page i'll add the links in the show notes so thank you again leased authority and now here's our interview with brian goo so this week frederick and i are catching up with brian goo who's the co-creator of the dark forest zk-based game welcome brian hey anna it's great to uh to be here with you and frederick um just by way of introductions i'm a student at mit
studying mathematics uh this summer i'm working on dark forest which is a fully decentralized rts game built on ethereum with zk snarks other than that i work with the ethereum foundation to help out with some education and recruiting sorts of initiatives as well as on uh research and development related to ck starks so the plan today is to talk a little bit about education in blockchain blockchain games generally but the main focus is going to be on dark forest and hopefully we get a chance to understand why the introduction of like zero knowledge proof systems actually adds something to this game where it's not just like as i understand it's not just like a nice to have but it actually like helps in the mechanism itself you
already did a short intro to yourself but i guess maybe as a continuation on that what first got you excited about zero knowledge topics like what was your entry what was your entry point into that research space uh in late july of last year i went to a conference it was one of the uh ethereum foundations sort of research workshops that they hold once every couple of months and that conference was particularly focused around uh some advances in zero knowledge which was really blowing up at the time like this was summer of 2019 so a bunch of new protocols were coming out jordy had just published um you know his his snark jazz and uh what's now wasm snark
i went there and i was just blown away by the fact that this thing which i had totally i've been peripherally aware of i thought it was you know it sounded like this awesome cryptographic thing that was like totally not feasible like definitely moon math but really cool that was actually feasible for use in applications as of that time and there was just so much work and activity going on there so after this around the same time i was also reading a lot of like science fiction and i just read leo sachin's three body trilogy the second work in that trilogy is called dark forest and that was sort of an inspiration along with diving into what was going on and what was possible in zk snarks to start getting a little bit more involved and in particular the idea for dark force the game came out of that as
well so um yeah about a year into the zk journey it's funny because um some folks if if anyone's listened to the the episode that i did recently on trusted setups i think your name may have come up in that because you actually did do some work already like i think you know we're gonna spend most of this episode talking about dark forest but you've actually done a little bit of work on sort of this other part of zero knowledge proofs as well so what what did you do for trusted setups what's yeah so what's your contribution there um i met uh wagia and kobe and barry at some of these workshops as well and they kind of introduced me to um this project semaphore that they were working on and in particular i was working on both dark forest and some more general
ethereum related things over over fall 2019 and they sort of asked you know they were it was on the horizon for them to be getting a trusted setup going for semaphore and they asked if i might look into some of the tools that people were building in order to see if anything could be repurposed for the semaphore multi-party computation trusted setup ceremony so i looked into this you know it looked like the state of things was was quite primitive well there's yeah there had been like six or seven done so like in total yeah so really not much out there a lot of it was just like manual like you know someone would coordinate on a mailing list people were just sending like verifications back and forth um one of the best ones that we were able to find was uh the aztec protocols ignition
ceremony and you know they they've done a really wonderful job with that and at the time that was definitely i think the largest trusted ceremony setup ceremony that had been run and they'd also open source all of their code you know i spent a bit of time around like late 2019 just repurposing that repackaging it to work with more general kind of just arbitrary zk circuits um and you know we ran a small trusted set or we started running a small trusted setup ceremony a couple months ago for semaphore based off of that but still a lot of work to do there but that that was you brought sort of the automated coordinator that we actually talked about in that previous episode you brought that to semaphore right like from the ignition this idea that you know you no longer needed this mailing list
person who's like manually sending it out but would actually happen more automatically right right and you know it was a very it's still a very like primitive kind of there's a lot of manual steps still involved um but i think that you know i know a lot of people are thinking about this as more zk projects are on the horizon totally i think that's a i think that i struggle with as well i've been invited to participate in some of these setups but it's really hard to like figure out when to do what and how like even just like from the point that i picked up the message to coordinate with myself like what i'm supposed to be doing is hard so just having like an app tell me what like what's the next step when am i
supposed to do that stuff well they're definitely developing uh as we speak i wanted to ask you a question on on what one of your intro comments you said you worked a bit in education is that in within zero knowledge stuff as well or general blockchain stuff or what kind of education yeah so um one thing that i am really excited about just in general is sort of community building especially community building uh within sort of technical spheres so for example i run this one program called hack lodge which we sort of describe as like summer camp for hackers um the idea is every summer and winter we get a big airbnb um we find 20 of the best sort of undergrad engineers and math students
in mostly us colleges that we can uh whether through you know our kind of organizer networks or alumni or just people who have built really awesome stuff in our students um and we all just we invite them to come hack with us in this big house for a week we run like workshops have talks and everybody comes out with some sort of shipped project and as i've been getting more involved in ethereum i have found that the sort of student who likes a program like hack lodges is oftentimes going to be someone who's also really into kind of the frontiers of what's going on in decentralization on ethereum or whatever else so i work with like a number of other you know peers or undergrad students um to get them excited about like what's actually possible in the
space i think that there's a little bit of a misconception um especially in universities that you know crypto isn't really like a serious thing it's just a bunch of these scams icos whatever and one of my goals um and and you know i i try to bring people into like for example those ef workshops um especially undergrad students to show them that hey there's some really cool stuff going on here if you're interested in math or engineering or computer science then this is a place you can really sink your teeth into and be early in on some of like the the coolest problems depending on your particular interests it's actually it's such a shame that like that ico smear still exists i don't know what else to call it i i don't think it comes from
the ico thing strengthened it but it comes from bitcoin i mean it this has been around since before ethereum this is uh the general attitude like i i typically say at least half of all programmers think blockchain is wow you think still yeah yeah for sure like if you go on the first subreddit like everything blockchain gets downloaded and just oh this is just a high part and or buzzword and it's all hype there's nothing to this and i think it comes from bitcoin originally where people just don't understand cryptocurrency or like what it's for especially in the western world and so they just attribute that to every other blockchain project as well like
why if i don't see the point of an electronic currency then why would i need any other blockchain do you think the hacks though like the mount mouncocks and maybe some of the characters who originally like dominated the space may have had an influence on that too i don't i don't think they get i don't think that people that are like detractors to that degree actually get that okay i think they just go like a proof of work waste energy and this is this and i think don't don't dig further it really speaks also to at least in my experience talking with you know peers or people who i'm bringing into the space the fact that there's just not really that many great entry points like you know if you search
any you know intro blockchain kind of related concept just in a simple google search the chances of you getting something really meaningful or you being able to tell what's meaningful the signal from the noise is just going to be so low and that's been one of the initiatives especially with these workshops um you know we want to bring young people into these workshops to show them like to give them a actual safe and kind of like legitimate introduction into crypto like hey you know here's where the here's where the interesting problems are here's smart people working on them yeah i think that's a huge problem i mean this is something that i think and and work on a lot too is all the material is written like by crypto anarchists for crypto
anarchists and if you come to this phase not being that then you're like what the is this you have no way of actually learning or written by advanced cryptographers for advanced yeah and then then it's just at a different level they probably won't even find it totally inaccessible yep so what do you think is missing this sort of like before we move on what do you think is missing in terms of education you sort of mention this on-ramp but can you picture anything else that you think we should be doing yeah i mean i think that you know a lot of great stuff has been happening in the last couple of years at least you know from when i started looking into the stuff in 2018 compared with now there's already a lot
of just tremendously better resources and content better con there's there's better mechanisms for servicing the better content as well um and i i point to i'm able to point people to things like you know vitalik's blog posts on zk snarks or things like that um that are able to make like you know that are able to take complex concepts and distill them down and really show people like what's interesting in here so one thing that i think about a lot is i think just having more you know the people who are working on very technical things uh we really ought to have people paying attention equally to communication um you know writing useful things creating these kinds of entry points that people can find online
um and then as a community also kind of uh you know really really encouraging that and helping to surface that especially to newbies um so i think that you know just better content and flooding kind of the network with good and useful articles papers whatever else is just goes a long way yeah i think i think one kind of one thing that's sometimes missed and this isn't i think there sometimes needs to be like a little bit more patience given to the dumb questions of the early stage questions and it's hard because like if you've heard those questions a number of times it's very boring to answer the same question again but i think it it does help like even for people at
like the dinner table even if someone asks you the dumb thing just try for that moment to like help them out at least or help point them in the right direction because i so often just sort of see people like well they'll dismiss the dumb question i mean i'm i've probably been guilty of that too but i think that is part of the part of the challenge absolutely it may be part of the solution i think the the community is certainly like i think ethereum within crypto does a relatively good job of this but like being just welcoming and inclusive in general is like you know that goes a long way totally i think there's um an opportunity for um like we've come far enough in this space and there are enough like books
and enough content that someone could kind of go through the existing material and create a new modern version because there's like antonopoulos is various bitcoin books that introduce like why is this a powerful concept and it really goes from very basics and i think to really onboard someone well you have to go back super far and introduce like why is consensus a thing even like why is byzantine fault tolerant consensus i think why is global consensus nothing but you can't explain it in technical terms because they're not there yet so you need to explain that in some other way and that's like what antonopoulos managed to do in some of his material but that's just this one sliver right so
you need to then take the best out of that and the best out of this other thing and then the best of all the latest research and produce like a new thing that introduces the whole picture to someone okay so let's move on to dark forest yeah how did you describe that you actually said it at the beginning of the episode i've been calling like a zk based game but you have a very you have a clear description of this what what is it yeah so the way i think about dark forest is that it is the first fully decentralized rts game so you know that the exciting thing about zk snarks is that they actually allow us to build you know a meaningful strategy game in a fully decentralized fashion and without zk snarks we actually just
you know prior to this we didn't really have the tools to build a game in this kind of class and to anyone who doesn't know rts is real-time strategy that's am i right yep so if you think about like you know imagine like starcraft but decentralized cool there's yeah there's a lot to unpack in that i i wonder where to start i mean the first thing that comes to my mind is how can you be real time on a blockchain yeah for sure so this is definitely you know we are constrained by the limitations of the blockchain uh so it is true for example that like essentially the game tick size uh is going to be that 12 to 15 seconds of um you know that it takes for an ethereum block to go and if you submit
your transactions sometimes you'll have to like wait a number of blocks before it's included in the next mind block um so there are those constraints the main hurdle that we're jumping over that is made possible by zk snarks is we are basically allowing for incomplete information to exist in a blockchain or like decentralized game this is something that was previously not possible you know if people are familiar with the concept of complete versus incomplete information games previously it was mostly only complete information games that were possible in these sorts of decentralized settings and i can speak a little bit about you know it complete versus incomplete information games is a very fundamental concept in game theory and it's it's quite simple and probably most people i think have an intuitive notion of this um a complete information game basically
is a game where all players are aware of the full state of the world so if you imagine something like chess or checkers you know in these games i can see your pieces you can see my pieces there aren't really any secrets as far as the game state goes but when we talk about incomplete information games we're talking up about games like poker or starcraft or you know you might think of something as complex as like eve online these are games where players might have private state there's things in the universe that not everybody knows and these are the sorts of games that open up all these strategic avenues for deception or emergent behavior or more complex social dynamics and and zk snarks are sort of the key to unlocking uh that kind of at least you know some class of
incomplete information mechanics and games that previously was not possible a game like poker has been implemented on ethereum so how do they do that without zk yeah so there's definitely a certain class of i would say like somewhat incomplete information games that you can get to with things like commit reveal schemes but for example if you want to you know if you want to have really like persistent hidden information that never gets revealed um but at the same time is able to get operated on or computed on in a way that's consistent with the rest of the game state then this is something that's really hard without zk snarks if you want to have you know some sort of game where i hide a number for some for some amount of time and
then afterwards you know i want to like reveal it and prove that i was being honest about the number that i hid this is something that was possible but to get further than that you need some more advanced machinery so like in poker you're not going to win your hand until you reveal it so like the the chain doesn't need to know oh he has this so i'm going to reward this secret amount because he has like this hand that no one else can see yeah which you would need zk for if you wanted to do a mechanic like that right right so you sort of mentioned real time and there's this limitation of like the blocks actually being written but it's it's also it's not like real time real time right it's not like you can see the other player's behavior quickly or
something like that yeah so you can sort of imagine it as like you know in the game world every tick is 10 seconds like you know normally in in uh games that are like truly real time the tick size is going to be really small just like a fraction of the second um of every fraction of a second the game world is going to be updated um but here we sort of have to wait wait those 10 seconds for for transactions to get mined so it's not truly real time but the strategy aspect is there and we do a number of kind of little hacks to make things feel a little bit more continuous as well do you think if you did i mean and maybe this is for later in the interview but if you did this with some sort of like zk roll
up or partly like off off the chain would you be able to make that faster yeah definitely be able to maybe even do more of these like real real real time games like something more complicated yeah definitely i mean so one thing that we might imagine is we could have some sort of uh you know zk roll up layer two scheme um where you know we've got some roll up node that's accepting incoming transactions rolling them up and committing them to the main chain but people are listening to kind of this like network of of roll up nodes and optimistically applying these these moves that are coming in or being sent out by other players in the network uh so that's definitely one avenue for bringing that kind of like sense of real-timeness to um you know be more substantial uh
but uh yeah we're definitely very constrained by kind of the execution environment here fair enough and i don't want to push ahead too fast so you you mentioned before it's it's inspired by the three body problem series which frederick you've read one book as i understand of one and a half and i listened to one book as an audiobook and learned the hard way that i can't listen to fiction as an audiobook at all it's actually a series that i definitely want to go back and read properly um but maybe you can tell us a little bit about that series and like what it what it you know how it influenced this without maybe spoiling it too much for people
yeah yeah um so the three-body trilogy is a trilogy of three hard sci-fi novels written by leo sashin originally in chinese and translated into english by ken leo and i think the second book was actually translated by um a translator whose name i can't remember right now in any case you know the premise of the nov of the very first novel is you know one day the fundamental physicists of the world wake up and you know they're they're going to run their experiments and all these things and they realize that like science has just stopped working and sort of you know the book is almost like a mystery or a thriller about people trying to figure out like what the heck is going on here like you know why are our particle colliders always just like
giving these inconsistent results why does it seem like you know fundamental physics itself is wonky a little bit of a mystery aspect to this and over the course of the first novel that's explored in the second and the third novels lewiston sort of branches out into a greater like cosmic scale you know there's there's all these discussions of sort of dynamics with extraterrestrial civilizations universes multiverses it's a it's a very like wide reaching in scope uh kind of trilogy but there's a particular thought experiment from the second book that was the particular inspiration for the dynamics that we want to build in dark forest and i don't want to spoil too much but basically kind of one of the underlying ideas here is about when you are a you know a lone civilization in a large
and potentially hostile universe information is sort of your most important asset you know if you've heard of like i'm sure people have heard of like the fermi paradox and you know one of the resolutions to the fermi paradox is sort of that like perhaps civilizations are afraid of kind of broadcasting out information about themselves or about their location because you know there might be some hostile civilizations out there that are willing to that are just you know ready to conquer or eat up smaller or less developed civilizations this is something that's kind of a very a very central theme to kind of one of the thought experiments or premises of the trilogy um cool and yeah can you i mean i i sort of hear you don't want to say you can you say what the problem is
is that is that it that's like the example that you want to yeah i mean so we can talk about how that manifests in the game and talk like yeah yeah i guess we can sort of put out a warning now to our listeners who are if you're in the midst of reading this maybe you just like pause and resume this episode once you're finished book two or you skip ahead a few minutes and we'll probably be back on the zk topics but yeah what what is the thought experiment maybe in a bit more detail if if you don't yeah for sure yep yep so the uh dark the uh the dark forest thought experiment is actually something that was you know conceived a long time before the three body trilogy was published and it's it's one of the answers to the fermi paradox that
is thematically more around like oh you know we're in a hostile universe and maybe civilizations don't want to be willy-nilly about broadcasting their existence in the case of hostile actors and one way to kind of think about the dark force thought experiment is just to really put yourself in the position of you know suppose that tomorrow humanity discovered an alien civilization right like suppose that we discovered you know at this bearing in this direction and this angle there was you know this planet 10 light years from us had life on it one thing that we can do is we can kind of think about well what would be the game theoretic consequences of us having this knowledge right you know one really simplified way to model this is kind of we can think
about either this civilization is hostile i.e you know if they encounter another civilization they might try to destroy it conquer it whatever or just do something generally against our interests or let's say that they're cooperative which means that they are like literally any kind of player besides a malicious player a hostile player so you know there's this kind of almost like prisoner's dilemma situation that emerges when we think about all right well if we know their existence they're likely to know our existence and essentially we're stuck in this almost one-shot prisoner's dilemma with them you know i either we can both choose to cooperate and you know maybe better both of our kind of species together uh if one chooses to cooperate but the other
civilization is hostile and defects then you know you only get one shot at this prisoner's dilemma you might get run into extinction um especially given maybe you know nothing about the technological ability or superiority of this other civilization you know so in a one-shot prisoner's dilemma the only equilibrium really is for both sides to defect so the result of this is that well if you're a civilization in the universe that you know potentially has the ability to explore other star systems whatever look for other life you want to be really careful about keeping your own location and your own existence very very private because if you broadcast that out to someone else if you broadcast that out in fact to the entire universe the entire dark forest
of of other species or intelligent life you don't know who is going to take the other end of that one shot prisoner's dilemma and try to snipe you and get you out of the game uh before you're able to do damage to them in a where in a weird way by broadcasting you're cooperating yeah aren't you right right i mean and then there's sort of these second-order effects also that are super fascinating so you know let's say you're in communication with another civilization that's close to you you can do things like threaten to broadcast their coordinates out into the universe but you know if they know of your existence there's a symmetric thing going on and there's almost like a mutually assured destruction uh kind of dynamic here because you know if i broadcast your coordinates and someone starts a more advanced you know species
starts poking around this corner of the universe maybe they're gonna find me too and try to eliminate me as a potential threat um so there's all sorts of there's a bunch of different layers and and that's kind of one of the central themes that's explored in the last two novels in the trilogy which i found super super interesting cool cool all right an end of spoiler here sorry i can sort of see how this turns into a game for sure but uh maybe just explain how does it actually translate into your game and and yeah what is the game actually about what's the gameplay for sure you know first i'll just kind of give the high level overview of what exactly it means to introduce private
state into the blockchain with zk in our context um and then you know we'll talk i can talk a little bit about the specific application and the construction that we use to essentially create a cryptographic fog of war with zk snarks so the general idea is that if you want to build a game with private state then sort of by definition you can't always be uploading your private state up to the public blockchain if you're trying to build this as a dap so what you do instead is you upload a commitment to your private state say you know the hash of your state object as well as a zero knowledge proof that that hash does correspond to some valid private state that's you know valid with the rules of the game so this
is a proof basically that you didn't just submit a you know string of bytes that you you pulled from thin air then whenever you want to make a state transition in the game you're going to upload the hash of your new private state as well as a zero knowledge proof that there is a valid transition between your old state and your new state so morally what this is saying is like all right i moved my knight i'm not going to tell you where i moved it from or where i moved it to all that this proof is going to tell you is that i moved my knight in an l shape and not even like what orientation l shape is just like some valid l shape and from this really simple primitive we can sort of build you know a very rich and expressive world
where there's this fog of war where people don't know where each other is and stuff like that so to give a concrete example let's say that we want to kind of introduce this dynamic on a game where people live you know on a on a two-dimensional grid let's say you know we've got two-dimensional we've got a two-dimensional grid that represents space there's planets in it and you know players have different sort of avatars or whatever on different planets i might initialize at say the coordinates five comma twenty and what i'll do is rather than sending five comma twenty up to the block chain i'm going to submit the hash of five comma twenty as well as a zero knowledge proof that i know the pre-image of that hash and then you know you might submit you might initialize into the game at the coordinates three comma eight and
you'll submit a zero knowledge proof up to the blockchain that you know the hash of that corresponds to some valid coordinates um so now what what do we both see on the blockchain we both see these two hashes and by virtue of them being you know hashes we can't just reverse engineer the coordinates from them so if i want to find things that are close to me like points of interest or players or whatever i the best i can do is just brute force like if i'm at five comma twenty then i hash six comma twenty and then you know maybe i hash five comma twenty one and i just you know i basically start doing all this computation for the neighborhood around me and eventually i might come upon three comma eight and i'll hash that and i'll say like oh wow like anna already published that hash so i
know that anna lives there and is close to me okay so in this way we have this cryptographic fog of war where in order to discover the locations of other players you basically have to compute a bunch of hatches in an almost proof-of-work-like way and it's it's kept secure and consistent with these snarks that we've introduced this is neat it's i mean as you're describing it the game that i play the most that has i mean a fog of war like this and is kind of it's a 2d 2d board is civ so where you're like moving closer to another civilization and you find out that you know their borders i mean in their case it's not you can't tell that they've explored places but you can see the borders of their sieve for sure i mean
and likewise here like i don't know how many hashes your computer has computed um but you know i'm i'm sort of like mining all these chunks of space out and looking for planets and looking for other players as well in kind of the same way that you know in civ um you might send a scout out to discover you know what's going on in this region of the map what's going on over here like can i find where the other players are but that's all happening with essentially computation how do you actually like parameterize this so that it's so that you can't just instantly discover everything like if it's if it's as simple as you describe it and it's a relatively simple hash function then you know i can discover millions of these
squares in a matter of seconds for sure yeah so uh one thing is that we you know had to do a lot of tuning to figure out just how large the world should really be so you know just to give a rough sense of parameters um we introduced the notion that uh you know planets like habitable planets which are locations that you can actually colonize and act on or you know contest these are defined to be uh coordinates that hash to you know a hash that starts with a certain number of zeros so in particular i think it's like you know one in every two to the fourteenth or so squares is going to correspond to a valid planet so you're going to have to be hashing
about you know on average 16 000 coordinate pairs before you find a point of interest we're all we also tune the board size and sort of the amount of area per player in such a way that you know in order to find another player you're probably going to have to be running this in your browser with your cpu computing the mimsi hash over and over again for a couple of hours it is definitely true that and this did happen actually in our last play test kobe went ahead and you know he spun up some code basically to to you know compute mimsy hashes super quickly on on you know in a parallelized way and he was able to discover planets much faster than anyone else um but but that's part of the fun of it you know there's almost a meta meta game um that we hope to see evolve that comes
from players you know using the fact that computation is a first-class resource and information is a first-class asset in this game you know you we could imagine like we're building out things like an export map function where i might like mine this chunk of space and i might send it over to someone else and they can import it and suddenly like they have all that information as well um so there's a lot of lead yeah you can actually do a trade or something exactly and i mean there's a bunch more layers to that too like you know how do you know that the map that someone has sent to you is actually you know the only way you can verify it is to hash it yourself so there's all these like interesting little dynamics that we're not totally sure how they're going to evolve or if
they will evolve in the ways we expect um but that's one of the great things about computation as a resource here cool so what's the objective of the game like if i find someone what then right so um you know the real reason that we're excited about this from kind of the end user perspective is that we now have this kind of you know rich persistent strategic universe imagine you know like a persistent civ world or something like that where all of the game assets and this is sort of the line that you know crypto gaming has been taking uh in the last couple of years very strongly where all of these crypto assets in the game are natively interoperable with real economic value assets in the crypto
ecosystem so for example you could imagine someone spinning up um you know an escrow contract that basically says all right if you deposit three ether into this contract then you know that will that will cause my planet to send some amount of resources or you know population or whatever to your planet this is like really turning play crypto money into play money this is yes yes exactly and you know a thing that i think about is like there's in some sense like every human system in the world that we participate in as a game right like the global financial markets are a game the um you know property rights that's a game and the degree to which we call some games real or some games fake like you know property rights
feels like a very serious thing to us whereas like runescape though there's a very rich and thriving economy in runescape or world of warcraft those feel like games and it it seems like one characteristic that real earth games have is that they are deeply interconnected with the other systems that we interact with in day-to-day life so i sort of see the interoperability of ethereum and the opportunity to build expressive games on ethereum as an opportunity to make these games something more than just you know frivolous games like these are you know i would like to see a future where these are full-fledged virtual worlds um that like you know they're they're backed by real economic value they're freely interoperable and you can imagine all sorts of like derivative contracts and we have some of these in the works as well for kind of
composing on these coordination mechanisms on these in-game resources and assets cool what does what does it look like from a the perspective of a player like are they are they is it mostly just like they're keeping track of hashes and and coordinates or do you actually have a ui and some sort of visual representation so we definitely have actually like kobe's sitting with a graph piece of graph paper yeah so i mean like kobe's tool what it would do it just outputted like a big json of just like a list of plans we're not so cool as to just write the contracts and and hope that people just kind of you know figure it out themselves we do have a web client um that's availabe
or will be once the game is released in about uh about two weeks um the first version of the game that is and you know the client is meant to be sort of an unopinionated uh way to play this game in a way that you you just really don't have to do that much you're almost playing it as if you know the experience ought to be like you're you're playing something like civ so for example um on startup we're going to initialize a web worker that basically just starts you know using the computation power of your computer to be hashing around your local area looking for planets that kind of thing when it discovers planets um or discovers hashes that are interesting it's going to store those locally in your browser's local storage um so you're not going to have to you
know you don't have to do any fancy thing of like like managing essentially what are your private keys here your the locations of your planets um that's that's all handled um the main thing that we just want to enable is we want to be sure that this is an unopinionated and open source client that people can modify further if they want so if you want to hook this up to your gpu and go crazy on exploring like you know the upper right corner of the universe you're free to do that um but uh yeah so we do provide an unopinionated client that takes care of all of that and plays just like um or as close as we can get to a normal game within the constraints of ethereum cool could could someone else like create their own visual representation then like they could put their like they could change
all of the things from planets into i don't know like towns or something like that yeah like yeah i'm real i'm really pushing you to make this to make a decentralized sieve i don't know if you can tell oh yeah yeah no definitely i mean civ has been one of our like everyone on our team plays civ as well we've gotten sucked into many a late night as well um but uh yeah no definitely i mean one of the things that's exciting to me about like dapps in general is that they're client agnostic or at least like you know morally they ought to be client agnostic if they're not then it's kind of questionable how decentralized they really are so yeah i mean you could imagine people re-skinning the game you can imagine people i mean building useful tools or plug-ins that sort of surface information in more
convenient ways we want to make sure that all of that is possible and we'd be actually really excited to see uh some of that kind of stuff evolve on the contract end as well there's also a lot of opportunity to do this so for example like we've got this core contract that basically implements the game physics specifying what can you move what planets can you move from and to what are sort of the speed limits in the universe like what are what are sort of the game physics but people can build all sorts of coordination mechanisms on top of that as well there's like the escrow contracts that i sort of mentioned but that's that's sort of just level one you could imagine like assassination contracts or contracts that basically you know send an attack as soon as you know some amount of crowd-sourced funding or commitments have been made
you can imagine planets or even empires that themselves are not players but actually smart contracts or dows that are doing all sorts of crazy stuff um you could imagine even like nested games where people are kind of like building a universe inside of a dark forest planet or region and altering the physics of that themselves as long as they sort of conform to this top level almost like metaverse physics so definitely a lot of there's a lot of blue sky thinking here and we want to make sure we do ship a simple thing first but that's one of the things that gets me really excited about building on ethereum in general cool so i i just want to clarify one thing because i i think i switched in my head what i'm thinking about as like the game board and i want you to tell me what the right version is
so originally i thought like you instantiate a game with a set of players and then you're given a universe but then you said it's a persistent universe sounds like more like if i enter the game i'm like given a planet in this large persistent universe and then i just live in the same one as everyone else participating in the game so is it the latter yeah i mean so the flow is basically you know on joining the game you're prompted to you know initialize somewhere in the universe we have some rules about what planets are able to be home planets essentially you know for example you know based on the hash of planets they have different properties
some are stronger some are weaker you can only initialize on weak planets but you do get to choose like which planet you initialize on within the constraints of of what you're allowed to do once you initialize in on that planet then it's up to you to kind of build out your empire in this larger universe that you're sharing with everyone else okay so going back to that you sort of mentioned that kobe was like hashing or he was he was basically running this computation faster and paralyzed and was able to explore faster but isn't it turn-based or like or is it actually like if somebody has a more powerful computer they can actually do this faster or if they've had a more parallelized setup they can do it faster
yeah so the actual moves themselves these are things that like alter public blockchain state so for example i might say move 10 population from planet a to planet b and then you know the population of planet a decreases by 10 and at some point in the future depending on the distance the population of planet b increases by some amount however the local data that you are saving and and sort of you know creating with your own computation that's something that's happening entirely locally so whether or not i know all of the hashes of this big region of space that is something that the blockchain has no business in knowing in fact if that was public information that would put me at like a huge disadvantage so i want to keep that secret so for
example it might be the case that you know i own these three planets and i'm moving between the three of them kobe owns those six and is moving between the six of them but kobe has ten times more computational power than me and has just explored and he has saved on his local you know in his browser's local storage he's just got a 10 times bigger area than i have that he knows about so that's kind of the distinction there's there's work going on locally but the public state is subject to those ethereum constraints of you know block size and things like that which is why it's not quite you know it's it's not quite real time i i think uh going to game definitions it's not actually turn based like turn based technically means i have to like wait until you have done your thing
and then i can do my thing whereas real time means we can both do things at the same time and then what direction it feels like is the tick rate and and definitely like it's sort of a thing where like i have some hesitancy always when i describe it as like quote-unquote real-time strategy because the tick size is like so much longer than you know a real-time strategy game that we're used to would take um and this is just sort of where like abstractions break down like when you're working in a model where the tick size of the world is 12 seconds everything's gonna feel like a little weird like not quite turn based not quite real time but we work with the metaphors we have but then you also you do have this off chain component of exploration which is unconstrained by the chain so
you can explore as fast as your computer can yeah you're not necessarily limited so it's more like the uh the moves that affect the world are slower right exactly i have a question in here but i don't know if we've kind of already answered it but it's which parts are public and which are private then like like in the visual depiction like once you've found something you've like you've mapped it out you know it exists you know somebody else has potentially mapped it out as well but can you see can you see the other players like if they alter and something can you see it if you've already explored it or do you have to explore it again to see
it yeah so this is something that like you know it might actually help to go through specifically like what is going on with the zk snark like what is the zk snark hiding um when i'm doing these computations so you know public state uh is like you know we mentioned before maybe i live at five comma twenty and you live at three comma eight the hashes of those coordinates and the players who sort of own those locations that's going to be public so whatever the hash of 5 comma 20 is that's going to live on the blockchain there's going to be some mapping that basically associates that with my address and likewise for the hash of 3 comma 8.
5 comma 20 like those two numbers are going to be private so those are basically you know they're only stored locally they're in my browser's local storage and in fact i really don't want those to become public because kind of like we talked about with with the dark force example suppose everybody in the universe knew that i lived at five comma twenty strong players weak players um and everything in between i would be i would be at a really big risk that someone might try to send some attacking or conquering force to those coordinates um so within the snark the thing that we're basically doing is zero knowledge proof of is that i know the coordinates behind this hash i'm trying to understand that then so like
say it's say it's you and i and we're playing against each other and we or we're close to each other i know that i know that the planet you're on exists because i've seen it so what you yeah so what you've done is like you've hashed all the coordinates in your sort of neighborhood in space at some point you hashed the coordinates 5 comma 20 and you got some you know some string of bytes you every time you hash some coordinates you take that string of bytes and you check the blockchain to see has someone already published this string um and in seeing that i've published that string before you can know that basically you know i've also seen 5 comma 20 i live there and that's consistent with what you've seen so the
hash function you know by its deterministic nature is going to ensure this consistency across all the data but i know that you do live there then yes yes so because you know that like public information associates my address with that hash public information does not include the coordinates but you happened of your own accord through your own computation to have determined that five comma 20 associates with cash so if i've see if i've gone by that place and actually explored it myself then i do know that you live there but otherwise what's public is just these hashes and i actually don't know what's underneath them exactly so like i know that maybe i know how many places you or i know how that you've explored a lot of things or other people have explored a lot of things i can see a number of hashes but
i can't see where they've explored unless i'm in the same place that's exactly true i mean and then there's maybe some tricky things that people can do really to if you if you like correlate the moves between like different planets in your empire um there's there's some interesting stuff that you know you might be able to glean from that um but yeah i mean just the hash in isolation isn't going to tell you anything about what is the planet location underlying that if i find a planet can i publish is there a knowledge proof that i know where a planet is so i can sell it yeah i mean that's definitely a thing that could happen i mean i could imagine like off-chain markets or off the core contract markets
happening it's basically like these information markets right where you're like hey i've just discovered a really valuable and rare planet like here's the zero knowledge proof that i know where it is um and you know the planet properties are determined in sort of a similar way that like cryptokitties have the dna string the planet hashes kind of its dna um you know you you can inspect the dna and see like oh yeah this is in fact a really like rare and valuable planet then you might be able to auction off that information as well or you know suppose that you find like anna's location and anna is a really like you know she's up on the leaderboard and people really want to take her down you could be like all right everybody like i'm going to broadcast anna's coordinates or you know i'm going to sell anna's
coordinates and if you want to attack her then like you know you can do so with no repercussions because you know where she is yeah exactly how do the attacks actually happen in this so like so far i've i've followed what you've said about like exploring and identifying where people are where you are yep but yeah how do you ex actually before i ask that when you've explored an area say you find a planet do you take over multiple planets or do you only live on one yeah so you you do take over multiple planets so you know you would move some forces from your home planet to this new planet thereby conquering it um and now both of those planets are planets that you own and you can move from and that's an action that you actually have to take it's not that you find it
and then automatically move right right because you have to let the blockchain know that like hey i am you know i'm doing something to alter the public state and that is to add this new hash in and declare that i'm the owner of it okay so now now back to that question how do i attack yep right so so because like do we have ships what do we have right so it's a really you know we're working with basically like really bare bones kind of resources and mechanics here okay and we do a number of interesting things to make it feel fairly real time to the extent that it can the particular the move mechanic in particular is kind of interesting so let's say that i have discovered that you live at three comma eight and i live at five comma twenty well what i'm going to do is i'm going
to submit to the blockchain uh a zero knowledge proof so let's say i want to move say like a hundred military forces um you know we're gonna say like population or military forces is kind of like the fundamental unit in this game for um sort of attacks um let's say i want to move a hundred forces from my planet at five comma twenty to your planet at three comma eight well what i'm going to submit to the blockchain is i'm going to submit the hashes of both of those planets as well as that number that i want to move from planet a to not to planet b so i'm going to submit like i want to move 100 guys from planet a to planet b and then i'm going to submit a zero knowledge proof that i know the two locations that are behind these two hashes um and
that i'm going to submit a zero knowledge proof of an upper bound of the distance between those two planets um the reason i submit the distance is basically because you know we want for ships to take time to move from planet a to planet b um so you know i don't like if i'm really far away from you then a malicious a malicious actor might just say like oh yeah like actually we're just distance like one unit away from each other or something like that um so the distance zero knowledge proof ensures that all of the moves are happening in a valid way kind of like how we talked about like you know the knight is moving in an l shape it is a valid l shape i'm not going to tell you what the starting point is or what the ending point is ending point is but it's an l shape
that's like two two units in one way and one unit in another way and then when when those hundred forces arrive the winner is determined by how many forces the other person has there right right um and there's there's some you know trickiness around the fact that like you know you can't set up like a cron job on the blockchain uh you know you can't set a timer for something to happen in the future so you have to do a little bit more trickiness there um but it does end up working out and being consistent with the zk proofs which is it's a really fun construction i encourage you know if anybody's interested in the source here um always happy to to talk more about it i mean this sounds like something that we should definitely try out to really see it in action
um you mentioned it's coming out in two weeks from when we're recording which should be what like the beginning of august yeah about the best right right i mean between you know we're we're thinking right now like we're planning for august 7th um so somewhere in that kind of late first week early second week of august is when you should be able to go to zkga.me and and basically see for yourself um what snarks can do here so we're super excited for that um we did run one play test earlier in and we've been running some like more like alpha kind of like internal play tests uh as well and uh we've been very excited so far about the dynamics that have evolved especially like kobe's thing among others you're working on ethereum so there's
only one kind of zero-knowledge proof construction you can really use but what what are the tools that are that make up the zkp game right right yeah so this is this is a really good question especially for anybody out there who's interested in developing uh zk apps um you know we struggled for like a couple weeks like finding the right tool set to use but we found that jordy's kind of stack that he's putting together at ident 3 has been enormously helpful so that would be you know circom the language for writing you know zk circuits that compile eventually into proving and verification keys as well as snark js which is you know a browser library for computing snark proofs and verifying proofs and all these things um that that works in browser applications in javascript
um and so you know of course the space is super early so a lot of kinks are being worked out and like all these different tool stacks um but yeah that's that's so far what we've been using and you know it's been working quite well so cool so what are the interesting sort of limitations that you've run into using zero knowledge proofs in this context yeah so we've definitely run into plenty of limitations along our journey in getting this game working um among them you know first and foremost is definitely just going to be that like the developer kind of ecosystem for building zk apps is just so early like you know the tooling is relatively primitive just because these things have only been possible very recently and that comes out in a number of
interesting ways uh namely that it's you know it's oftentimes like hard to build these apps so there's not there's not too much like documentation or great answers to like common questions um on the technical end uh you know one thing that we have had to be extremely conscious of is just the performance of zk snarks in a browser-based game so i remember when we first when we put together the very very first kind of version just proof of concept end to end we were using snark js and which was at the time a javascript library for proof generation and i remember we ran our very first like zk snark for proving like you know that you could you could move
from planet a to planet b and you knew the pre images of these hashes and took over a minute and then we were like all right so you know we have to figure out something else if we want if if this is to be a feasible game because we can't have people sitting there and waiting for like a minute as their snark generates um you know fortunately jordy has a version of you know at that time he had he had recently published webster uh which was basically you know it was a tool for generating these snark proofs with wasm and that brought us down to you know in kind of a reasonable range where it would take like a second or two for these proofs to generate in browser um however as the project's evolved and we've wanted to do more and more complex things
this performance bottleneck has really been kind of biting us so one thing that we're really excited about is um right now you know when you when we specify the universe we're going to specify basically that you know one in approximately 16 000 coordinates is going to be a habitable planet the rest are just empty space but sort of the characteristics of the planets are fairly you know uniform if that makes sense so this basically looks like if you zoom way out on a map that you've mined a ton of it basically just looks like it sort of starts looking like noise if you zoom out too far right because it's like you know a random one out of every 16 000 planets uniformly across all of space is a habitable planet there's not
really much interesting texture the way that you can add texture into these sorts of games that are generated according to an algorithm is via you know techniques in quote unquote procedural generation um so these are the sorts of algorithms that give minecraft its complexity and coherence so you know in minecraft you have mountain ranges you have different biomes like this area is a bunch of forests and then it transitions into like this like a tundra or something like that that all happens with procedural generation and in particular a lot of it is based on an algorithm called purlin noise so you know we we thought to ourselves well the game's not like the game is not that interesting if the entire universe is just flat noisy playing
so can we introduce some texture into it and that got us thinking about like you know can we introduce these more complex procedural generation algorithms into snarks like we basically have to snarkify the pearl and noise algorithm um and after a couple of weeks we we did get it working and we were starting to see you know there's these interesting dynamics of like oh you know there's this ocean over here where there's no planets here's like a choke point here's like a hub with a lot of high value things the problem is though to get purlin noise to wrangle it down into a form that's able to be processed in a snark took a lot of kind of you know hacking and the second thing was that you know it almost 10xed our proof time so oh no and this is with a really simple version of
purlin noise too so it's a version that a lot of nice things are stripped out of you know one of the next things that we would be really excited about for increases in performance is you know we can make much more expressive and layered and rich worlds if we're able to introduce more expressive procedural generation algorithms inside snarks but that's only possible if snarks themselves get faster or more efficient protocols start hitting production and that's one thing we're really looking forward to wow this brings a question to my mind of like how would you plan to upgrade or expand like would you launch a new game with the new world or would you tack the new world onto the side like world of warcraft
yeah definitely so the first uh the first couple of games that we're going to be running they're going to be sort of like time box almost like beta play tests so they'll have a definite end date to them um and then like you know the following version after that is going to be you know a new contract with a bunch of stuff refreshed one of my goals with dark force in general is to get to a point where you know we feel confident enough in the game physics and mechanics and all of these things that it's able to live as you know a persistent universe but more broadly the thing that i'm particular you know at that point though you know i don't i don't think that dark forest or the concepts behind dark force are just static you know it's not it's not complete
there's all sorts of other interesting constructions that are further out that we've been kind of exploring and thinking about for ways to use zkn games dark force is one particular way that you can use zk to make a particular kind of strategy game but if you know the performance and expressiveness of snarks improves over time you know we've been brainstorming ideas for like a zk dungeon crawler flash roguelike game or like zk rpgs or zk even sandbox games nice and these are games which require like a lot more performance on the snark end but it's it's definitely something that is kind of in what the ideal long-term vision could be if the technology can get there which we think it will
wow that is so cool but yeah i mean we're the you know we're super excited once we sort of realize that uh zk has very natural applications to gaming um you know sort of ideas just started flying you know and we've had many like a late night talk about like oh man it turns out that you can actually do this mechanic too with zk and like we've never thought about that before and you know it seems like the sort of thing that just would be impossible on a blockchain um so yeah i'm really looking forward to seeing what other people create as well here this is so it's so cool and i i hope our audience enjoyed that because i sounds like it's unlocking a lot of potential on blockchains to explore this
kind of stuff i think this is huge potential outside of blockchain too actually like there's a big problem in the gaming industry where games are becoming more and more complex that the centralized servers just can't really manage that all the state that's required and what this does effectively is pushes the computational burden from the centralized server to the client and the server is just like an accountant keeping track of hashes that's a super simple job and so if you go back to like whatever world of warcraft there's a limit on the number of players that can be on any one server because that's what the physical machine can handle but you could have a much
much larger world if the centralized server all is doing is just managing hashes yeah and that's actually one of the crazy things like i know people talking about like ethereum being just the slowest computer in the world a lot but one thing that we realize as we've been building this is that in a really weird way the you know the game the way we've set it up is almost like infinitely scalable and what i mean by this is like you know a lot of times in these kinds of let's say there's a genre of these persistent uh strategy space conquest games in a lot of these games there will be you know players will play on servers that are limited to say 2 000 or even 200 players at once simply because there has to be a server that's that's managing all of this um but the interesting thing here is
that every single player like regardless of whether we have 10 players 100 or even 100 000 can live in the same persistent universe and be affecting you know the terrain in in this shared world and that's something that's a surprising consequence to me of building this on ethereum because usually i think about like ethereum apps is very limited in what they can do but if you're just tracking hashes that's all you got to do well thank you so much brian for coming on the show and sharing this with us yeah thank you very much yeah thanks for having me it was a bit of a different episode it was like we went more into the game space but yeah you've definitely got us both thinking so thank you um and yeah i mean if anyone is interested
in either checking the game out or getting in touch with us you know the link is zkga.me and i think we're probably going to start posting some updates and content to twitter as well at dark forest underscore eath so if you want to keep up then feel free to take a look at those there you go thanks again awesome yeah and to our listeners thanks for listening thanks for listening [Music] you