# Build your first onchain game with MUD in 5 minutes by Alvarius | Devcon SEA

- Channel: [Devcon](https://streameth.org/devcon)
- Date: 2025-10-07
- Duration: 06:59
- Watch: https://streameth.org/watch/yt-twSYvUk55TQ
- YouTube: https://www.youtube.com/watch?v=twSYvUk55TQ

## Description

Have you ever wanted to build a game that runs fully onchain, but didn’t know where to start?

In this lightning talk, Alvarius will walk you through the basics of MUD, an application framework designed for games and autonomous worlds, and build a minimal onchain game from scratch.

Learn the basics, learn the tooling, and learn where to go to keep learning and building after this session.

Speaker(s): Alvarius
Skill level: Beginner
Track: Developer Experience
Keywords: Frameworks, Gaming, Autonomous World, mud

Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum, https://warpcast.com/devcon
Learn more about devcon: https://www.devcon.org/
Learn more about ethereum: https://ethereum.org/ 

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on Swarm, IPFS and more.

Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. 
Devcon SEA was held in Bangkok, Thailand on Nov 12 - Nov 15, 2024.
Devcon is organized and presented by the Ethereum Foundation. To find out more, please visit https://ethereum.foundation/

## Transcript

install the the dependencies and while this is running this takes couple seconds while this is running I'm going to quickly explain you what mud is so mud is a fully onchain uh well mud is a full stack framework for building fully onchain games or really any onchain app that you want to build and now that the um dependencies have been installed we can start the local Dev Runner which will start a uh client Dev Runner and it will also start a contract Dev Runner and it will also start a local node and it will also start the local World Explorer all right the first thing we're going to have a look at is our client our Cent need the video to start there you go all right so the first thing we're going to have a look at is our client for that we're going to open the URL that's printed here and mud has onboarding and smart accounts built in so we could connect uh our external wallet here or we can just create a fresh wallet that's pasy controlled here um and then create a local uh session account that received some delegations from the main wallet um so that now we can move our little color blop here in this in this world um without having to hit approve every time again all right let's have a look at the Explorer next um for that we'll click this little button here on the bottom in mut all the state is stored in tables and the state the onchain state is automatically synchronized with the client and also with the Explorer here so we as we move around our little color blob um we can see the state on the bottom in our Explorer update and we can also explore all the other state that's in this app and then another very useful feature that the Explorer gives us is um the interact tab where it basically automatically synchronizes the entire ABI of the world dynamically um and then we can use the interact functionality here to interact with the world directly um for stuff that doesn't have UI yet for example so in this case we're going to move another we're going to spawn another color blop and uh move it around by calling the functions directly on the Explorer and then now it's time to add some game mechanics to add some functionality for that we're going to open our fav favorite code editor and we're going to open uh in this case the move system systems are what mud uses to implement the logic of the game so the move system here for example implements the logic to move a player and this is where we're going to add um one more game mechanic which is the ability to teleport a player um in this case we can uh we we just receive two input variables and then we're going to write them to the onchain table um and then as we write that it's going to be synchronized to the client again and then once we save once we hit save here after we're done implementing this function the death Runner is going to pick up the change here um in the contract and it's going to redeploy redeploy upgrade it's actually not going to redeploy the world but it's going to upgrade the system um so we still see our state here and now immediately the new ABI has been synchronized and we can now interact with this uh with this new function that we've just built the teleport function all right I think this is pretty good so far so it's time to deploy to a chain um for that we're going to run the deploy command and this in this case we're going to deploy to the r rol light chain and we didn't have to fund our deployer account here because it's actually going to use Smart accounts again and the deployments are going to be sponsored um so now we have deployed to real chain and we can now um run the client again against this version that we have just deployed um and then we can open our browser again and connect wallet again this time to real chain um and then yeah we're in and we can again move around um in our little world if you want to try out this game I won't promise it's fun but you can go on workshop. mde and and try it out try the onboarding flow and everything and if this made you a little bit curious um you should scan this QR code because there's a much better like longer version of this Workshop that's going to be held tomorrow at Mud day and this QR code is going to bring you right there um frolic from our team is going to hold that and he he's going to go into much more detail um and with that we're [Applause] done all right thank you let's take some live questions uh what is the tech stack you're building on so um this is mud so mud is the framework the the main piece um and then m is evm compatible so you can literally deploy to any evm chain there's no um yeah any any chain that can run evm bite code is is basically that and yeah we're using a bunch of like I mean we're using all the all the libraries that everybody is using um VM permissionless and so on so perfect so I'm going to mark that as answered do you have differentiators from either scan SL block that's probably a question for the previous stock so what's Roto light uh Roto light is just our our test net that we're running um it's the the test net that belongs to Redstone um rolite is a type of redstone if you're curious um that's why it's called like that but yeah it's just a test net perfect um so we actually do have a one minute for any questions from the audience no all right cool oh we do have one over there let's that's a great question um it's you could you could technically represent them as mappings it's it's very similar to mappings like you just have the keys um that are the keys in the mapping and then you have the data that's the value in the mapping um we're not actually doing it as mappings because we we do some custom stuff to make it more efficiently uh more efficient but you could Implement them as mappings yeah like I mean I I have 10 seconds left so I I I can't go into detail but you can check out the code it's open source um but yeah it's it's like we're just using like assembly to basically pack the data as a
