gm everyone, I’m derio, ethereumnavi’s owner.
Recently, “on-chain game development” has been taking place mainly among crypto-core people around the world, and I have picked up on advanced examples such as Dark Forest and Isaac in my media.


After seeing these examples, some of you may be thinking, “I want to try on-chain game development too!”
However, when it comes time to build an on-chain game, many people may not know how to create it from scratch.
Therefore, I would like to pick up on “MUD,” which provide open source libraries and other resources in the EVM chain ecosystem to help solve such issues.

MUD simplify the development of on-chain games and enable participation in ambitious efforts to build an “autonomous world” by making each game interoperable. MUD simplify the development of on-chain games and enable participation in ambitious efforts to build an “autonomous world” by making each game interoperable.
Therefore, in this article, I would like to introduce and explain the open source engine for building an autonomous world called “MUD” and on-chain games “OP Craft” and “Sky Strife” that have been developed using MUD.
Let me begin by describing the structure of this article.
First, let me briefly introduce what a “MUD” is and its manager, Lattice, among others.
Then, to help you better understand MUD, I will provide an Overview of the ECS pattern as a solution to the challenges of on-chain game development, and the future development potential of MUD.
Finally, I will provide an overview of OP Craft and Sky Strife, both of which are in the process of developing on-chain games using MUD up to the time of writing.
I hope that this article will be of some help to those who are interested in understanding the Overview and points of focus of “MUD”.
※This article is for general informational purposes only and is not intended to be and should not be construed as legal or investment advice. Therefore, it is not a recommendation to purchase any particular FT/NFT and should be used only as a study.

If you wish to place an ad, please contact us here.
About “MUD”

Overview
MUD is an open source tool created to build Autonomous Worlds.
It advocates “autonomous worlds” as a concept beyond on-chain games, and provides an open-source library to solve all the challenges of building them on the Ethereum ecosystem.

It is also unique in that it is designed to be highly composable in order to be open source.

For example, these two games are completely different genres, but built on the exact same infrastructure.

Managed by Lattice

The MUD development team is called “Lattice” and consists mainly of the following team members
The author’s understanding of Lattice is that it is “a crypto-core team working to build an ‘autonomous world’ that is a higher version of the on-chain game.

Incidentally, Lattice’s Twitter account has about 5,200 followers at the time of writing, but is followed by Larry Cermak, sassal, and many others in the VC and crypto-core crowd.
Better understanding of MUD
This chapter will first focus on a “Basic Overview of the ECS Pattern” as a preliminary step to a deeper understanding of MUD, with the aim of providing a general intuition about ECSs.
After that, I would like to touch on future development possibilities, such as what advantages there are in using MUD to build on-chain games.
This chapter may be skipped by those who want to learn only the Overview and case studies of MUD rather than the mechanics of MUD.

First of all, ECS stands for “Entity Component System,” a term that refers to a software architecture pattern used primarily in game development.
The ECS pattern is an alternative to other common software architecture paradigms such as class-based “inheritance” and, according to the Lattice team, “solved the challenges I had in building an autonomous world“.
Issues they had before using the ECS pattern
So what challenges did the Lattice team face in building an autonomous world on-chain before learning about the ECS pattern?

As it turns out, they had major problems with the maintainability, composability, and mudulability of the code before they knew about ECS.
Let’s see what it all means, with a simple example.

There are many different types of entities in the world, such as creatures and matter.
So, let’s first imagine creating a game using two types of entities, Monster
and Donkey
.

And let me assume that both of these Monster
and Donkey
can move.
At this point, in a world with classes and inheritance, I can create a base class called Movable and have the classes of Monster
and Donkey
inherit from this base class.

Now, let’s say you want to add Combat
to the game.
If you want “Monster
participates in Combat
, but Donkey
does not,” you would put the combat logic into the Monster
class.

However, let’s say I add a new entityTower
, that participates in combat but cannot move.
If there were a Combat
base class that both Monster
and Tower
inherited from, this problem would be solved, but since Monster
already inherits from Movable
, multiple inheritance would be a source of bugs and could lead to major code maintainability problems. This is a major problem for the maintainability of the code.

If multiple inheritance is not allowed, there is no alternative but to duplicate the logic for both entities, respectively.

If I then add Chest
with Inventory
, and then Donkey
with Inventory
, what kind of bugs can I expect? It would be a terrible idea.
Solution by ECS Pattern

