Gaming-Specific Blockchain Infra with Curio
ETHCC 6 · July 2023 · 42:18
Yijia Chen examines EVM execution-layer customizations for large onchain games. The presentation connects Curio's infrastructure work with user-generated content and emergent game design.
Speakers
Topics
From ETHCC 6, hosted by Ethereum France.
Transcript
hello awesome cool let's get started so good afternoon um welcome to uh to my talk I will be talking today about gaming specific blockchain infra in the next chapter of blockchain games using fully onchain Paradigm and uh first briefly introducing myself I'm EA I'm co-founder of curial research we are a Crypton native game and infrastructure company dedicated to supercharging the success of onchain games or blockchain games in general and today I'll be talking about a couple things first all games should start from the experience it creates because unlike
D5 games succeed because of the holistic experience that they engender in players right that's the number one thing people care about and with I will argue that with onchain games and especially fully onchain games I'll expl explain that term in a bit there's a massive design space that just opened up uh for game developers to really Express and for players to experience and uh these design paradigms are need to be based on some a tech infrastructure that is really beyond what today's blockchain info can support and that's why my title is uh is about this blockchain infra so before I dive into the details
allow me a quick philosophical detour what makes the real world feel real to all of you is it just the rendering quality obviously higher than all the games you played but is that all of it humans have been social animals from the beginning whether we live in small villages or sping cities and large states very powerful states the social relationships we the relationships we have with other people are very complex whether it's with your parents with your family with your colleagues and they are great assets that are held by us and perhaps the
greatest gift of humanity however if you think about the online games the multiplayer games you played is there a game that have matched the complexity and the interestingness of real life social interactions I'm guessing the answer is probably not but why is that let's take a moment to look at the the current social soci layer in multiplayer games does anyone recognize this game right here Starcraft how many of you have played it by a show of hands or maybe see your friends play it cool so Starcraft is a very classic RTS uh game
that allows players to compete right and you know we get it the thrill of commanding a group of army and annihilating other people's armies is is quite quite uh hard to find in other places but if you think about the social interactions in Starcraft it's very simple players compete with each other there's minimal Co cooperation or collaboration that happens and this is very common in the type of game that we call social 1.0 games where PVP is the main interaction and there's minimal cooperation or any other you know interactions in between other there are lots of games from 30 40
years ago when video games first became a thing to today that follow this social 1.0 Paradigm such as csgo you know OverWatch kind of uh players unknowns Battleground a lot of these games right they're interesting but not in terms of the social aspect then we have what what we call social 2.0 games which most MMOs are social 2.0 games on top of the PVP or pure versus pure relations right the competition it adds a layer of group or collaboration with its with its game defined alliances and guilds or or groups um so the primary interaction
that happens in this type of games uh basically all the MMOs you know like word of Warcraft Eve online are collaboration within a group and competition between groups and there's not much else and this is this is a huge step forward right from social 1.0 because all of a sudden you're not just trying to kill all of your the other players that you see in the game there's some kind of relationship perhaps most often find a hierarchy within a group uh so this picture shown here is Rise of Kingdoms it's basically a more longer form and many more players type of civilization um but less strategic it's a MMO tweak of the game of of 4X
strategy games in this game a game often runs for a season uh sometime from two month to three month and there're usually and players are organized into guilds uh which are absolute groups that usually players don't enter and exit very frequently and Within These groups there's a very strong hierarchy there's usually one or at least uh at most a couple of Guild leaders ERS who are usually the biggest whales who put in the most money and often time and these players have tremendous power over the smaller players who simply play the game but do not spend that much and the game developers often only really care about the players at the top and you know as
an ordinary player let's look more deeply at the social relations in these type of games where let's say you are a player in the guild or group on the left and let's say you want to do anything uh or interact in any way with the player that's highlighted on the bottom right let's say it's if your guild wins you are willing to share some of the gains uh with that player or let's say you want to trade a rare type of resource for your own benefit which is very common in real life right you can't do that because the only type of meaningful relation between you guys is
the competition between your guilds there's nothing else right and similar this does not limit to the individuals it also applies to the groups if the guild leader of the Guild on the left wishes to sign a peace treaty right with the Guild on the right and let's say concentrate and attack the the third Guild they also can't do that or maybe they may verbally agree but there's no real consequence if one site reects on its promise this is fundamentally why online games have been struggling to recreate or mirror the diversity of real world social interactions now let's take a step back
and envision a a specific scenario uh actually yeah let's let's think first a bit about what the real world does better than these onchain or sorry online games uh at social interactions fundament we think the real world has two very important components that constructs the social aay for it to be complex and interesting the first is valuable truly valuable assets such as definitely not just your CSO skin or these games that these game items that worth at most maybe a couple hundred or thousands of of of euros dollars whatever it's there are things like your
house or the you know very expensive jewelries you have whatever whatever things that you really really value that make you care about the experience and on top of that there's a effective law enforcement mechanism that protect people's interactions around these assets and this way right you don't have to uh let's imagine you go to work with your colleagues if you enter a an argument with your colleagues you don't have to worry about them seizing your house or killing you right because there's the law enforcement and there these there there we make a lot of TR deals every day these are the fundamentals of interactions we have
with other people but we usually don't have to worry too much uh when other people breaks the promise because it don't happen often and if it happens usually they will get punished but this is not the case for ENT for online games or digital worlds what would be a solution to this how would onine games or online games catch up I keep spoiling it in fact blockchain games have already provided half of the puzzle which is real way to have valuable assets online and share with other players in a way that other players can see we already have a lot of innovation without me needing to mention innovation in digital assets that are decentralized
and very very secure comparable with real some would even think more secure than real life but what's the other half of the puzzle the part that actually enforces people's promises that allows people to interact with others without worrying the validity of each let's imagine a specific sit uh situation in a hypothetical Grand strategy game in this strategy game like typical strategy games you start with maybe a capital some troops and you have a clear objective such such as Conquering the the great City in the middle and in the process you encounter this player named vitalic who's not that strong on along the same level as you
and there's a couple let's say there's a couple gold mines that's sitting between your territories that are just changing hands because you both want it you both want them very very bad one day vitalic texts you and says f i see the game named I see the this guy named Justin son approaching us with lots of level five Horsemen going to lose if we both continue fighting each other and you say okay what do you want to do metallic proposes that you stop attacking each other for three turns only right as as a beginning of just a gesture of friendship and whoever violates this must pay the other 500 gold this is pretty natural right in real life and
you agree to it you think it's a good deal now in two turns you thought about the situation again and you're like no I want the gold mines I'm going to V attack vitalic anyways what do you think should happen in this case well Justice seems to say that metallic should get you 500 gold right because you broke the promise but there's no real way to enforce that in current multiplayer games and so and but but but I ideal stage is that you have the game engine who's basically you know all powerful to uh which can
change any state to understand this promise that's made between you and metallic right and to execute that to automatically let's say deduct 500 gold from your own balance and give it to metallic how do you do that uh so there there's two parts to that solution one is the game engine understanding this interaction or this deal between two players and that kind of all alludes to large language models right in this in this ideal userflow where you basically have a chat like real world and it interprets that into something right and the second piece uh so so this first piece is very interesting but and we do see you know Ai and llms becoming much
more powerful in the past year and a half but it it's not quite there yet even though we know we'll get there perhaps within a couple years but the second piece is very anable which is what language or what what's the computer language that really this human language is translated into right that's able to execute whatever interactions or whatever deal players make or whatever contracts player makes we thought about this a lot internally and we came up with a solution called treaties which is basically using smart contracts for social contracts it's very simple if you think about it smart contracts have been
the the contracts around Financial assets right in the blockchain world and essentially treaty is basically using that for more context-rich gaming worlds where there perhaps isn't just a couple rules but a lot of rules right we have same same as we have a lot of physical laws in in the in the current universe and anything that's within the boundaries of that physical law uh so a player cannot propose that they generate five times more gold every turn but they can propose that they lend the gold to someone else for some benefit right with some consequence if that promise is broken that is very powerful and without going too much into technical details
essentially think of treaties as the so new social building block of digital worlds in similar way as a physical building block might be treated might be seen as you know the Minecraft block and Etc this will be essentially the missing piece to having multifaceted social interactions like in real worlds on in in online worlds and what can what can this be right let me give some examples simple things can include non-aggression packs such as what we saw in the vitalic example but you can also have very complex examples for example NATO North North Atlantic Treaty organ organization which is essentially a defense pack you
can have Guild currencies imagine Saudi Arabia launches in currency that's one to one backed with oil which is very high value in-game resource right and you can even have onchain democracies that or other different government forms which allows the community to govern and to elect leaders and to set policies Etc all of these are possible with smart contracts and trees therefore are uniquely suited for blockchains right A lot of people have asked me why is this not doable in web 2 well there's a couple reasons why one it's actually possible if the game company anticipates every single way players wish to
interact with each other right but think of how impossible or think of how impossible that is uh to even in a very simple game to anticipate what exactly players want to do with each other and that's why only when the game logic is on chain AKA fully onchain right and and and fully verifiable as a result does this treaty system actually work right does that part make sense yeah so this is like a huge breakthrough in our opinion and we made a game out of it so previously uh curio we started building onch games right after dark force V6 in end of 2021 um where we saw a lot of
community partic participation we thought oh this is a very interesting field and and there's definitely a lot of innovation though we didn't know what quite that would be yet but we real when we thought of treaties we were like holy this is huge and we built a game that is a fully launching game otherwise but incorporates the idea of treaties in the game so in this in this game that we launched in January 2022 uh 2020 sorry 2023 uh this year uh we had a I think around uh a few dozen a dozen or so treaties uh with if you count the parameters a couple dozen uh for example non-aggression pack you
have embargo packs that you that allow people to place embargos on each other you have lending prot uh lending um contracts and and fun story actually right so this game is was a a battle royale game where the objective is to com ER the middle tile and hold it for some time and the there were there were two kind of loose alliances towards the end of the game one was a couple of players that formed a very strong Alliance and that um they basically held the middle tile to uh um uh around 12 hours before the game ended and they were basically about to win right
however I think around six or five or six hours before the game actually ended the the final Victor signed a a troop lending uh treaty with another player who had happened to have a lot of troops and was next to him and borrowed a lot of Horsemen and just went for the center and actually won right so treaties actually affected how the game turned out which was ex which like when we build the game we completely didn't anticipate we thought people would just treat it as a toy and this confirmed our belief into this social three 3.0 world where social relations and the social layer will increasingly mirror and draw from the real
life people really enjoyed the game uh proof and yeah and we are you know at curio we're building a breakthrough realtime war strategy game after that with with high stakes I would say you know all of our games build before are more like demos that we use or PC's proof of concept that we use to to validate certain Concepts this one is real uh it will have the complete experience the complete economy elements and all of that and fully on chain and I haven't still talked about the infra element so let's get get into that let's take a step back and look
at at this point I've talked a lot about the the social layer social component fully onchain right and hopefully you guys have a a broad sense of WHY blockchain games and onchain games have a unique take at solving the social problem in physical or sorry in digital games but what exactly does such a game need I've talked about a couple slides ago right that there are two very powerful and Central components uh which are the the social composability so you need to have a system for the player to draft up arbitrary interactions the final form is is Lang models or chat but the intermediate stage would be something
like smart contracts uh and the which the system can interpret and execute by its own on its own and and you also need the trustless of onine assets uh that that provides a defense of players assets but at the same time right you also need things like high performance great graphics lick ux all of these things that great games often need right without those it's just much harder to to have a scenario where you need and and and and would have a lot of treaties in the first place to be more specific right let's you know the the screenshot on the top in the bottom left is from our 3D game as well if you look at the last two
lines this player called Xerox hemal was saying the blue ones don't move but you're trying really hard to move and the red ones don't attack but you really want to attack so the context for this was that we build treaties on a a a basically evm like a fully smart contract based game logic um type of architecture where all of the game logic lived as smart contracts in addition to the the treaties or the social contracts and but the consequence of that was uh the blue ones actually did like basically the troop when moving would blink blue and when it's attacking would blink red but the in the the the time from the moment of intent to the actual
execution by the system was so long it was something around 15 seconds where people were like are my troops truly moving or am I doing something wrong that is not an ideal experience for onchain games right and a lot of the current onchain games including Dark Forest which is probably the most well-known uh on the top right kind of avoid this problem by limiting its design space to actions that take a long time so even though Dark Forest in a lot of games say their RTS or real-time strategy every action in Dark Forest usually take somewhere between 15 minutes to several hours just because of the performance constraints of the
systems right and and that's drastically different from the the games that we think of when we think of multiplayer games so how do you solve that a lot of people actually think you know onchain games are interesting you might have have all of these interesting social components but it's just never going to be fast it's never going to be you know pretty that doesn't have to be the case again first principles is helpful here and uh oh before I dive into our solution right the specific problems that first of all when you have a complex game the TPS is is very slow the transactions per second and the reason here is not quite with the execution layer like evm it's itself doesn't have
a problem when it comes to defi or a lot of other uh purposes but for games because games have a lot of context right the transaction are often hundreds or thousands of times bigger than defi transactions in our game for example each transaction averages in tens of millions of gas to hundreds of millions of gas which is something that cannot even go on mainnet uh let alone you know count for a typical defi transaction and this is not even you know look at our game right this is not something that you would play you know with like millions of players this is a fairly simple game and yet we already hit the bottleneck even with a single node evm
rollup and what makes it worse is that today's blockchains don't even have a native game tick and again this is not something that the ethereum team thought of right it was not built for games so what does game Teck mean let's say you want to move from point point A to point B in any MMO game right the intent of moving from A to B is an intent and then the action what actually happens is the game moves you moves your little unit uh every you know unit distance let's say like a small tile to the right or down or whatever Direction and that happens many times before you actually get to point B but in today's blockchains there's no such thing as letting the system do that
for you the player has to send the transaction for every small movement that actually takes place in changes state basically any state changes need to originate from a transaction and why is that bad because one it's very unintuitive and two there's a lot of repeated computation for example every time you move you probably need to check oh is the Army yours right that part is repeated which adds to the B performance bottleneck and and finally for those of you who've written ins solidity I hope you already understand you know it's just not the easiest language to work with especially when it comes to complex systems like games even with Foundry test
kit with all of these problems in mind we've spent a couple month in the past um till today building Keystone and Keystone is a a a revolutionary rollup based onchain game engine framework made specifically to 100x Performance of onchain games and by the way the 100 is an understatement not an exaggeration so before diving into details let me show you a demo which we already posted on Twitter today but uh I'll just show it again so essentially we used the warcraft assets War of Warcraft 3 which is one of the earliest
uh not earliest but most popular RTS games and we put everything on chain everything you see here the logic the movements the the battle the uh you know the locations of trees the buildings and the the armies everything happens on chain and I don't know how familiar you guys are with the current state of onchain games but if you look at some other oning games today this is like a huge you know more than 100x performance boost yes say that again so this is uh Keystone is is
Sovereign rollup based basically yeah I'll get to the technical next slide and after yeah great question yes all actions yes not the rendering but all logical actions cool so yeah the features of of Keystone it's first of all a high throughput ECS based game engine ECS just stands for a way game stores the data and it has fast game tick supporting classic any classic RTS style games uh a lot of people ask you know why not Starcraft it's because
we can't uh we can't use Starcraft assets but totally you can put Starcraft or a similar game onchain it supports historical state quing so this is very important for treaties uh let's say you sign with a player you know if you don't attack me for three turns I'll do something for you the fourth Returns part is not about the current state right it's about a historical uh phenomenon and and you need to be able to query for that and obviously Keystone supports easily integratable smart contracts social contract execution and it's completely evm compatible all of the smart contracts are written in evm in solidity and the game logic is written in go so
specifically the architecture is as a as follows and feel free to come ask me more questions afterwards uh if you have specific questions briefly we have we we have two things running side by side with each other one is the go-based game engine okay the text is kind of small uh I'll try to zoom in a bit uh on the right you have the game engine that uh is written in go and basically it has all of the game specific optimizations like game Teck and uh embedded in indexer so you don't have to have an external indexer and a lot of other nice things that that blockchains don't have and on the left you have the evm uh modified evm uh
where it executes the small the user smart contract that that represent the the social interactions and the two systems interoperate with stateful promiles which are essentially the EVMS uh you know custom functions think of it that way and the the the game the game State and data when the game is running gets settled or posted to Celestia for data availability and then also to uh an L1 like ethereum or any other L1 that the community chooses in the spitter Spirit of sovereign rollups uh and on the on L1 there are a couple contracts such as game manager and game staking uh that
manages the financial or the heavy Financial elements of the game and the sequencer right so the let's say you know there there's a couple of multisig sequencers or guard uh Community Guardians that can run the game and the multisig has the power of uh actually the entire Community has the power to Monitor and and and examine whether the guardian who's running the game it has treated or acted maliciously and at any moment when that happens uh the multii can vote out whoever Guardian uh whichever Guardian is acting maliciously replace that and invalidate all of the uh the mistaken Financial results from that period of time so from
that uh perspective it is optimistic it's kind of like arbitrum setup actually so yeah with with uh setups like Keystone which really uh take a step forward from the very vanilla evm approach right and adds a lot of the game game uh specific stuff we believe this is the first steps toward social 3.0 games where you don't just have PVP or gvg group versus group but you have uh an array of different types of interactions where the line between friends and enemies are blurred just like maybe you and your colleagues or
your parents um you know and and it's with these infrastructures that we think games or worlds like ready player one can truly emerge from and finally what is curio doing to advance this plot right there's a couple things first we've already actually open sourced Keystone uh on our GitHub repo so feel free to check it out out uh but you know at this stage by the way it's a very I would say early and primitive model we welcome all suggestions and feedback and we want you to actually stress test the system and tell us what is inappropriate what can be better and we're taking several weeks to launch V2
which will be you know better tested it will have much more documentation more friendly to third party uh to community developers we are as I said earlier building our Flagship a flagship game taking into account a lot of these design paradigms that just open up and hopefully build a really Fire game that people remember this is uniquely fully onchain and finally probably the most important we realized that the extent of new game design space that has opened up is Way Beyond a lot of people's imagination and we alone definitely we both don't want to and don't have the capacity to
explore all the design directions that may be valid right and that's why we've decided to take a very active and and proactive approach to support uh people who want to build on top of Keystone who want to build uh onchain games and we will provide helps that are Way Beyond the typical hackathon level of help we will provide you with uh connect you with our team that that you you will need uh we will we might even Provide Capital we will help you think about how to uh you know have your game onchain Etc and if you're interested just uh come reach reach out to me details will come out probably next week or so thank you and see you on chain
[Applause] soon I think yeah open for questions hi thank you very much a quick question was uh 3T uh built up on on top of mud at first or did you use any custom ECS and uh second one um so we we saw dojo this morning uh did you Benchmark it and uh how fast would be Keystone against dojo for instance first question we are so we've always built on our custom infra uh I would say our first version was quite similar to Mud basically it's like a full smart contract e ECS based um
engine if you call it but it really it's it's like a backend game backend server that exists on the blockchain right so so it's pretty similar but uh we wanted to have a lot of custom stuff so we basically build it on uh and you were asking about Dojo from my understanding I didn't read the Cairo code but Dojo is very similar I think to Mud today and Keystone is therefore a fundamentally different approach of having the game in chain rather than onchain in that sense where yeah you basically have you know the evm that processes the social contracts and at the same time the game that runs in parallel with the evm and interoperate
with pre-comp compiles right and and I don't think the current systems actually have anything like Trey um in terms of the game design so there's two kind of big differences yes so you're asking about the relation
between the groups the team plays and the kind of onchain communities yeah I mean oh I mean that's definitely something that can natively occur I think right now we just haven't seen good games that people even want to do something like that on but yeah totally I mean auning communities or or like communities are a form of of social organization um you know like a a dow for example can have its own social contracts that govern how uh leaders elected how policies are are are passed right and and you can totally have that
in the game Contex extend that the game context as well uh in many ways yeah that's that's definitely uh a very interesting Direction hey this is Joan from open Ford I'm wondering as well when it comes to to rollups as a service and like everyone kind of like spinning out their own um app chain do you guys will um make it available for games to decide whether they want to have Concepts like a can abstraction natively or like what what are your views on um like smart contract wallets having like being having to be deployed on each different rollup based on the game Etc so there's kind of two questions
there one is like what we think of about account abstraction and deploying on different rollups and two like about just rollups as a service in general is that yeah first one would be do you do you have the customization to make it natively on the rollup like can natively I mean yes definitely like we we plan to uh it's just not the the absolute top priority right now but it's definit like for example a big paino in traditional games is when you have to you know sell the sell accounts or borrow accounts for a couple days and then return it right that's definitely something that blockchains can um solve very well as well so definitely yeah and then in terms of how we think about uh sorry what was your second part again like how
how are you thinking of um you know EAS versus smart contract wallets um when like thousands of players come to a specific rollup and they to start intera well I think they serve as different roles right like smart contract wallets for example in a treaty can be a smart contract wallet which like let's say you have like a uh like an in-game treasury or of some sort that a couple of uh wallets addresses control then you know that wallet can can have its own assets that are controlled by maybe EA wallets uh in some like we had that in my previous game actually I forgot which exact treaty it was um but it had its
own uh armies that I think it's a collective defense fund um but yeah I think there many different ways you can integrate and compose these things yeah that was a good question uh well thank you for talk it was very interesting uh I just want to know maybe more about the ticking system and how do you enforce automatic smart contract execution what's the technical behind all of this do that is a great question so I would uh to repeat the question you're asking about the the tick system when it comes to automatic smart contract execution right yeah well because I I know that there are someone
who's building a similar system in the op stack and he was unfor forcing ticking in each block and I don't know how do you handle that and just want to have some feedbacks on that yeah that's a great question and basically you notice that the tick in smart contract execution might be different from the tick in the game right and and that is actually a correct observation so uh in the case when Smart in the case when treaties can be verified AKA run or executed uh within the the tick length of of the game let's say it's like every 100 milliseconds then they can just be the same tick and basically uh let's say let's say we have a treaty that says you cannot be on my territory uh and if if
you step on my territory like you have to pay me 500 gold right and that basically is every time you move uh onto a new location right um the treaty runs and and sees okay like you know sorry what's your name yeah yeah I you get the idea um but if it takes longer right then there's a couple Solutions one you could have kind of and they're all these are all you know brainstorms SP they might not be the final solution one one one way you can do it is you can have a longer tick for the smart contract side uh every you know let's say it takes like 500 milliseconds to execute the smart contracts then you have every 500
seconds uh milliseconds um run that and then like revert all of the changes that actually shouldn't have happened in the in the game side um and you know that that's kind of like a judgment day type of type of logic um you could also just manually extend all the game ticks to match the smart contract um and you can also limit the the complexity there there's many things you can do but yeah does does that answer your question yeah and then in terms of ordering right uh like I think absolute ordering is more important in defi than in games in games you can totally have some scenarios where you know some like it
just happens to be that the other person's treaty executes before you and maybe that has some minimum consequences we make the design so that it doesn't hurt too much but uh we think that's not as big of a negative consequence um in games compared to defi yeah thank you s for [Music]
[Music]