In this section, I will look at how ECS can solve the issues mentioned earlier.
As the name implies, the three basic building blocks in ECS are “entities,” “components,” and “systems.
- Entity (empty box)
- Mere ID (uint type), does not contain logic or data
- Component (data)
- Stores data and can be “attached” to entities
- Can be thought of as “properties,” but data is structured in a different way than class properties
- System (logic)
- Executes logic
- Handles only components, not entities

To better understand ECS, let me assume the case of creating three components: “Movable”, “Combat”, and “Inventory”.
Components are simply data and do not contain any processing content.
Processes for executing logic are treated separately as “systems,” and here I will add the following three systems.

- MovementSystem
- Handle the movement of any entity with Movable components
- CombatSystem
- Handle combat for any entity with a Combat component
- InventorySystem
- Processes inventory for any entity with an Inventory component
This makes the implementation of entities very simple and straightforward.


In addition, if you think “I want to add more types of entities from here!”, you will be able to write code that is more maintainable because it will be simple and easy to implement.
- Scout: [Movable]
- Warchest: [Combat, Inventory]
- Hero: [Movable, Combat, Inventory]
But the most important point here is that the ECS pattern “opens up a whole new level of high composability“.

Since each system only supports a limited number of components, the logic is highly isolated and at the same time very extensible.
Future development potential

Talking about the Solidity part of the game engine, each component is itself a contract (○○.sol), and furthermore, there is a central “World Contract” for each component to record about itself.
This allows the World contract to emit an event whenever the value of each component changes, and the client can receive it to represent its local state.

As I have learned, components contain no logic at all, only “data,” and all logic is implemented in the system.
And just as each component records itself in the World Contract, every system is itself a contract (XX.sol).
Furthermore, a notable point of the World Contract is that it has no owner and is permissionless.

While every component system implements its own interface, it is recorded in the World contract, so there is no need to fork the client, and new content can be added and automatically displayed when it is added.
In other words, those who build on-chain games using MUD are not forking the game or creating their own world. They are adding new features to the “autonomous world” that already exists.
Overview of major products using MUD

This chapter provides an overview of two on-chain game projects, OP Craft and Sky Strife, which are built using MUD.
Main products 1: “OP Craft”

OP Craft is an on-chain (OP Stack) 3D voxel game that advocates an “autonomous voxel world”.
Officially launched on October 18, 2022, the game is the result of a technical collaboration between the Lattice and Optimism teams.

By combining the on-chain game engine “MUD” described earlier and Optimism’s “OP Stack”, a 3D autonomous world is constructed.

All the elements that make up the OP Craft world (rivers, blades of grass, mountains, etc.), their states, and the history of user actions are stored as on-chain information and ultimately recorded as transactions in Ethereum (L1).

Since the main theme of this issue is “MUD,” I will not go into details about OP Craft, but I will cover it in another article when I have a chance.
Main products 2: “Sky Strife”


Sky Strife is a fully on-chain RTS (real-time strategy game) built using the MUD game engine.
The goal of the game is to “build an army, defeat the enemy, and be the first to escape with the loot” and the rough story synopsis is as follows
- Sky Strife takes place on a world called Amalgema at the bottom of the universe
- Due to its unique location, there are always floating islands in the sky called “Shards” from other worlds.
- The people of Amalgema have learned that these “Shards” contain valuable power artifacts.
- As a result, when new Shards appeared, a battle for the Shards ensued.
Incidentally, at the recent Devcon Bogota, it appears that there were also tournaments with prizes. If you are interested, please follow the link below.
3/ AW Arcade: On Wednesday 4:00pm at the Devcon hacker basement, we’ll be showcasing two of our latest projects built with MUD: a fully on-chain 3D voxel world, and Sky Strife: a real-time strategy game. We will run a tournament with prizes.
— Lattice (@latticexyz) October 9, 2022
more info: https://t.co/9qHlYUrNku pic.twitter.com/ycIA2Co9Wl


The above is an overview of on-chain games built using the MUD game engine.
I expect that as the development of OP Craft, Sky Strife, and other representative games continues, while MUD-based on-chain games emerge and become interoperable, the effects of their efforts to design for composability will begin to show.
Summary


If you wish to place an ad, please contact us here.
In this article, I introduced and explained the open source engine for building an autonomous world called “MUD” and the on-chain games “OP Craft” and “Sky Strife” that are being developed using MUD.
I hope that this article has been helpful to those who are interested in understanding the overview and points of focus of “MUD”.
If you found it useful, I would appreciate it if you could share it on Twitter or comment on it.
🆙posted an article in English about MUD.@latticexyz @frolic @Kooshaba https://t.co/bxho97ctQ0
— でりおてんちょー|derio (@yutakandori) March 22, 2023